Skip to content

Commit 8ceeaa6

Browse files
committed
ci: Add olddeps job to test old dependencies versions
The CI job currently just tests old Cap'n Proto versions, but it might be nice to extend in the future to test old compilers & build tools too. Support for versions of Cap'n Proto before 0.7.0 was dropped in #88 in order to avoid compiler warnings and simplify code. Before that, versions back to 0.5 were supported and are basically still compatible since the Cap'n Proto API hasn't changed and libmultiprocess does not rely on newer features.
1 parent c4cb758 commit 8ceeaa6

File tree

5 files changed

+64
-2
lines changed

5 files changed

+64
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
config: [default, llvm, gnu32, sanitize]
14+
config: [default, llvm, gnu32, sanitize, olddeps]
1515

1616
name: build • ${{ matrix.config }}
1717

ci/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ CI_CONFIG=ci/configs/default.bash ci/scripts/run.sh
2020
CI_CONFIG=ci/configs/llvm.bash ci/scripts/run.sh
2121
CI_CONFIG=ci/configs/gnu32.bash ci/scripts/run.sh
2222
CI_CONFIG=ci/configs/sanitize.bash ci/scripts/run.sh
23+
CI_CONFIG=ci/configs/olddeps.bash ci/scripts/run.sh
2324
```
2425

2526
By default CI jobs will reuse their build directories. `CI_CLEAN=1` can be specified to delete them before running instead.

ci/configs/olddeps.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CI_DESC="CI job using old Cap'n Proto version"
2+
CI_DIR=build-olddeps
3+
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-error=array-bounds"
4+
NIX_ARGS=(--argstr capnprotoVersion "0.7.1")
5+
BUILD_ARGS=(-k)

ci/patches/spaceship.patch

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
commit e3da7da967b94f373c29a198ce45f30fb9f0e517
2+
Author: Ed Catmur <[email protected]>
3+
Date: Tue Jan 31 16:27:04 2023 +0000
4+
5+
Remove operator!= synthesized by spaceship
6+
7+
An operator!= suppresses the reversed equality comparison candidate generation.
8+
9+
This is visible in clang 16 (rc0 just released) and in gcc trunk (so probably gcc 13).
10+
11+
diff --git a/c++/src/kj/string.h b/c++/src/kj/string.h
12+
index 193442aa..17835892 100644
13+
--- a/c++/src/kj/string.h
14+
+++ b/c++/src/kj/string.h
15+
@@ -122,10 +122,14 @@ public:
16+
inline constexpr const char* end() const { return content.end() - 1; }
17+
18+
inline constexpr bool operator==(decltype(nullptr)) const { return content.size() <= 1; }
19+
+#if !__cpp_impl_three_way_comparison
20+
inline constexpr bool operator!=(decltype(nullptr)) const { return content.size() > 1; }
21+
+#endif
22+
23+
inline bool operator==(const StringPtr& other) const;
24+
+#if !__cpp_impl_three_way_comparison
25+
inline bool operator!=(const StringPtr& other) const { return !(*this == other); }
26+
+#endif
27+
inline bool operator< (const StringPtr& other) const;
28+
inline bool operator> (const StringPtr& other) const { return other < *this; }
29+
inline bool operator<=(const StringPtr& other) const { return !(other < *this); }

shell.nix

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,39 @@
22
, crossPkgs ? import <nixpkgs> {}
33
, enableLibcxx ? false # Whether to use libc++ toolchain and libraries instead of libstdc++
44
, minimal ? false # Whether to create minimal shell without extra tools (faster when cross compiling)
5+
, capnprotoVersion ? null
56
}:
67

78
let
89
lib = pkgs.lib;
910
llvm = crossPkgs.llvmPackages_20;
10-
capnproto = crossPkgs.capnproto.override (lib.optionalAttrs enableLibcxx { clangStdenv = llvm.libcxxStdenv; });
11+
capnprotoHashes = {
12+
"0.7.0" = "sha256-Y/7dUOQPDHjniuKNRw3j8dG1NI9f/aRWpf8V0WzV9k8=";
13+
"0.7.1" = "sha256-3cBpVmpvCXyqPUXDp12vCFCk32ZXWpkdOliNH37UwWE=";
14+
"0.8.0" = "sha256-rfiqN83begjJ9eYjtr21/tk1GJBjmeVfa3C3dZBJ93w=";
15+
"0.8.1" = "sha256-OZqNVYdyszro5rIe+w6YN00g6y8U/1b8dKYc214q/2o=";
16+
"0.9.0" = "sha256-yhbDcWUe6jp5PbIXzn5EoKabXiWN8lnS08hyfxUgEQ0=";
17+
"0.9.2" = "sha256-BspWOPZcP5nCTvmsDE62Zutox+aY5pw42d6hpH3v4cM=";
18+
"0.10.0" = "sha256-++F4l54OMTDnJ+FO3kV/Y/VLobKVRk461dopanuU3IQ=";
19+
"0.10.4" = "sha256-45sxnVyyYIw9i3sbFZ1naBMoUzkpP21WarzR5crg4X8=";
20+
"1.0.0" = "sha256-NLTFJdeOzqhk4ATvkc17Sh6g/junzqYBBEoXYGH/czo=";
21+
"1.0.2" = "sha256-LVdkqVBTeh8JZ1McdVNtRcnFVwEJRNjt0JV2l7RkuO8=";
22+
"1.1.0" = "sha256-gxkko7LFyJNlxpTS+CWOd/p9x/778/kNIXfpDGiKM2A=";
23+
"1.2.0" = "sha256-aDcn4bLZGq8915/NPPQsN5Jv8FRWd8cAspkG3078psc=";
24+
};
25+
capnprotoBase = if capnprotoVersion == null then crossPkgs.capnproto else crossPkgs.capnproto.overrideAttrs (old: {
26+
version = capnprotoVersion;
27+
src = crossPkgs.fetchFromGitHub {
28+
owner = "capnproto";
29+
repo = "capnproto";
30+
rev = "v${capnprotoVersion}";
31+
hash = lib.attrByPath [capnprotoVersion] "" capnprotoHashes;
32+
};
33+
patches = lib.optionals (lib.versionAtLeast capnprotoVersion "0.9.0" && lib.versionOlder capnprotoVersion "0.10.4") [ ./ci/patches/spaceship.patch ];
34+
} // (lib.optionalAttrs (lib.versionOlder capnprotoVersion "0.10") {
35+
env = { }; # Drop -std=c++20 flag forced by nixpkgs
36+
}));
37+
capnproto = capnprotoBase.override (lib.optionalAttrs enableLibcxx { clangStdenv = llvm.libcxxStdenv; });
1138
clang = if enableLibcxx then llvm.libcxxClang else llvm.clang;
1239
clang-tools = llvm.clang-tools.override { inherit enableLibcxx; };
1340
in crossPkgs.mkShell {

0 commit comments

Comments
 (0)