Skip to content
name: Sklearn Server Docker Publisher
on:
push:
branches:
- master
- sklearn-runtime-schedule-retry-on-failure
tags:
- v*
pull_request:
env:
IMAGE_NAME: sklearnserver
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Main Test job
test:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64/v8, linux/ppc64le]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
# Cache Docker layers from previous runs
- name: Restore Docker Cache
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ matrix.platform }}-${{ hashFiles('python/sklearn.Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-${{ matrix.platform }}-
# Run tests using Docker Buildx
- name: Run tests
id: run_tests # Give this step an ID to reference its result
uses: docker/build-push-action@v5
with:
platforms: ${{ matrix.platform }}
context: python
file: python/sklearn.Dockerfile
push: false
cache-from: type=gha,src=/tmp/.buildx-cache
cache-to: type=gha,dest=/tmp/.buildx-cache,mode=max
provenance: false
timeout-minutes: 20 # timeout for the test job
# Log the test result after the test job
log-result:
runs-on: ubuntu-latest
needs: test
if: ${{ always() }}
steps:
- name: Log test result
run: |
echo "Test job result: ${{ needs.test.result }}"
# Retry job that executes if the test job fails for any platform, retry only on linux/ppc64le
retry:
runs-on: ubuntu-latest
needs: test
if: ${{ needs.test.result == 'failure' }} # Run retry only if the test job failed
strategy:
matrix:
platform: [linux/ppc64le] # Only retry for linux/ppc64le
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
# Restore Docker Cache for retry job
- name: Restore Docker Cache
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ matrix.platform }}-${{ hashFiles('python/sklearn.Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-${{ matrix.platform }}-
# Run retry tests using Docker Buildx and cached layers
- name: Run tests again for ppc64le
uses: docker/build-push-action@v5
with:
platforms: ${{ matrix.platform }}
context: python
file: python/sklearn.Dockerfile
push: false
cache-from: type=gha,src=/tmp/.buildx-cache
cache-to: type=gha,dest=/tmp/.buildx-cache,mode=max
provenance: false