From 86b5b5e1e44ab0f119b26d0406ab3dec47d06d6d Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Sat, 8 Feb 2025 11:21:40 -0800 Subject: [PATCH] checks: move all tests to the test flake --- .github/workflows/test.yml | 4 ++-- flake.nix | 26 +------------------------- test.sh | 6 ++++-- test/flake.nix | 38 +++++++++++++++++++++++++++++++++++--- 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c274f2e5..230c85ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,8 +44,8 @@ jobs: with: name: crane authToken: ${{ github.ref == 'refs/heads/master' && secrets.CACHIX_AUTH_TOKEN || '' }} - - name: flake checks - run: nix develop --accept-flake-config --command ./ci/fast-flake-check.sh . ${{ matrix.nixpkgs-override }} + - run: nix develop --accept-flake-config --command ./ci/fast-flake-check.sh .# ${{ matrix.nixpkgs-override }} + - run: nix develop --accept-flake-config --command ./ci/fast-flake-check.sh ./test# ${{ matrix.nixpkgs-override }} - name: extra tests run: nix develop --accept-flake-config --command ./extra-tests/test.sh diff --git a/flake.nix b/flake.nix index 35b6bab0..086cc700 100644 --- a/flake.nix +++ b/flake.nix @@ -127,33 +127,9 @@ }; myLib = mkLib pkgs; - - checks = - let - pkgsChecks = import nixpkgs { - inherit system; - overlays = [ - (import (inputFromLock "rust-overlay")) - ]; - }; - fenix = import (inputFromLock "fenix") { inherit system; }; - in - pkgsChecks.callPackages ./checks { - pkgs = pkgsChecks; - myLib = mkLib pkgsChecks; - myLibCross = mkLib (import nixpkgs { - localSystem = system; - crossSystem = "wasm32-wasi"; - }); - myLibFenix = (mkLib pkgs).overrideToolchain (fenix.latest.withComponents [ - "cargo" - "rust-src" - "rustc" - ]); - }; in { - inherit checks; + checks = { }; packages = import ./pkgs { inherit pkgs myLib; diff --git a/test.sh b/test.sh index d1bfb357..9fc0f4bf 100755 --- a/test.sh +++ b/test.sh @@ -2,17 +2,19 @@ set -euo pipefail gitRoot="$(git rev-parse --show-toplevel)" +cd "${gitRoot}" function flakeCheck() { if which nom >/dev/null 2>&1; then nix flake check --log-format internal-json -v -L "$@" |& nom --json else - nix flake check -L + nix flake check -L "$@" fi } flakeCheck -flakeCheck --override-input nixpkgs "$("${gitRoot}/ci/ref-from-lock.sh" "${gitRoot}/test#nixpkgs-latest-release")" +flakeCheck ./test# +flakeCheck ./test# --override-input nixpkgs "$("${gitRoot}/ci/ref-from-lock.sh" "${gitRoot}/test#nixpkgs-latest-release")" for f in $(find ./examples -maxdepth 1 -mindepth 1 -type d | sort -u); do echo "validating ${f}" diff --git a/test/flake.nix b/test/flake.nix index 7c77a051..f9c47391 100644 --- a/test/flake.nix +++ b/test/flake.nix @@ -29,7 +29,39 @@ }; - outputs = inputs@{ ... }: { - packages.x86_64-linux.deadnix = inputs.deadnix.packages.x86_64-linux.deadnix; - }; + outputs = inputs@{ ... }: inputs.flake-utils.lib.eachDefaultSystem (system: + let + mkLib = pkgs: import ../default.nix { + inherit pkgs; + }; + nixpkgs = inputs.nixpkgs; + pkgs = import nixpkgs { + inherit system; + }; + + pkgsChecks = import nixpkgs { + inherit system; + overlays = [ + (import inputs.rust-overlay) + ]; + }; + fenix = import inputs.fenix { + inherit system; + }; + in + { + checks = pkgsChecks.callPackages ../checks { + pkgs = pkgsChecks; + myLib = mkLib pkgsChecks; + myLibCross = mkLib (import nixpkgs { + localSystem = system; + crossSystem = "wasm32-wasi"; + }); + myLibFenix = (mkLib pkgs).overrideToolchain (fenix.latest.withComponents [ + "cargo" + "rust-src" + "rustc" + ]); + }; + }); }