Unverified Commit 8a1110b5 authored by Silvan Mosberger's avatar Silvan Mosberger Committed by GitHub
Browse files

Merge pull request #297901 from tweag/check-by-name-separate-repo

Switch the `pkgs/by-name` check to a separate repository
parents fd84c1ff f7ea336c
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
# Checks pkgs/by-name (see pkgs/by-name/README.md)
# using the nixpkgs-check-by-name tool (see pkgs/test/nixpkgs-check-by-name)
# using the nixpkgs-check-by-name tool (see https://github.com/NixOS/nixpkgs-check-by-name)
#
# When you make changes to this workflow, also update pkgs/test/nixpkgs-check-by-name/scripts/run-local.sh adequately
# When you make changes to this workflow, also update pkgs/test/check-by-name/run-local.sh adequately
name: Check pkgs/by-name

# The tool is pinned to a pre-built version on Hydra,
# see pkgs/test/nixpkgs-check-by-name/scripts/README.md
on:
  # Using pull_request_target instead of pull_request avoids having to approve first time contributors
  pull_request_target:
@@ -24,8 +22,7 @@ permissions:

jobs:
  check:
    # This is x86_64-linux, for which the tool is always prebuilt on the nixos-* channels,
    # as specified in nixos/release-combined.nix
    # This needs to be x86_64-linux, because we depend on the tooling being pre-built in the GitHub releases
    runs-on: ubuntu-latest
    # This should take 1 minute at most, but let's be generous.
    # The default of 6 hours is definitely too long
@@ -100,11 +97,14 @@ jobs:
          echo "base=$base" >> "$GITHUB_ENV"
      - uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
      - name: Fetching the pinned tool
        # Update the pinned version using pkgs/test/nixpkgs-check-by-name/scripts/update-pinned-tool.sh
        # Update the pinned version using pkgs/test/check-by-name/update-pinned-tool.sh
        run: |
          # Get the direct /nix/store path from the pin to avoid having to evaluate Nixpkgs
          toolPath=$(jq -r '."ci-path"' pkgs/test/nixpkgs-check-by-name/scripts/pinned-tool.json)
          # This asks the substituter for the path, which should be there because Hydra will have pre-built and pushed it
          # The pinned version of the tooling to use
          toolVersion=$(<pkgs/test/check-by-name/pinned-version.txt)
          # Fetch the x86_64-linux-specific release artifact containing the Gzipped NAR of the pre-built tool
          toolPath=$(curl -sSfL https://github.com/NixOS/nixpkgs-check-by-name/releases/download/"$toolVersion"/x86_64-linux.nar.gz \
            | gzip -cd | nix-store --import | tail -1)
          # Adds a result symlink as a GC root
          nix-store --realise "$toolPath" --add-root result
      - name: Running nixpkgs-check-by-name
        run: |
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ What follows is a (very incomplete) overview of available scripts.

### `check-by-name.sh`

An alias for `pkgs/test/nixpkgs-check-by-name/scripts/run-local.sh`, see [documentation](../../pkgs/test/nixpkgs-check-by-name/scripts/README.md).
An alias for `pkgs/test/check-by-name/run-local.sh`, see [documentation](../../pkgs/test/check-by-name/README.md).

### `get-maintainer.sh`

+1 −1
Original line number Diff line number Diff line
../../pkgs/test/nixpkgs-check-by-name/scripts/run-local.sh
 No newline at end of file
../../pkgs/test/check-by-name/run-local.sh
 No newline at end of file
+0 −5
Original line number Diff line number Diff line
@@ -169,11 +169,6 @@ in rec {
        (onFullSupported "nixpkgs.jdk")
        (onSystems ["x86_64-linux"] "nixpkgs.mesa_i686") # i686 sanity check + useful
        ["nixpkgs.tarball"]

        # Ensure that nixpkgs-check-by-name is available in nixos-unstable,
        # so that a pre-built version can be used in CI for PR's
        # See ../pkgs/test/nixpkgs-check-by-name/README.md
        (onSystems ["x86_64-linux"] "nixpkgs.tests.nixpkgs-check-by-name")
      ];
    };
}
+3 −3
Original line number Diff line number Diff line
@@ -108,13 +108,13 @@ There's some limitations as to which packages can be defined using this structur

## Validation

CI performs [certain checks](../test/nixpkgs-check-by-name/README.md#validity-checks) on the `pkgs/by-name` structure.
This is done using the [`nixpkgs-check-by-name` tool](../test/nixpkgs-check-by-name).
CI performs [certain checks](https://github.com/NixOS/nixpkgs-check-by-name?tab=readme-ov-file#validity-checks) on the `pkgs/by-name` structure.
This is done using the [`nixpkgs-check-by-name` tool](https://github.com/NixOS/nixpkgs-check-by-name).

You can locally emulate the CI check using

```
$ ./pkgs/test/nixpkgs-check-by-name/scripts/run-local.sh master
$ ./maintainers/scripts/check-by-name.sh master
```

See [here](../../.github/workflows/check-by-name.yml) for more info.
Loading