|
50 | 50 | type: boolean |
51 | 51 |
|
52 | 52 | jobs: |
| 53 | + pre-build-image-check: |
| 54 | + runs-on: ubuntu-latest |
| 55 | + outputs: |
| 56 | + should_skip: ${{ steps.check-skip.outputs.should_skip }} |
| 57 | + steps: |
| 58 | + - name: Check if job should be skipped |
| 59 | + id: check-skip |
| 60 | + run: | |
| 61 | + if [[ "${{ inputs.node }}" == "gaudi3" || "${{ inputs.node }}" == "rocm" || "${{ inputs.node }}" == "arc" ]]; then |
| 62 | + echo "should_skip=true" >> $GITHUB_OUTPUT |
| 63 | + else |
| 64 | + echo "should_skip=false" >> $GITHUB_OUTPUT |
| 65 | + fi |
| 66 | +
|
53 | 67 | #################################################################################################### |
54 | 68 | # Image Build |
55 | 69 | #################################################################################################### |
56 | 70 | build-images: |
| 71 | + needs: [pre-build-image-check] |
| 72 | + if: ${{ needs.pre-build-image-check.outputs.should_skip == 'false' }} |
57 | 73 | runs-on: "docker-build-${{ inputs.node }}" |
58 | 74 | steps: |
59 | 75 | - name: Clean Up Working Directory |
@@ -105,12 +121,33 @@ jobs: |
105 | 121 | inject_commit: ${{ inputs.inject_commit }} |
106 | 122 | tag: ${{ inputs.tag }} |
107 | 123 |
|
| 124 | + pre-compose-test-check: |
| 125 | + needs: [pre-build-image-check, build-images] |
| 126 | + if: always() |
| 127 | + runs-on: ubuntu-latest |
| 128 | + outputs: |
| 129 | + run_compose: ${{ steps.check-compose.outputs.run_compose }} |
| 130 | + steps: |
| 131 | + - name: Check if job should be skipped |
| 132 | + id: check-compose |
| 133 | + run: | |
| 134 | + set -x |
| 135 | + run_compose="false" |
| 136 | + if [[ ${{ inputs.test_compose }} ]]; then |
| 137 | + if [[ "${{ needs.pre-build-image-check.outputs.should_skip }}" == "false" && "${{ needs.build-images.result}}" == "success" || "${{ needs.pre-build-image-check.outputs.should_skip }}" == "true" ]]; then |
| 138 | + run_compose="true" |
| 139 | + fi |
| 140 | + fi |
| 141 | + echo "run_compose=$run_compose" |
| 142 | + echo "run_compose=$run_compose" >> $GITHUB_OUTPUT |
| 143 | +
|
| 144 | +
|
108 | 145 | #################################################################################################### |
109 | 146 | # Docker Compose Test |
110 | 147 | #################################################################################################### |
111 | 148 | test-example-compose: |
112 | | - needs: [build-images] |
113 | | - if: ${{ fromJSON(inputs.test_compose) }} |
| 149 | + needs: [pre-compose-test-check] |
| 150 | + if: ${{ always() && needs.pre-compose-test-check.outputs.run_compose == 'true' }} |
114 | 151 | uses: ./.github/workflows/_run-docker-compose.yml |
115 | 152 | with: |
116 | 153 | tag: ${{ inputs.tag }} |
|
0 commit comments