Skip to content

Commit fc8b784

Browse files
authored
Merge pull request #14147 from lovesegfault/nix-multi-ci
ci: test without s3 and with curl-based-s3
2 parents fb117e0 + 8c28283 commit fc8b784

File tree

5 files changed

+109
-7
lines changed

5 files changed

+109
-7
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,42 @@ jobs:
6565
instrumented: false
6666
primary: true
6767
stdenv: stdenv
68+
withAWS: true
69+
withCurlS3: false
70+
# TODO: remove once curl-based-s3 fully lands
71+
- scenario: on ubuntu (no s3)
72+
runs-on: ubuntu-24.04
73+
os: linux
74+
instrumented: false
75+
primary: false
76+
stdenv: stdenv
77+
withAWS: false
78+
withCurlS3: false
79+
# TODO: remove once curl-based-s3 fully lands
80+
- scenario: on ubuntu (curl s3)
81+
runs-on: ubuntu-24.04
82+
os: linux
83+
instrumented: false
84+
primary: false
85+
stdenv: stdenv
86+
withAWS: false
87+
withCurlS3: true
6888
- scenario: on macos
6989
runs-on: macos-14
7090
os: darwin
7191
instrumented: false
7292
primary: true
7393
stdenv: stdenv
94+
withAWS: true
95+
withCurlS3: false
7496
- scenario: on ubuntu (with sanitizers / coverage)
7597
runs-on: ubuntu-24.04
7698
os: linux
7799
instrumented: true
78100
primary: false
79101
stdenv: clangStdenv
102+
withAWS: true
103+
withCurlS3: false
80104
name: tests ${{ matrix.scenario }}
81105
runs-on: ${{ matrix.runs-on }}
82106
timeout-minutes: 60
@@ -99,7 +123,9 @@ jobs:
99123
run: |
100124
nix build --file ci/gha/tests/wrapper.nix componentTests -L \
101125
--arg withInstrumentation ${{ matrix.instrumented }} \
102-
--argstr stdenv "${{ matrix.stdenv }}"
126+
--argstr stdenv "${{ matrix.stdenv }}" \
127+
${{ format('--arg withAWS {0}', matrix.withAWS) }} \
128+
${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }}
103129
- name: Run flake checks and prepare the installer tarball
104130
run: |
105131
ci/gha/tests/build-checks
@@ -110,6 +136,8 @@ jobs:
110136
nix build --file ci/gha/tests/wrapper.nix codeCoverage.coverageReports -L \
111137
--arg withInstrumentation ${{ matrix.instrumented }} \
112138
--argstr stdenv "${{ matrix.stdenv }}" \
139+
${{ format('--arg withAWS {0}', matrix.withAWS) }} \
140+
${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }} \
113141
--out-link coverage-reports
114142
cat coverage-reports/index.txt >> $GITHUB_STEP_SUMMARY
115143
if: ${{ matrix.instrumented }}
@@ -240,6 +268,18 @@ jobs:
240268
241269
vm_tests:
242270
needs: basic-checks
271+
strategy:
272+
fail-fast: false
273+
matrix:
274+
include:
275+
# TODO: remove once curl-based-s3 fully lands
276+
- scenario: legacy s3
277+
withAWS: true
278+
withCurlS3: false
279+
- scenario: curl s3
280+
withAWS: false
281+
withCurlS3: true
282+
name: vm_tests (${{ matrix.scenario }})
243283
runs-on: ubuntu-24.04
244284
steps:
245285
- uses: actions/checkout@v5
@@ -250,13 +290,16 @@ jobs:
250290
experimental-features = nix-command flakes
251291
github_token: ${{ secrets.GITHUB_TOKEN }}
252292
- uses: DeterminateSystems/magic-nix-cache-action@main
253-
- run: |
293+
- name: Build VM tests
294+
run: |
254295
nix build -L \
255-
.#hydraJobs.tests.functional_user \
256-
.#hydraJobs.tests.githubFlakes \
257-
.#hydraJobs.tests.nix-docker \
258-
.#hydraJobs.tests.tarballFlakes \
259-
;
296+
--file ci/gha/vm-tests/wrapper.nix \
297+
${{ format('--arg withAWS {0}', matrix.withAWS) }} \
298+
${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }} \
299+
functional_user \
300+
githubFlakes \
301+
nix-docker \
302+
tarballFlakes
260303
261304
flake_regressions:
262305
needs: vm_tests

ci/gha/tests/default.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
componentTestsPrefix ? "",
1313
withSanitizers ? false,
1414
withCoverage ? false,
15+
withAWS ? null,
16+
withCurlS3 ? null,
1517
...
1618
}:
1719

@@ -65,6 +67,12 @@ rec {
6567
# Boehm is incompatible with ASAN.
6668
nix-expr = prev.nix-expr.override { enableGC = !withSanitizers; };
6769

70+
# Override AWS configuration if specified
71+
nix-store = prev.nix-store.override (
72+
lib.optionalAttrs (withAWS != null) { inherit withAWS; }
73+
// lib.optionalAttrs (withCurlS3 != null) { inherit withCurlS3; }
74+
);
75+
6876
mesonComponentOverrides = lib.composeManyExtensions componentOverrides;
6977
# Unclear how to make Perl bindings work with a dynamically linked ASAN.
7078
nix-perl-bindings = if withSanitizers then null else prev.nix-perl-bindings;

ci/gha/tests/wrapper.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
stdenv ? "stdenv",
66
componentTestsPrefix ? "",
77
withInstrumentation ? false,
8+
withAWS ? null,
9+
withCurlS3 ? null,
810
}@args:
911
import ./. (
1012
args
1113
// {
1214
getStdenv = p: p.${stdenv};
1315
withSanitizers = withInstrumentation;
1416
withCoverage = withInstrumentation;
17+
inherit withAWS withCurlS3;
1518
}
1619
)

ci/gha/vm-tests/wrapper.nix

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
nixFlake ? builtins.getFlake ("git+file://" + toString ../../..),
3+
system ? "x86_64-linux",
4+
withAWS ? null,
5+
withCurlS3 ? null,
6+
}:
7+
8+
let
9+
pkgs = nixFlake.inputs.nixpkgs.legacyPackages.${system};
10+
lib = pkgs.lib;
11+
12+
# Create base nixComponents using the flake's makeComponents
13+
baseNixComponents = nixFlake.lib.makeComponents {
14+
inherit pkgs;
15+
};
16+
17+
# Override nixComponents if AWS parameters are specified
18+
nixComponents =
19+
if (withAWS == null && withCurlS3 == null) then
20+
baseNixComponents
21+
else
22+
baseNixComponents.overrideScope (
23+
final: prev: {
24+
nix-store = prev.nix-store.override (
25+
lib.optionalAttrs (withAWS != null) { inherit withAWS; }
26+
// lib.optionalAttrs (withCurlS3 != null) { inherit withCurlS3; }
27+
);
28+
}
29+
);
30+
31+
# Import NixOS tests with the overridden nixComponents
32+
tests = import ../../../tests/nixos {
33+
inherit lib pkgs nixComponents;
34+
nixpkgs = nixFlake.inputs.nixpkgs;
35+
inherit (nixFlake.inputs) nixpkgs-23-11;
36+
};
37+
in
38+
{
39+
inherit (tests)
40+
functional_user
41+
githubFlakes
42+
nix-docker
43+
tarballFlakes
44+
;
45+
}

src/libstore/package.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ let
3434
inherit (lib) fileset;
3535
in
3636

37+
assert lib.assertMsg (!withAWS || !withCurlS3)
38+
"withAWS and withCurlS3 are mutually exclusive - cannot enable both S3 implementations simultaneously";
39+
3740
mkMesonLibrary (finalAttrs: {
3841
pname = "nix-store";
3942
inherit version;

0 commit comments

Comments
 (0)