1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 12:06:01 +01:00

ci: test without s3 and with curl-based-s3

This commit is contained in:
Bernardo Meurer Costa 2025-10-03 15:48:24 +00:00
parent 7f22a40e3b
commit 8c28283876
No known key found for this signature in database
4 changed files with 106 additions and 7 deletions

View file

@ -65,18 +65,42 @@ jobs:
instrumented: false instrumented: false
primary: true primary: true
stdenv: stdenv stdenv: stdenv
withAWS: true
withCurlS3: false
# TODO: remove once curl-based-s3 fully lands
- scenario: on ubuntu (no s3)
runs-on: ubuntu-24.04
os: linux
instrumented: false
primary: false
stdenv: stdenv
withAWS: false
withCurlS3: false
# TODO: remove once curl-based-s3 fully lands
- scenario: on ubuntu (curl s3)
runs-on: ubuntu-24.04
os: linux
instrumented: false
primary: false
stdenv: stdenv
withAWS: false
withCurlS3: true
- scenario: on macos - scenario: on macos
runs-on: macos-14 runs-on: macos-14
os: darwin os: darwin
instrumented: false instrumented: false
primary: true primary: true
stdenv: stdenv stdenv: stdenv
withAWS: true
withCurlS3: false
- scenario: on ubuntu (with sanitizers / coverage) - scenario: on ubuntu (with sanitizers / coverage)
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
os: linux os: linux
instrumented: true instrumented: true
primary: false primary: false
stdenv: clangStdenv stdenv: clangStdenv
withAWS: true
withCurlS3: false
name: tests ${{ matrix.scenario }} name: tests ${{ matrix.scenario }}
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
timeout-minutes: 60 timeout-minutes: 60
@ -99,7 +123,9 @@ jobs:
run: | run: |
nix build --file ci/gha/tests/wrapper.nix componentTests -L \ nix build --file ci/gha/tests/wrapper.nix componentTests -L \
--arg withInstrumentation ${{ matrix.instrumented }} \ --arg withInstrumentation ${{ matrix.instrumented }} \
--argstr stdenv "${{ matrix.stdenv }}" --argstr stdenv "${{ matrix.stdenv }}" \
${{ format('--arg withAWS {0}', matrix.withAWS) }} \
${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }}
- name: Run flake checks and prepare the installer tarball - name: Run flake checks and prepare the installer tarball
run: | run: |
ci/gha/tests/build-checks ci/gha/tests/build-checks
@ -110,6 +136,8 @@ jobs:
nix build --file ci/gha/tests/wrapper.nix codeCoverage.coverageReports -L \ nix build --file ci/gha/tests/wrapper.nix codeCoverage.coverageReports -L \
--arg withInstrumentation ${{ matrix.instrumented }} \ --arg withInstrumentation ${{ matrix.instrumented }} \
--argstr stdenv "${{ matrix.stdenv }}" \ --argstr stdenv "${{ matrix.stdenv }}" \
${{ format('--arg withAWS {0}', matrix.withAWS) }} \
${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }} \
--out-link coverage-reports --out-link coverage-reports
cat coverage-reports/index.txt >> $GITHUB_STEP_SUMMARY cat coverage-reports/index.txt >> $GITHUB_STEP_SUMMARY
if: ${{ matrix.instrumented }} if: ${{ matrix.instrumented }}
@ -240,6 +268,18 @@ jobs:
vm_tests: vm_tests:
needs: basic-checks needs: basic-checks
strategy:
fail-fast: false
matrix:
include:
# TODO: remove once curl-based-s3 fully lands
- scenario: legacy s3
withAWS: true
withCurlS3: false
- scenario: curl s3
withAWS: false
withCurlS3: true
name: vm_tests (${{ matrix.scenario }})
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
@ -250,13 +290,16 @@ jobs:
experimental-features = nix-command flakes experimental-features = nix-command flakes
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
- run: | - name: Build VM tests
run: |
nix build -L \ nix build -L \
.#hydraJobs.tests.functional_user \ --file ci/gha/vm-tests/wrapper.nix \
.#hydraJobs.tests.githubFlakes \ ${{ format('--arg withAWS {0}', matrix.withAWS) }} \
.#hydraJobs.tests.nix-docker \ ${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }} \
.#hydraJobs.tests.tarballFlakes \ functional_user \
; githubFlakes \
nix-docker \
tarballFlakes
flake_regressions: flake_regressions:
needs: vm_tests needs: vm_tests

View file

@ -12,6 +12,8 @@
componentTestsPrefix ? "", componentTestsPrefix ? "",
withSanitizers ? false, withSanitizers ? false,
withCoverage ? false, withCoverage ? false,
withAWS ? null,
withCurlS3 ? null,
... ...
}: }:
@ -65,6 +67,12 @@ rec {
# Boehm is incompatible with ASAN. # Boehm is incompatible with ASAN.
nix-expr = prev.nix-expr.override { enableGC = !withSanitizers; }; nix-expr = prev.nix-expr.override { enableGC = !withSanitizers; };
# Override AWS configuration if specified
nix-store = prev.nix-store.override (
lib.optionalAttrs (withAWS != null) { inherit withAWS; }
// lib.optionalAttrs (withCurlS3 != null) { inherit withCurlS3; }
);
mesonComponentOverrides = lib.composeManyExtensions componentOverrides; mesonComponentOverrides = lib.composeManyExtensions componentOverrides;
# Unclear how to make Perl bindings work with a dynamically linked ASAN. # Unclear how to make Perl bindings work with a dynamically linked ASAN.
nix-perl-bindings = if withSanitizers then null else prev.nix-perl-bindings; nix-perl-bindings = if withSanitizers then null else prev.nix-perl-bindings;

View file

@ -5,6 +5,8 @@
stdenv ? "stdenv", stdenv ? "stdenv",
componentTestsPrefix ? "", componentTestsPrefix ? "",
withInstrumentation ? false, withInstrumentation ? false,
withAWS ? null,
withCurlS3 ? null,
}@args: }@args:
import ./. ( import ./. (
args args
@ -12,5 +14,6 @@ import ./. (
getStdenv = p: p.${stdenv}; getStdenv = p: p.${stdenv};
withSanitizers = withInstrumentation; withSanitizers = withInstrumentation;
withCoverage = withInstrumentation; withCoverage = withInstrumentation;
inherit withAWS withCurlS3;
} }
) )

View file

@ -0,0 +1,45 @@
{
nixFlake ? builtins.getFlake ("git+file://" + toString ../../..),
system ? "x86_64-linux",
withAWS ? null,
withCurlS3 ? null,
}:
let
pkgs = nixFlake.inputs.nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
# Create base nixComponents using the flake's makeComponents
baseNixComponents = nixFlake.lib.makeComponents {
inherit pkgs;
};
# Override nixComponents if AWS parameters are specified
nixComponents =
if (withAWS == null && withCurlS3 == null) then
baseNixComponents
else
baseNixComponents.overrideScope (
final: prev: {
nix-store = prev.nix-store.override (
lib.optionalAttrs (withAWS != null) { inherit withAWS; }
// lib.optionalAttrs (withCurlS3 != null) { inherit withCurlS3; }
);
}
);
# Import NixOS tests with the overridden nixComponents
tests = import ../../../tests/nixos {
inherit lib pkgs nixComponents;
nixpkgs = nixFlake.inputs.nixpkgs;
inherit (nixFlake.inputs) nixpkgs-23-11;
};
in
{
inherit (tests)
functional_user
githubFlakes
nix-docker
tarballFlakes
;
}