Skip to content

Commit 13cf23c

Browse files
committed
ci: fix nix cpp build wrappers
1 parent cbbe711 commit 13cf23c

4 files changed

Lines changed: 25 additions & 14 deletions

File tree

.github/scripts/clang-tidy-nix.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
extra_args=()
5+
if [[ -n "${NIX_CFLAGS_COMPILE:-}" ]]; then
6+
# Nix cc setup hooks expose system include paths through compiler flags.
7+
# clang-tidy needs those flags explicitly because it does not execute the
8+
# Nix compiler wrapper while parsing the compile database.
9+
nix_cflags=( ${NIX_CFLAGS_COMPILE} )
10+
for flag in "${nix_cflags[@]}"; do
11+
extra_args+=( "--extra-arg=$flag" )
12+
done
13+
fi
14+
15+
exec clang-tidy "${extra_args[@]}" "$@"

.github/workflows/build-kuebikodb.yaml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
CCACHE_MAXSIZE: 2G
2525
CCACHE_BASEDIR: ${{ github.workspace }}
2626
CCACHE_NOHASHDIR: true
27+
NODISTCC: true
2728
outputs:
2829
md5sum: ${{ steps.checksum.outputs.md5sum }}
2930
steps:
@@ -44,22 +45,13 @@ jobs:
4445
- name: Configure ccache
4546
if: ${{ inputs.enable_ccache }}
4647
run: |
47-
nix develop .#cpp -c sh -c '
48-
mkdir -p "$CCACHE_DIR" "$GITHUB_WORKSPACE/.cache-wrappers"
49-
printf "#!/bin/sh\nexec ccache clang \"\$@\"\n" > "$GITHUB_WORKSPACE/.cache-wrappers/clang"
50-
printf "#!/bin/sh\nexec ccache clang++ \"\$@\"\n" > "$GITHUB_WORKSPACE/.cache-wrappers/clang++"
51-
chmod +x "$GITHUB_WORKSPACE/.cache-wrappers/clang" "$GITHUB_WORKSPACE/.cache-wrappers/clang++"
52-
ccache --max-size="$CCACHE_MAXSIZE"
53-
ccache --zero-stats
54-
'
48+
mkdir -p "$CCACHE_DIR"
49+
nix develop .#cpp -c ccache --max-size="$CCACHE_MAXSIZE"
50+
nix develop .#cpp -c ccache --zero-stats
5551
- name: Generate the building system
5652
run: |
5753
git config --global --add safe.directory $GITHUB_WORKSPACE
58-
if [ '${{ inputs.enable_ccache }}' = 'true' ]; then
59-
nix develop .#cpp -c ./configure.py --mode ${{ inputs.build_mode }} --with scylla --compiler "$GITHUB_WORKSPACE/.cache-wrappers/clang++" --c-compiler "$GITHUB_WORKSPACE/.cache-wrappers/clang"
60-
else
61-
nix develop .#cpp -c ./configure.py --mode ${{ inputs.build_mode }} --with scylla
62-
fi
54+
nix develop .#cpp -c ./configure.py --mode ${{ inputs.build_mode }} --with scylla
6355
- run: |
6456
nix develop .#cpp -c ninja build/${{ inputs.build_mode }}/scylla
6557
- id: checksum

.github/workflows/clang-tidy.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
CCACHE_MAXSIZE: 2G
4242
CCACHE_BASEDIR: ${{ github.workspace }}
4343
CCACHE_NOHASHDIR: true
44+
NODISTCC: true
4445
steps:
4546
- uses: actions/checkout@v4
4647
with:
@@ -66,11 +67,12 @@ jobs:
6667
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
6768
-DCMAKE_C_COMPILER=clang \
6869
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
70+
-DCMAKE_CXX_FLAGS="-Wno-error=deprecated-builtins" \
6971
-DScylla_USE_LINKER=ld.lld \
7072
-DCMAKE_CXX_COMPILER=clang++ \
7173
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
7274
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
73-
-DCMAKE_CXX_CLANG_TIDY="clang-tidy;--checks=$CLANG_TIDY_CHECKS" \
75+
-DCMAKE_CXX_CLANG_TIDY="bash;$GITHUB_WORKSPACE/.github/scripts/clang-tidy-nix.sh;--checks=$CLANG_TIDY_CHECKS" \
7476
-G Ninja \
7577
-B $BUILD_DIR \
7678
-S .

flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
(final: prev: {
2929
# default.nix predates current nixpkgs and still references
3030
# package names that have been removed from unstable.
31+
antlr3 = prev.antlr3_4;
32+
fmt = prev.fmt_10;
3133
llvmPackages_15 = prev.llvmPackages;
3234
boost175 = prev.boost181;
3335
libyamlcpp = prev.yaml-cpp;

0 commit comments

Comments
 (0)