Skip to content

Commit

Permalink
checks: move all tests to the test flake
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetkov committed Feb 8, 2025
1 parent c7e015a commit 86b5b5e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 1 addition & 25 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
38 changes: 35 additions & 3 deletions test/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]);
};
});
}

0 comments on commit 86b5b5e

Please sign in to comment.