Try to replicate as closely as possible the CI setup

So that the hashes match
This commit is contained in:
regnat 2021-09-22 10:23:00 +02:00
parent ec42ef03a5
commit 274a7be8d5
2 changed files with 12 additions and 18 deletions

View File

@ -22,11 +22,9 @@ jobs:
name: '${{ env.CACHIX_NAME }}'
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: cachix use nixos-nix-install-tests
- run: nix-build -A checks.$(nix-instantiate --eval -E '(builtins.currentSystem)')
- run: |
cachix use nixos-nix-install-tests
CURRENT_NIX_BUILD=$(nix-build -A defaultPackage.$(nix-instantiate --eval -E '(builtins.currentSystem)'))/bin
PATH=$CURRENT_NIX_BUILD:$PATH GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} bash scripts/test-against-master.sh
- run: bash scripts/test-against-master.sh
check_cachix:
name: Cachix secret present for installer tests
runs-on: ubuntu-latest

View File

@ -6,7 +6,7 @@ set -x;
CurrentNixDir=$(pwd)
CurrentRev=${GITHUB_SHA:-$(git rev-parse HEAD)}
WorkDir=$(mktemp -d)
trap 'rm -r "$WorkDir"' EXIT
trap 'rm -rf "$WorkDir"' EXIT
GITHUB_TOKEN_OPTION=()
if [[ -n "${GITHUB_TOKEN:-}" ]]; then
GITHUB_TOKEN_OPTION=("--option" "access-tokens" "github.com=$GITHUB_TOKEN")
@ -14,20 +14,16 @@ fi
pushd "$WorkDir"
cat <<EOF > flake.nix
{
inputs.currentNix.url = "git+file://$CurrentNixDir?rev=$CurrentRev";
inputs.nixMaster.url = "github:nixos/nix";
git clone "https://github.com/nixos/nix"
outputs = { self, currentNix, nixMaster }: {
checks = builtins.mapAttrs (systemName: _:
{ againstMaster = currentNix.lib.testAgainst.\${systemName} nixMaster.defaultPackage.\${systemName}; }
) currentNix.defaultPackage;
};
}
cat <<EOF > default.nix
let
currentNix = import $CurrentNixDir;
masterNix = import ./nix;
in
currentNix.lib.testAgainst.\${builtins.currentSystem} masterNix.defaultPackage.\${builtins.currentSystem}
EOF
nix flake check\
--experimental-features 'nix-command flakes' \
"${GITHUB_TOKEN_OPTION[@]}"
nix-build "${GITHUB_TOKEN_OPTION[@]}"
popd