Skip to content

Commit b0bccde

Browse files
committed
ci: capture compiler warnings from all CI matrix builds
Enable self-hosted runners to collect warnings from nvfortran (Phoenix), Cray ftn (Frontier), and AMD flang (Frontier AMD). Rebuild MFC targets with -j1 in staging dirs to capture warnings with file/line context. Skip dependency dirs (fftw, hdf5, silo, lapack). Use find instead of ls to avoid ANSI color codes in filenames. This CI change is temporary and will be reverted before merge.
1 parent 2f04943 commit b0bccde

File tree

2 files changed

+72
-2
lines changed

2 files changed

+72
-2
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# Rebuild each target with -j1 to capture compiler warnings with file/line info.
3+
# Runs inside a SLURM job after the main build completes.
4+
5+
set -uo pipefail
6+
7+
echo "=== Collecting compiler warnings ==="
8+
9+
for staging_dir in build/staging/*/; do
10+
[ -f "$staging_dir/CMakeCache.txt" ] || continue
11+
# Skip dependency builds
12+
case "$staging_dir" in *fftw*|*hdf5*|*silo*|*lapack*) continue ;; esac
13+
target_dir=$(find "$staging_dir/CMakeFiles/" -maxdepth 1 -name '*.dir' -type d 2>/dev/null | head -1)
14+
[ -z "$target_dir" ] && continue
15+
target=$(basename "$target_dir" .dir)
16+
17+
echo ""
18+
echo "=== Target: $target ==="
19+
cd "$staging_dir"
20+
# Touch all generated .f90 to force recompile
21+
find fypp/ -name '*.f90' -exec touch {} + 2>/dev/null
22+
# Rebuild single-threaded to get clean warning output with file/line context
23+
make "$target" -j1 2>&1 | grep -E "Warning:|warning:" -B3 || echo "(no warnings)"
24+
cd - > /dev/null
25+
done
26+
27+
echo ""
28+
echo "=== Done collecting warnings ==="

.github/workflows/test.yml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,35 @@ jobs:
261261
TEST_ALL: ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
262262
PRECISION: ${{ matrix.precision != '' && format('--{0}', matrix.precision) || '' }}
263263

264+
- name: Collect Compiler Warnings
265+
if: always()
266+
run: |
267+
echo "::group::Compiler warnings"
268+
for staging_dir in build/staging/*/; do
269+
[ -f "$staging_dir/CMakeCache.txt" ] || continue
270+
# Skip dependency builds (fftw, hdf5, silo, lapack)
271+
case "$staging_dir" in *fftw*|*hdf5*|*silo*|*lapack*) continue ;; esac
272+
target=$(find "$staging_dir/CMakeFiles/" -maxdepth 1 -name '*.dir' -type d 2>/dev/null | head -1 | xargs basename 2>/dev/null | sed 's/\.dir//')
273+
[ -z "$target" ] && continue
274+
echo "=== Rebuilding $target for warnings ==="
275+
cd "$staging_dir"
276+
find fypp/ -name '*.f90' -exec touch {} + 2>/dev/null
277+
make "$target" -j1 2>&1 | grep -E "Warning:|warning:" -B2 > /tmp/warnings_${target}.txt 2>&1 || true
278+
count=$(grep -c "Warning:\|warning:" /tmp/warnings_${target}.txt 2>/dev/null || echo 0)
279+
echo "--- $target: $count warnings ---"
280+
cat /tmp/warnings_${target}.txt
281+
cd - > /dev/null
282+
done
283+
echo "::endgroup::"
284+
285+
- name: Upload Warning Reports
286+
if: always()
287+
uses: actions/upload-artifact@v4
288+
with:
289+
name: warnings-${{ matrix.os }}-${{ matrix.mpi }}-${{ matrix.debug }}-intel-${{ matrix.intel }}
290+
path: /tmp/warnings_*.txt
291+
if-no-files-found: ignore
292+
264293
- name: Test
265294
run: |
266295
/bin/bash mfc.sh test -v --max-attempts 3 -j $(nproc) $ONLY_CHANGES $TEST_ALL $TEST_PCT
@@ -278,8 +307,7 @@ jobs:
278307
needs.file-changes.result == 'success' &&
279308
(needs.rebuild-cache.result == 'success' || needs.rebuild-cache.result == 'skipped') &&
280309
github.repository == 'MFlowCode/MFC' &&
281-
needs.file-changes.outputs.checkall == 'true' &&
282-
github.event.pull_request.draft != true
310+
needs.file-changes.outputs.checkall == 'true'
283311
# Frontier CCE compiler is periodically broken by toolchain updates (e.g.
284312
# cpe/25.03 introduced an IPA SIGSEGV in CCE 19.0.0). Allow Frontier to
285313
# fail without blocking PR merges; Phoenix remains a hard gate.
@@ -408,6 +436,20 @@ jobs:
408436
- name: Build
409437
run: bash .github/scripts/submit-slurm-job.sh .github/workflows/common/build.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.cluster }} ${{ matrix.shard }}
410438

439+
- name: Collect Compiler Warnings
440+
if: always()
441+
run: |
442+
bash .github/scripts/submit-slurm-job.sh .github/workflows/common/collect-warnings.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.cluster }} ${{ matrix.shard }} || true
443+
444+
- name: Print Warnings
445+
if: always()
446+
run: |
447+
echo "::group::Compiler warnings (${{ matrix.cluster_name }} ${{ matrix.device }}-${{ matrix.interface }})"
448+
for f in collect-warnings-*.out; do
449+
[ -f "$f" ] && cat "$f"
450+
done
451+
echo "::endgroup::"
452+
411453
- name: Test
412454
run: bash .github/scripts/submit-slurm-job.sh .github/workflows/common/test.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.cluster }} ${{ matrix.shard }}
413455

0 commit comments

Comments
 (0)