Skip to content

Commit a350dd7

Browse files
committed
[#1400] make CI script more robust when sccache fails to pull cache
1 parent 10889b2 commit a350dd7

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

.github/actions/build/action.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,20 @@ runs:
5252

5353
- name: Setup sccache
5454
uses: mozilla-actions/sccache-action@v0.0.10
55+
continue-on-error: true
56+
with:
57+
disable_annotations: true
5558

5659
- name: Set sccache as compiler launcher
5760
shell: bash
5861
run: |
59-
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
60-
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
61-
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
62+
if command -v sccache >/dev/null 2>&1; then
63+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
64+
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
65+
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
66+
else
67+
echo "sccache is unavailable; continuing without compiler caching"
68+
fi
6269
if [[ "${{ runner.os }}" == 'Windows' ]]; then
6370
echo "CMAKE_BUILD_PARALLEL_LEVEL=$(python -c 'import os; print(os.cpu_count() or 1)')" >> $GITHUB_ENV
6471
fi

.github/workflows/pull-request.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
pip install pytest-error-for-skips pytest-timeout
3434
pytest -n auto -m "not ciSkip" -rs --error-for-skips --timeout=300 --timeout-method=thread -v
3535
- name: CTest
36-
if: ${{ always() }}
36+
if: ${{ always() && hashFiles('dist3/CTestTestfile.cmake') != '' }}
3737
working-directory: dist3
3838
run: ctest --output-on-failure
3939

@@ -59,7 +59,7 @@ jobs:
5959
pytest -n auto -m "not ciSkip" -rs --error-for-skips --timeout=300 --timeout-method=thread -v
6060
if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}
6161
- name: CTest
62-
if: ${{ always() }}
62+
if: ${{ always() && hashFiles('dist3/CTestTestfile.cmake') != '' }}
6363
shell: pwsh
6464
working-directory: dist3
6565
run: |
@@ -103,7 +103,7 @@ jobs:
103103
pip install pytest-error-for-skips pytest-timeout
104104
pytest ${{ matrix.pytest_flags }}
105105
- name: CTest
106-
if: ${{ always() }}
106+
if: ${{ always() && hashFiles('dist3/CTestTestfile.cmake') != '' }}
107107
working-directory: dist3
108108
run: ctest -C Release --output-on-failure
109109

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Made CI builds continue without ``sccache`` when compiler-cache setup is unavailable.

0 commit comments

Comments
 (0)