Skip to content

Commit

Permalink
perf(ci): avoid building cuda image everytime
Browse files Browse the repository at this point in the history
from the docs: The jobs.<job_id>.if condition is evaluated before jobs.<job_id>.strategy.matrix is applied. So we can't just use matrix.dockerfile so we have to build both images if one of the two files change, or we will have to split this into two.

it was previously built everytime due to the evaluation of
matrix.dockerfile to an empty string

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idif
  • Loading branch information
youben11 committed Oct 3, 2024
1 parent 6c81e0c commit 925a37d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/compiler_publish_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ jobs:

- name: Login
id: login
if: contains(steps.changed-files.outputs.modified_files, '${{ matrix.dockerfile }}') || contains(steps.changed-files.outputs.modified_files, env.THIS_FILE)
# from the docs: The jobs.<job_id>.if condition is evaluated before jobs.<job_id>.strategy.matrix is applied. So we can't just use matrix.dockerfile
# so we have to build both images if one of the two files change, or we will have to split this into two
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idif
if: contains(steps.changed-files.outputs.modified_files, 'docker/Dockerfile.cuda-118-env') || contains(steps.changed-files.outputs.modified_files, 'docker/Dockerfile.cuda-123-env') || contains(steps.changed-files.outputs.modified_files, env.THIS_FILE)
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login -u ${{ secrets.GHCR_LOGIN }} --password-stdin ghcr.io

- name: Build Tag and Publish
Expand Down

0 comments on commit 925a37d

Please sign in to comment.