Skip to content

Commit d2a0a11

Browse files
authored
Merge pull request #14184 from lovesegfault/nix-better-ci
ci: integrate vm_tests into main tests job
2 parents fc8b784 + a400ea4 commit d2a0a11

File tree

3 files changed

+38
-82
lines changed

3 files changed

+38
-82
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ jobs:
126126
--argstr stdenv "${{ matrix.stdenv }}" \
127127
${{ format('--arg withAWS {0}', matrix.withAWS) }} \
128128
${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }}
129+
- name: Run VM tests
130+
run: |
131+
nix build --file ci/gha/tests/wrapper.nix vmTests -L \
132+
--arg withInstrumentation ${{ matrix.instrumented }} \
133+
--argstr stdenv "${{ matrix.stdenv }}" \
134+
${{ format('--arg withAWS {0}', matrix.withAWS) }} \
135+
${{ format('--arg withCurlS3 {0}', matrix.withCurlS3) }}
136+
if: ${{ matrix.os == 'linux' }}
129137
- name: Run flake checks and prepare the installer tarball
130138
run: |
131139
ci/gha/tests/build-checks
@@ -213,7 +221,7 @@ jobs:
213221
echo "docker=${{ env._DOCKER_SECRETS != '' }}" >> $GITHUB_OUTPUT
214222
215223
docker_push_image:
216-
needs: [tests, vm_tests, check_secrets]
224+
needs: [tests, check_secrets]
217225
permissions:
218226
contents: read
219227
packages: write
@@ -266,43 +274,8 @@ jobs:
266274
docker tag nix:$NIX_VERSION $IMAGE_ID:master
267275
docker push $IMAGE_ID:master
268276
269-
vm_tests:
270-
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 }})
283-
runs-on: ubuntu-24.04
284-
steps:
285-
- uses: actions/checkout@v5
286-
- uses: ./.github/actions/install-nix-action
287-
with:
288-
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
289-
extra_nix_config:
290-
experimental-features = nix-command flakes
291-
github_token: ${{ secrets.GITHUB_TOKEN }}
292-
- uses: DeterminateSystems/magic-nix-cache-action@main
293-
- name: Build VM tests
294-
run: |
295-
nix build -L \
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
303-
304277
flake_regressions:
305-
needs: vm_tests
278+
needs: tests
306279
runs-on: ubuntu-24.04
307280
steps:
308281
- name: Checkout nix

ci/gha/tests/default.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ rec {
7979
}
8080
);
8181

82+
# Import NixOS tests using the instrumented components
83+
nixosTests = import ../../../tests/nixos {
84+
inherit lib pkgs;
85+
nixComponents = nixComponentsInstrumented;
86+
nixpkgs = nixFlake.inputs.nixpkgs;
87+
inherit (nixFlake.inputs) nixpkgs-23-11;
88+
};
89+
8290
/**
8391
Top-level tests for the flake outputs, as they would be built by hydra.
8492
These tests generally can't be overridden to run with sanitizers.
@@ -229,4 +237,24 @@ rec {
229237
{
230238
inherit coverageProfileDrvs mergedProfdata coverageReports;
231239
};
240+
241+
vmTests = {
242+
}
243+
# FIXME: when the curlS3 implementation is complete, it should also enable these tests.
244+
// lib.optionalAttrs (withAWS == true) {
245+
# S3 binary cache store test only runs when S3 support is enabled
246+
inherit (nixosTests) s3-binary-cache-store;
247+
}
248+
// lib.optionalAttrs (!withSanitizers && !withCoverage) {
249+
# evalNixpkgs uses non-instrumented components from hydraJobs, so only run it
250+
# when not testing with sanitizers to avoid rebuilding nix
251+
inherit (hydraJobs.tests) evalNixpkgs;
252+
# FIXME: CI times out when building vm tests instrumented
253+
inherit (nixosTests)
254+
functional_user
255+
githubFlakes
256+
nix-docker
257+
tarballFlakes
258+
;
259+
};
232260
}

ci/gha/vm-tests/wrapper.nix

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)