Skip to content

Commit bb5cab5

Browse files
authored
ci: cache cpp-linter build (#782)
1 parent a1f3514 commit bb5cab5

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/cpp-linter.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
name: C++ Linter
1919

2020
on:
21+
push:
22+
branches:
23+
- main
24+
paths-ignore:
25+
- '.github/**'
26+
- 'ci/**'
27+
- 'cmake_modules/**'
2128
pull_request:
2229
types: [opened, synchronize, reopened, ready_for_review]
2330
paths-ignore:
@@ -38,6 +45,9 @@ jobs:
3845
permissions:
3946
contents: read
4047
pull-requests: write
48+
env:
49+
SCCACHE_DIR: ${{ github.workspace }}/.sccache
50+
SCCACHE_CACHE_SIZE: "2G"
4151
steps:
4252
- name: Checkout iceberg-cpp
4353
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -48,20 +58,41 @@ jobs:
4858
run: |
4959
sudo apt-get update
5060
sudo apt-get install -y libcurl4-openssl-dev libsqlite3-dev libpq-dev default-libmysqlclient-dev
61+
- name: Restore sccache cache
62+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
63+
with:
64+
path: ${{ github.workspace }}/.sccache
65+
key: sccache-cpp-linter-ubuntu-${{ github.run_id }}
66+
restore-keys: |
67+
sccache-cpp-linter-ubuntu-
68+
- name: Setup sccache
69+
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
5170
- name: Run build
5271
env:
5372
CC: gcc-14
5473
CXX: g++-14
5574
run: |
5675
mkdir build && cd build
5776
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
77+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
78+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
5879
-DICEBERG_BUILD_SQL_CATALOG=ON \
5980
-DICEBERG_SQL_SQLITE=ON \
6081
-DICEBERG_SQL_POSTGRESQL=ON \
6182
-DICEBERG_SQL_MYSQL=ON
6283
cmake --build .
84+
- name: Show sccache stats
85+
shell: bash
86+
run: sccache --show-stats
87+
- name: Save sccache cache
88+
if: github.ref == 'refs/heads/main'
89+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
90+
with:
91+
path: ${{ github.workspace }}/.sccache
92+
key: sccache-cpp-linter-ubuntu-${{ github.run_id }}
6393
- uses: cpp-linter/cpp-linter-action@0f6d1b8d7e38b584cbee606eb23d850c217d54f8 # v2.15.1
6494
id: linter
95+
if: github.event_name == 'pull_request'
6596
continue-on-error: true
6697
env:
6798
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -78,7 +109,7 @@ jobs:
78109
# need '-fno-builtin-std-forward_like', see https://github.com/llvm/llvm-project/issues/101614
79110
extra-args: '-std=c++23 -I$PWD/src -I$PWD/build/src -I$PWD/build/_deps/sqlpp23-src/include -I/usr/include/postgresql -I/usr/include/mysql -fno-builtin-std-forward_like'
80111
- name: Fail fast?!
81-
if: steps.linter.outputs.checks-failed != 0
112+
if: github.event_name == 'pull_request' && steps.linter.outputs.checks-failed != 0
82113
run: |
83114
echo "some linter checks failed. ${STEPS_LINTER_OUTPUTS_CHECKS_FAILED}"
84115
exit 1

0 commit comments

Comments
 (0)