66 pull_request :
77 types : [opened, synchronize, reopened, ready_for_review]
88 workflow_dispatch :
9- schedule :
10- - cron : ' 0 6 * * 1' # Weekly Monday 6 AM UTC: refresh coverage cache before 7-day expiry
119
1210concurrency :
1311 # PRs: group by branch (new push cancels old). Push to master: unique per SHA (never cancelled).
5553 runs-on : ' ubuntu-latest'
5654 outputs :
5755 checkall : ${{ steps.changes.outputs.checkall }}
58- cases_py : ${{ steps.changes.outputs.cases_py }}
59- dep_changed : ${{ steps.dep-check.outputs.dep_changed }}
6056 steps :
6157 - name : Clone
6258 uses : actions/checkout@v4
@@ -67,95 +63,13 @@ jobs:
6763 with :
6864 filters : " .github/file-filter.yml"
6965
70- - name : Check for Fortran dependency changes
71- id : dep-check
72- env :
73- GH_TOKEN : ${{ github.token }}
74- run : |
75- # Detect added/removed use/include statements that change the
76- # Fortran dependency graph, which would make the coverage cache stale.
77- PR_NUMBER="${{ github.event.pull_request.number }}"
78- BEFORE="${{ github.event.before }}"
79- AFTER="${{ github.event.after }}"
80- if [ "${{ github.event_name }}" = "pull_request" ]; then
81- # Default to dep_changed=true if gh pr diff fails (safe fallback).
82- DIFF=$(gh pr diff "$PR_NUMBER" 2>/dev/null) || {
83- echo "gh pr diff failed — defaulting to dep_changed=true for safety."
84- echo "dep_changed=true" >> "$GITHUB_OUTPUT"
85- exit 0
86- }
87- elif [ "${{ github.event_name }}" = "push" ]; then
88- DIFF=$(git diff "$BEFORE".."$AFTER" 2>/dev/null) || {
89- echo "git diff failed for push event — defaulting to dep_changed=true for safety."
90- echo "dep_changed=true" >> "$GITHUB_OUTPUT"
91- exit 0
92- }
93- else
94- DIFF=""
95- fi
96- if echo "$DIFF" | \
97- grep -qE '^[+-][[:space:]]*(use[[:space:],]+[a-zA-Z_]|#:include[[:space:]]|include[[:space:]]+['"'"'"])'; then
98- echo "dep_changed=true" >> "$GITHUB_OUTPUT"
99- echo "Fortran dependency change detected — will rebuild coverage cache."
100- else
101- echo "dep_changed=false" >> "$GITHUB_OUTPUT"
102- fi
103-
104- rebuild-cache :
105- name : Rebuild Coverage Cache
106- needs : [lint-gate, file-changes]
107- if : >-
108- github.repository == 'MFlowCode/MFC' &&
109- (
110- (github.event_name == 'pull_request' &&
111- (needs.file-changes.outputs.cases_py == 'true' ||
112- needs.file-changes.outputs.dep_changed == 'true')) ||
113- (github.event_name == 'push' &&
114- (needs.file-changes.outputs.cases_py == 'true' ||
115- needs.file-changes.outputs.dep_changed == 'true')) ||
116- github.event_name == 'workflow_dispatch' ||
117- github.event_name == 'schedule'
118- )
119- timeout-minutes : 240
120- runs-on :
121- group : phoenix
122- labels : gt
123- steps :
124- - name : Clone
125- uses : actions/checkout@v4
126- with :
127- ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
128- clean : false
129-
130- - name : Rebuild Cache via SLURM
131- run : bash .github/scripts/submit-slurm-job.sh .github/workflows/common/rebuild-cache.sh cpu none phoenix
132-
133- - name : Print Logs
134- if : always()
135- run : cat rebuild-cache-cpu-none.out
136-
137- - name : Upload Cache Artifact
138- uses : actions/upload-artifact@v4
139- with :
140- name : coverage-cache
141- path : toolchain/mfc/test/test_coverage_cache.json.gz
142- retention-days : 1
143-
144- - name : Save Coverage Cache
145- uses : actions/cache/save@v4
146- with :
147- path : toolchain/mfc/test/test_coverage_cache.json.gz
148- key : coverage-cache-${{ github.event.pull_request.number || 'master' }}-${{ hashFiles('toolchain/mfc/test/cases.py') }}-${{ github.sha }}
149- continue-on-error : true
150-
15166 github :
15267 name : ${{ matrix.nvhpc && format('NVHPC {0} ({1})', matrix.nvhpc, matrix.target) || format('Github ({0}, {1}, {2}, {3})', matrix.os, matrix.mpi, matrix.debug, matrix.intel && 'intel' || 'GNU') }}
153- needs : [lint-gate, file-changes, rebuild-cache ]
68+ needs : [lint-gate, file-changes]
15469 if : >-
15570 !cancelled() &&
15671 needs.lint-gate.result == 'success' &&
15772 needs.file-changes.result == 'success' &&
158- (needs.rebuild-cache.result == 'success' || needs.rebuild-cache.result == 'skipped') &&
15973 needs.file-changes.outputs.checkall == 'true'
16074 strategy :
16175 matrix :
@@ -236,44 +150,6 @@ jobs:
236150 - name : Clone
237151 uses : actions/checkout@v4
238152
239- - name : Fetch master for coverage diff
240- run : |
241- git fetch origin master:master --depth=1
242- git fetch --deepen=200
243- continue-on-error : true
244-
245- - name : Download Coverage Cache (from rebuild in this run)
246- id : cache-artifact
247- uses : actions/download-artifact@v4
248- with :
249- name : coverage-cache
250- path : toolchain/mfc/test
251- continue-on-error : true
252-
253- - name : Restore Coverage Cache (from previous run)
254- if : steps.cache-artifact.outcome != 'success'
255- id : cache-restore
256- uses : actions/cache/restore@v4
257- with :
258- path : toolchain/mfc/test/test_coverage_cache.json.gz
259- key : coverage-cache-${{ github.event.pull_request.number || 'master' }}-${{ hashFiles('toolchain/mfc/test/cases.py') }}-${{ github.sha }}
260- restore-keys : |
261- coverage-cache-${{ github.event.pull_request.number || 'master' }}-
262- coverage-cache-master-
263- continue-on-error : true
264-
265- - name : Coverage Cache Status
266- run : |
267- if [ "${{ steps.cache-artifact.outcome }}" = "success" ]; then
268- echo "Coverage cache: loaded from rebuild artifact (this run)"
269- elif [ "${{ steps.cache-restore.outputs.cache-hit }}" = "true" ]; then
270- echo "Coverage cache: restored from actions/cache (previous run)"
271- elif [ -f toolchain/mfc/test/test_coverage_cache.json.gz ]; then
272- echo "Coverage cache: using committed fallback in repo"
273- else
274- echo "Coverage cache: none available — full test suite will run"
275- fi
276-
277153 # ── NVHPC: pull image and start a long-lived container ──────────────
278154 # Replaces the container: directive so we can free disk space first.
279155 # Uses "docker run -d ... sleep infinity" + "docker exec" to preserve
@@ -386,11 +262,10 @@ jobs:
386262 - name : Test
387263 if : ' !matrix.nvhpc'
388264 run : |
389- /bin/bash mfc.sh test -v --max-attempts 3 -j $(nproc) $ONLY_CHANGES $ TEST_ALL $TEST_PCT $PRECISION
265+ /bin/bash mfc.sh test -v --max-attempts 3 -j $(nproc) $TEST_ALL $TEST_PCT $PRECISION
390266 env :
391267 TEST_ALL : ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
392268 TEST_PCT : ${{ matrix.debug == 'reldebug' && '-% 20' || '' }}
393- ONLY_CHANGES : ${{ github.event_name == 'pull_request' && '--only-changes' || '' }}
394269 PRECISION : ${{ matrix.precision != '' && format('--{0}', matrix.precision) || '' }}
395270
396271 # ── NVHPC build + test (via docker exec into long-lived container) ──
@@ -427,12 +302,11 @@ jobs:
427302
428303 self :
429304 name : " ${{ matrix.cluster_name }} (${{ matrix.device }}${{ matrix.interface != 'none' && format('-{0}', matrix.interface) || '' }}${{ matrix.shard != '' && format(' [{0}]', matrix.shard) || '' }})"
430- needs : [lint-gate, file-changes, rebuild-cache ]
305+ needs : [lint-gate, file-changes]
431306 if : >-
432307 !cancelled() &&
433308 needs.lint-gate.result == 'success' &&
434309 needs.file-changes.result == 'success' &&
435- (needs.rebuild-cache.result == 'success' || needs.rebuild-cache.result == 'skipped') &&
436310 github.repository == 'MFlowCode/MFC' &&
437311 needs.file-changes.outputs.checkall == 'true' &&
438312 github.event.pull_request.draft != true
@@ -524,38 +398,6 @@ jobs:
524398 - name : Clean stale output files
525399 run : rm -f *.out
526400
527- - name : Download Coverage Cache (from rebuild in this run)
528- id : cache-artifact
529- uses : actions/download-artifact@v4
530- with :
531- name : coverage-cache
532- path : toolchain/mfc/test
533- continue-on-error : true
534-
535- - name : Restore Coverage Cache (from previous run)
536- if : steps.cache-artifact.outcome != 'success'
537- id : cache-restore
538- uses : actions/cache/restore@v4
539- with :
540- path : toolchain/mfc/test/test_coverage_cache.json.gz
541- key : coverage-cache-${{ github.event.pull_request.number || 'master' }}-${{ hashFiles('toolchain/mfc/test/cases.py') }}-${{ github.sha }}
542- restore-keys : |
543- coverage-cache-${{ github.event.pull_request.number || 'master' }}-
544- coverage-cache-master-
545- continue-on-error : true
546-
547- - name : Coverage Cache Status
548- run : |
549- if [ "${{ steps.cache-artifact.outcome }}" = "success" ]; then
550- echo "Coverage cache: loaded from rebuild artifact (this run)"
551- elif [ "${{ steps.cache-restore.outputs.cache-hit }}" = "true" ]; then
552- echo "Coverage cache: restored from actions/cache (previous run)"
553- elif [ -f toolchain/mfc/test/test_coverage_cache.json.gz ]; then
554- echo "Coverage cache: using committed fallback in repo"
555- else
556- echo "Coverage cache: none available — full test suite will run"
557- fi
558-
559401 - name : Fetch Dependencies
560402 if : matrix.cluster != 'phoenix'
561403 timeout-minutes : 60
0 commit comments