Skip to content

Commit ab5082e

Browse files
authored
Fix SIGILL crashes on GitHub runners via CPU-aware build cache keys (#1278)
1 parent 28fc258 commit ab5082e

2 files changed

Lines changed: 31 additions & 8 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,22 @@ jobs:
3535
- name: Checkouts
3636
uses: actions/checkout@v4
3737

38+
- name: Get system info for cache key
39+
id: sys-info
40+
run: |
41+
{
42+
uname -m
43+
cat /proc/cpuinfo 2>/dev/null | grep 'model name' | head -1 || sysctl -n machdep.cpu.brand_string 2>/dev/null || true
44+
${FC:-gfortran} --version 2>/dev/null | head -1 || true
45+
${CC:-gcc} --version 2>/dev/null | head -1 || true
46+
} | (sha256sum 2>/dev/null || shasum -a 256) | cut -c1-16 > /tmp/sys-hash
47+
echo "sys-hash=$(cat /tmp/sys-hash)" >> "$GITHUB_OUTPUT"
48+
3849
- name: Restore Build Cache
3950
uses: actions/cache@v4
4051
with:
4152
path: build
42-
key: mfc-coverage-${{ hashFiles('CMakeLists.txt', 'toolchain/dependencies/**', 'toolchain/cmake/**', 'src/**/*.fpp', 'src/**/*.f90') }}
53+
key: mfc-coverage-${{ steps.sys-info.outputs.sys-hash }}-${{ hashFiles('CMakeLists.txt', 'toolchain/dependencies/**', 'toolchain/cmake/**', 'src/**/*.fpp', 'src/**/*.f90') }}
4354

4455
- name: Setup Ubuntu
4556
run: |

.github/workflows/test.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ jobs:
9898
- name: Clone
9999
uses: actions/checkout@v4
100100

101-
- name: Restore Build Cache
102-
uses: actions/cache@v4
103-
with:
104-
path: build
105-
key: mfc-build-${{ matrix.os }}-${{ matrix.mpi }}-${{ matrix.debug }}-${{ matrix.precision }}-${{ matrix.intel }}-${{ hashFiles('CMakeLists.txt', 'toolchain/dependencies/**', 'toolchain/cmake/**', 'src/**/*.fpp', 'src/**/*.f90') }}
106-
107101
- name: Setup MacOS
108102
if: matrix.os == 'macos'
109103
run: |
@@ -137,11 +131,29 @@ jobs:
137131
with:
138132
python-version: '3.14'
139133

134+
- name: Get system info for cache key
135+
id: sys-info
136+
run: |
137+
{
138+
uname -m
139+
cat /proc/cpuinfo 2>/dev/null | grep 'model name' | head -1 || sysctl -n machdep.cpu.brand_string 2>/dev/null || true
140+
if command -v ifx &>/dev/null; then ifx --version 2>/dev/null | head -1; else ${FC:-gfortran} --version 2>/dev/null | head -1 || true; fi
141+
${CC:-gcc} --version 2>/dev/null | head -1 || true
142+
} | (sha256sum 2>/dev/null || shasum -a 256) | cut -c1-16 > /tmp/sys-hash
143+
echo "sys-hash=$(cat /tmp/sys-hash)" >> "$GITHUB_OUTPUT"
144+
145+
- name: Restore Build Cache
146+
uses: actions/cache@v4
147+
with:
148+
path: build
149+
key: mfc-build-${{ matrix.os }}-${{ matrix.mpi }}-${{ matrix.debug }}-${{ matrix.precision }}-${{ matrix.intel }}-${{ steps.sys-info.outputs.sys-hash }}-${{ hashFiles('CMakeLists.txt', 'toolchain/dependencies/**', 'toolchain/cmake/**', 'src/**/*.fpp', 'src/**/*.f90') }}
150+
140151
- name: Build
141152
run: |
142-
/bin/bash mfc.sh test -v --dry-run -j "$(nproc)" --${{ matrix.debug }} --${{ matrix.mpi }} ${{ matrix.precision != '' && format('--{0}', matrix.precision) || '' }} $TEST_ALL
153+
/bin/bash mfc.sh test -v --dry-run -j "$(nproc)" --${{ matrix.debug }} --${{ matrix.mpi }} $PRECISION $TEST_ALL
143154
env:
144155
TEST_ALL: ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
156+
PRECISION: ${{ matrix.precision != '' && format('--{0}', matrix.precision) || '' }}
145157

146158
- name: Test
147159
run: |

0 commit comments

Comments
 (0)