Skip to content

Commit

Permalink
ci: only build uncached derivations
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetkov committed Oct 15, 2023
1 parent ce0a13f commit eac1d16
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
name: crane
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: flake checks
run: nix flake check --accept-flake-config --keep-going --print-build-logs ${{ matrix.nixpkgs-override }}
run: nix develop .# --command ./ci/fast-flake-check.sh ${{ matrix.nixpkgs-override }} -- --keep-going
- name: extra tests
run: nix develop --accept-flake-config ${{ matrix.nixpkgs-override }} --command ./extra-tests/test.sh

Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
for f in $(find examples -maxdepth 1 -mindepth 1 -type d ${{ matrix.filter }}); do
pushd "${f}"
echo "validating ${f}"
nix flake check --accept-flake-config --print-build-logs --override-input crane ../.. ${{ matrix.nixpkgs-override }}
nix develop .# --command ./ci/fast-flake-check.sh --override-input crane ../.. ${{ matrix.nixpkgs-override }} -- --keep-going
popd
done
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/examples/*/flake.lock
gcroot
result*
target/
/extra-tests/*/flake.lock
22 changes: 22 additions & 0 deletions ci/fast-flake-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
curSystem=$(nix eval --raw --impure --expr builtins.currentSystem)

nixEvalJobsArgs=()
while [[ $# -ge 0 ]]; do
arg="$1"
shift 1

if [[ "${arg}" == '--' ]]; then
break
fi

nixEvalJobsArgs+=("$arg")
done

nix-eval-jobs \
--gc-roots-dir gcroot \
--check-cache-status \
--flake ".#checks.${curSystem}" \
"${nixEvalJobsArgs[@]}" \
| jq -r 'select(.isCached | not).drvPath as $drvPath | "\($drvPath)^*"' \
| xargs --no-run-if-empty nix build --no-link --print-build-logs "$@"
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
nativeBuildInputs = with pkgs; [
jq
mdbook
nix-eval-jobs
nixpkgs-fmt
];
};
Expand Down

0 comments on commit eac1d16

Please sign in to comment.