Add fail-fast guards for long-running training failures #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Train Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| paths: | |
| - "Dockerfile.train" | |
| - ".dockerignore" | |
| - "train.py" | |
| - "train_improved.py" | |
| - "src/engine/**" | |
| - "src/model/**" | |
| - "src/game/**" | |
| - "src/data/**" | |
| - "pyproject.toml" | |
| - "uv.lock" | |
| - ".github/workflows/build-train-image.yml" | |
| pull_request: | |
| paths: | |
| - "Dockerfile.train" | |
| - ".dockerignore" | |
| - "train.py" | |
| - "train_improved.py" | |
| - "src/engine/**" | |
| - "src/model/**" | |
| - "src/game/**" | |
| - "src/data/**" | |
| - "pyproject.toml" | |
| - "uv.lock" | |
| - ".github/workflows/build-train-image.yml" | |
| workflow_dispatch: | |
| concurrency: | |
| group: build-train-image-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/ataxx-train | |
| tags: | | |
| type=sha,format=long | |
| type=ref,event=branch | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and (optionally) push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile.train | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |