lol

ci: allow running jobs locally (#404466)

authored by

Jörg Thalheim and committed by
GitHub
7fd771ee 88f1d5cf

+64 -25
+1 -1
.github/workflows/check-shell.yml
··· 30 30 - uses: cachix/install-nix-action@526118121621777ccd86f79b04685a9319637641 # v31 31 31 32 32 - name: Build shell 33 - run: nix-build shell.nix 33 + run: nix-build ci -A shell
+1 -1
.github/workflows/eval-lib-tests.yml .github/workflows/lib-tests.yml
··· 28 28 29 29 - name: Building Nixpkgs lib-tests 30 30 run: | 31 - nix-build --arg pkgs "(import ./ci/. {}).pkgs" ./lib/tests/release.nix 31 + nix-build ci -A lib-tests
+1 -1
.github/workflows/manual-nixos-v2.yml
··· 46 46 47 47 - name: Build NixOS manual 48 48 id: build-manual 49 - run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true nixos/release.nix -A manual.${{ matrix.system }} 49 + run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true ci -A manual --argstr system ${{ matrix.system }} 50 50 51 51 - name: Upload NixOS manual 52 52 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+1 -1
.github/workflows/manual-nixpkgs-v2.yml
··· 32 32 authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 33 33 34 34 - name: Building Nixpkgs manual 35 - run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true pkgs/top-level/release.nix -A manual -A manual.tests 35 + run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true ci -A manual-nixpkgs -A manual-nixpkgs-tests
+3 -19
.github/workflows/nix-parse-v2.yml
··· 15 15 needs: get-merge-commit 16 16 if: "needs.get-merge-commit.outputs.mergedSha && !contains(github.event.pull_request.title, '[skip treewide]')" 17 17 steps: 18 - - name: Get list of changed files from PR 19 - env: 20 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 21 - run: | 22 - gh api \ 23 - repos/${{ github.repository }}/pulls/${{github.event.number}}/files --paginate \ 24 - | jq --raw-output '.[] | select(.status != "removed" and (.filename | endswith(".nix"))) | .filename' \ 25 - > "$HOME/changed_files" 26 - if [[ -s "$HOME/changed_files" ]]; then 27 - echo "CHANGED_FILES=$HOME/changed_files" > "$GITHUB_ENV" 28 - fi 29 - 30 18 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 31 19 with: 32 20 ref: ${{ needs.get-merge-commit.outputs.mergedSha }} ··· 37 25 extra_nix_config: sandbox = true 38 26 nix_path: nixpkgs=channel:nixpkgs-unstable 39 27 40 - - name: Parse all changed or added nix files 28 + - name: Parse all nix files 41 29 run: | 42 - ret=0 43 - while IFS= read -r file; do 44 - out="$(nix-instantiate --parse "$file")" || { echo "$out" && ret=1; } 45 - done < "$HOME/changed_files" 46 - exit "$ret" 47 - if: ${{ env.CHANGED_FILES && env.CHANGED_FILES != '' }} 30 + # Tests multiple versions at once, let's make sure all of them run, so keep-going. 31 + nix-build ci -A parse --keep-going
+12
ci/default.nix
··· 79 79 requestReviews = pkgs.callPackage ./request-reviews { }; 80 80 codeownersValidator = pkgs.callPackage ./codeowners-validator { }; 81 81 eval = pkgs.callPackage ./eval { }; 82 + 83 + # CI jobs 84 + lib-tests = import ../lib/tests/release.nix { inherit pkgs; }; 85 + manual-nixos = (import ../nixos/release.nix { }).manual.${system} or null; 86 + manual-nixpkgs = (import ../pkgs/top-level/release.nix { }).manual; 87 + manual-nixpkgs-tests = (import ../pkgs/top-level/release.nix { }).manual.tests; 88 + parse = pkgs.lib.recurseIntoAttrs { 89 + latest = pkgs.callPackage ./parse.nix { nix = pkgs.nixVersions.latest; }; 90 + lix = pkgs.callPackage ./parse.nix { nix = pkgs.lix; }; 91 + minimum = pkgs.callPackage ./parse.nix { nix = pkgs.nixVersions.minimum; }; 92 + }; 93 + shell = import ../shell.nix { inherit nixpkgs system; }; 82 94 }
+43
ci/parse.nix
··· 1 + { 2 + lib, 3 + nix, 4 + runCommand, 5 + }: 6 + let 7 + nixpkgs = 8 + with lib.fileset; 9 + toSource { 10 + root = ../.; 11 + fileset = (fileFilter (file: file.hasExt "nix") ../.); 12 + }; 13 + in 14 + runCommand "nix-parse-${nix.name}" 15 + { 16 + nativeBuildInputs = [ 17 + nix 18 + ]; 19 + } 20 + '' 21 + export NIX_STORE_DIR=$TMPDIR/store 22 + export NIX_STATE_DIR=$TMPDIR/state 23 + 24 + cd "${nixpkgs}" 25 + 26 + # Passes all files to nix-instantiate at once. 27 + # Much faster, but will only show first error. 28 + parse-all() { 29 + find . -type f -iname '*.nix' | xargs -P $(nproc) nix-instantiate --parse >/dev/null 2>/dev/null 30 + } 31 + 32 + # Passes each file separately to nix-instantiate with -n1. 33 + # Much slower, but will show all errors. 34 + parse-each() { 35 + find . -type f -iname '*.nix' | xargs -n1 -P $(nproc) nix-instantiate --parse >/dev/null 36 + } 37 + 38 + if ! parse-all; then 39 + parse-each 40 + fi 41 + 42 + touch $out 43 + ''
+1 -1
nixos/tests/scion/freestanding-deployment/default.nix
··· 23 23 networkConfig.Address = "192.168.1.${toString hostId}/24"; 24 24 }; 25 25 environment.etc = { 26 - "scion/topology.json".source = ./topology${toString hostId}.json; 26 + "scion/topology.json".source = ./topology + "${toString hostId}.json"; 27 27 "scion/crypto/as".source = trust-root-configuration-keys + "/AS${toString hostId}"; 28 28 "scion/certs/ISD42-B1-S1.trc".source = trust-root-configuration-keys + "/ISD42-B1-S1.trc"; 29 29 "scion/keys/master0.key".text = "U${toString hostId}v4k23ZXjGDwDofg/Eevw==";
+1 -1
pkgs/test/make-binary-wrapper/default.nix
··· 20 20 runCommand "make-binary-wrapper-test-${testname}" env '' 21 21 mkdir -p tmp/foo # for the chdir test 22 22 23 - source=${./${testname}} 23 + source=${./. + "/${testname}"} 24 24 25 25 params=$(<"$source/${testname}.cmdline") 26 26 eval "makeCWrapper /send/me/flags $params" > wrapper.c