@@ -29,10 +29,16 @@ permissions:
2929 contents : read
3030
3131jobs :
32+ pre-flight :
33+ uses : NVIDIA-NeMo/FW-CI-templates/.github/workflows/_cicd_preflight.yml@main
3234
3335 cicd-wait-in-queue :
36+ needs : [pre-flight]
3437 runs-on : ubuntu-latest
3538 environment : test
39+ if : |
40+ needs.pre-flight.outputs.is_ci_workload == 'false'
41+ && needs.pre-flight.outputs.docs_only == 'false'
3642 steps :
3743 - name : Running CI tests
3844 run : |
@@ -62,10 +68,17 @@ jobs:
6268 runner : linux-amd64-cpu16
6369 timeout : 30
6470 cpu-only : true
65- needs : [cicd-container-build]
71+ needs : [pre-flight, cicd-container-build]
6672 runs-on : ${{ matrix.runner }}
6773 name : ${{ matrix.script }}
6874 environment : nemo-ci
75+ if : |
76+ (
77+ success()
78+ || needs.pre-flight.outputs.is_ci_workload == 'true'
79+ || needs.pre-flight.outputs.force_run_all == 'true'
80+ )
81+ && !cancelled()
6982 steps :
7083 - name : Checkout
7184 uses : actions/checkout@v4
8598
8699 Nemo_CICD_Test :
87100 needs :
101+ - pre-flight
88102 - cicd-container-build
89103 - cicd-unit-tests
90- if : always()
104+ if : |
105+ (
106+ needs.pre-flight.outputs.docs_only == 'true'
107+ || needs.pre-flight.outputs.is_deployment_workflow == 'true'
108+ || needs.pre-flight.outputs.is_ci_workload == 'true'
109+ || always()
110+ )
111+ && !cancelled()
91112 runs-on : ubuntu-latest
92113 permissions : write-all
93114 steps :
@@ -99,13 +120,15 @@ jobs:
99120 env :
100121 GH_TOKEN : ${{ github.token }}
101122 RUN_ID : ${{ github.run_id }}
123+ DOCS_ONLY : ${{ needs.pre-flight.outputs.docs_only }}
124+ IS_DEPLOYMENT : ${{ needs.pre-flight.outputs.is_deployment_workflow }}
125+ IS_CI_WORKLOAD : ${{ needs.pre-flight.outputs.is_ci_workload }}
102126 run : |
103127 # Get workflow run details and check job conclusions
104- LATEST_ATTEMPT=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion != null) | .conclusion] | last')
105128 NUM_FAILED=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion == "failure") | .name] | length')
106129 NUM_CANCELLED=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion == "cancelled") | .name] | length')
107130
108- if [[ $NUM_FAILED -eq 0 && $NUM_CANCELLED -eq 0 ]]; then
131+ if [[ ( $NUM_FAILED -eq 0 && $NUM_CANCELLED -eq 0) || $DOCS_ONLY == 'true' || $IS_DEPLOYMENT == 'true' || $IS_CI_WORKLOAD == 'true' ]]; then
109132 RESULT="success"
110133 elif [[ $NUM_CANCELLED -gt 0 ]]; then
111134 RESULT="cancelled"
@@ -180,9 +203,41 @@ jobs:
180203 exit 1
181204 fi
182205
206+ Coverage_Fake :
207+ runs-on : ubuntu-latest
208+ needs : [Nemo_CICD_Test, pre-flight]
209+ if : |
210+ (
211+ needs.pre-flight.outputs.docs_only == 'true'
212+ || needs.pre-flight.outputs.is_deployment_workflow == 'true'
213+ )
214+ && needs.pre-flight.outputs.is_ci_workload == 'false'
215+ && !cancelled()
216+ environment : nemo-ci
217+ steps :
218+ - name : Generate fake coverage report
219+ uses : actions/github-script@v6
220+ with :
221+ github-token : ${{ secrets.PAT }}
222+ script : |
223+ await github.rest.repos.createCommitStatus({
224+ owner: context.repo.owner,
225+ repo: context.repo.repo,
226+ sha: context.sha,
227+ state: 'success',
228+ description: 'No code changes - coverage check skipped',
229+ context: 'codecov/patch'
230+ });
231+
183232 Coverage :
184233 runs-on : ubuntu-latest
185- needs : [Nemo_CICD_Test]
234+ needs : [pre-flight, Nemo_CICD_Test]
235+ if : |
236+ (
237+ (needs.pre-flight.outputs.is_ci_workload == 'true' && !failure())
238+ || success()
239+ )
240+ && !cancelled()
186241 strategy :
187242 matrix :
188243 flag : [unit-test]
0 commit comments