Skip to content

Commit 01b1673

Browse files
Fix CCache usage in GitHub Actions (#6911)
1 parent d4dc297 commit 01b1673

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ env:
1515
CCACHE_TEMPDIR: /tmp/.ccache-temp
1616
CCACHE_COMPRESS: 1
1717
CASHER_TIME_OUT: 599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742
18-
CCACHE_VERSION: 3.3.1
1918
CMAKE_VERSION: 3.21.2
2019
ENABLE_NODE_BINDINGS: "ON"
2120

@@ -390,6 +389,9 @@ jobs:
390389
391390
- name: Prepare environment
392391
run: |
392+
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
393+
mkdir -p $HOME/.ccache
394+
393395
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
394396
echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
395397
echo "OSRM_INSTALL_DIR=${GITHUB_WORKSPACE}/install-osrm" >> $GITHUB_ENV
@@ -498,7 +500,7 @@ jobs:
498500
echo "Using ${JOBS} jobs"
499501
pushd ${OSRM_BUILD_DIR}
500502
501-
503+
ccache --zero-stats
502504
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
503505
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
504506
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \
@@ -515,7 +517,6 @@ jobs:
515517
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then
516518
make tests --jobs=${JOBS}
517519
make benchmarks --jobs=${JOBS}
518-
ccache -s
519520
sudo make install
520521
if [[ "${RUNNER_OS}" == "Linux" ]]; then
521522
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib" >> $GITHUB_ENV
@@ -618,7 +619,10 @@ jobs:
618619
omitNameDuringUpdate: true
619620
replacesArtifacts: true
620621
token: ${{ secrets.GITHUB_TOKEN }}
621-
622+
- name: Show CCache statistics
623+
run: |
624+
ccache -p
625+
ccache -s
622626
623627
benchmarks:
624628
if: github.event_name == 'pull_request'
@@ -652,7 +656,16 @@ jobs:
652656
with:
653657
ref: ${{ github.head_ref }}
654658
path: pr
655-
- run: python3 -m pip install "conan<2.0.0" "requests==2.31.0"
659+
- name: Install dependencies
660+
run: |
661+
python3 -m pip install "conan<2.0.0" "requests==2.31.0"
662+
sudo apt-get update -y && sudo apt-get install ccache
663+
- name: Prepare environment
664+
run: |
665+
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
666+
mkdir -p $HOME/.ccache
667+
ccache --zero-stats
668+
ccache --max-size=256M
656669
- name: Build PR Branch
657670
run: |
658671
mkdir -p pr/build
@@ -682,6 +695,10 @@ jobs:
682695
- name: Post Benchmark Results
683696
run: |
684697
python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results
698+
- name: Show CCache statistics
699+
run: |
700+
ccache -p
701+
ccache -s
685702
686703
ci-complete:
687704
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)