2023-01-13 19:07:57 +01:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
2023-10-18 17:14:39 +02:00
|
|
|
workflow_dispatch:
|
2023-01-13 19:07:57 +01:00
|
|
|
|
|
|
|
jobs:
|
2024-05-15 23:16:09 +02:00
|
|
|
tests:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
needs:
|
|
|
|
- check-dist-up-to-date
|
|
|
|
- install-nix-linux
|
|
|
|
- install-nix-macos
|
|
|
|
steps:
|
|
|
|
- run: true
|
|
|
|
|
2023-10-23 20:50:08 +02:00
|
|
|
check-dist-up-to-date:
|
|
|
|
name: Check the dist/ folder is up to date
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
2024-04-11 17:58:56 +02:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: DeterminateSystems/nix-installer-action@main
|
|
|
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
2024-05-02 15:56:42 +02:00
|
|
|
- name: pnpm install
|
|
|
|
run: nix develop --command pnpm install
|
|
|
|
- name: prettier format
|
|
|
|
run: nix develop --command pnpm run check-fmt
|
|
|
|
- name: ESLint
|
|
|
|
run: nix develop --command pnpm run lint
|
|
|
|
- name: tsup build
|
|
|
|
run: nix develop --command pnpm run build
|
|
|
|
- name: ncc package
|
|
|
|
run: nix develop --command pnpm run package
|
|
|
|
- name: Git status
|
|
|
|
run: git status --porcelain=v1
|
|
|
|
- name: Ensure no staged changes
|
|
|
|
run: git diff --exit-code
|
2024-05-15 22:39:35 +02:00
|
|
|
|
2024-05-15 23:16:09 +02:00
|
|
|
install-nix-linux:
|
2024-05-15 22:56:08 +02:00
|
|
|
name: Run test suite for Linux systems
|
2023-12-04 20:17:47 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
runner:
|
2024-03-12 00:53:25 +01:00
|
|
|
- ubuntu-latest
|
|
|
|
- nscloud-ubuntu-22.04-amd64-4x16
|
|
|
|
- namespace-profile-default-arm64
|
2023-12-04 20:17:47 +01:00
|
|
|
runs-on: ${{ matrix.runner }}
|
2024-03-12 00:53:25 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
id-token: write
|
2023-01-13 19:07:57 +01:00
|
|
|
steps:
|
2024-05-02 19:10:17 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-13 19:13:23 +01:00
|
|
|
- name: Install Nix
|
2023-01-13 19:07:57 +01:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
logger: pretty
|
|
|
|
log-directives: nix_installer=trace
|
|
|
|
backtrace: full
|
|
|
|
- name: echo $PATH
|
|
|
|
run: echo $PATH
|
2024-03-12 00:53:25 +01:00
|
|
|
|
|
|
|
- name: Render the devshell
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
|
|
|
nix develop --command date
|
|
|
|
|
2023-01-13 19:07:57 +01:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
|
|
|
nix profile install nixpkgs#hello
|
|
|
|
hello
|
2023-01-13 19:07:57 +01:00
|
|
|
nix store gc
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
2024-03-12 00:53:25 +01:00
|
|
|
|
2023-01-13 19:07:57 +01:00
|
|
|
- name: Test bash
|
|
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
|
|
if: success() || failure()
|
|
|
|
shell: bash --login {0}
|
|
|
|
- name: Test sh
|
|
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
|
|
if: success() || failure()
|
|
|
|
shell: sh -l {0}
|
2023-01-13 21:09:36 +01:00
|
|
|
- name: Install Nix again (noop)
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
logger: pretty
|
|
|
|
log-directives: nix_installer=trace
|
|
|
|
backtrace: full
|
2023-01-13 21:18:14 +01:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
|
|
|
nix profile install nixpkgs#hello
|
|
|
|
hello
|
2023-01-13 21:18:14 +01:00
|
|
|
nix store gc
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
2023-01-13 21:09:36 +01:00
|
|
|
- name: Reinstall Nix
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
logger: pretty
|
|
|
|
log-directives: nix_installer=trace
|
|
|
|
backtrace: full
|
2024-05-02 18:54:44 +02:00
|
|
|
reinstall: true
|
2023-01-28 00:10:13 +01:00
|
|
|
extra-conf: |
|
|
|
|
use-sqlite-wal = true
|
2023-01-13 21:18:14 +01:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
|
|
|
nix profile install nixpkgs#hello
|
|
|
|
hello
|
2023-01-13 21:18:14 +01:00
|
|
|
nix store gc
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
2023-01-28 00:10:13 +01:00
|
|
|
- name: Verify the generated nix.conf
|
|
|
|
run: |
|
|
|
|
cat -n /etc/nix/nix.conf
|
|
|
|
grep -E "^trusted-users = .*$USER" /etc/nix/nix.conf
|
2023-01-28 00:10:13 +01:00
|
|
|
grep -E "^use-sqlite-wal = true" /etc/nix/nix.conf
|
2024-04-11 17:58:56 +02:00
|
|
|
- name: Breakpoint if tests failed
|
|
|
|
if: failure()
|
|
|
|
uses: namespacelabs/breakpoint-action@v0
|
|
|
|
with:
|
|
|
|
duration: 5m
|
|
|
|
authorized-users: grahamc
|
2023-01-13 19:07:57 +01:00
|
|
|
|
2024-05-15 23:16:09 +02:00
|
|
|
install-nix-macos:
|
2024-05-15 22:56:08 +02:00
|
|
|
name: Run test suite for macOS systems
|
2024-05-15 22:39:35 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
runner:
|
|
|
|
# x86_64-darwin
|
|
|
|
- macos-12
|
|
|
|
# aarch64-darwin
|
|
|
|
- macos-latest-xlarge
|
|
|
|
runs-on: ${{ matrix.runner }}
|
2024-03-12 00:53:25 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
id-token: write
|
2023-01-13 19:07:57 +01:00
|
|
|
steps:
|
2024-05-02 19:10:17 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-13 19:13:23 +01:00
|
|
|
- name: Install Nix
|
2023-01-13 19:07:57 +01:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
logger: pretty
|
|
|
|
log-directives: nix_installer=trace
|
|
|
|
backtrace: full
|
|
|
|
- name: echo $PATH
|
|
|
|
run: echo $PATH
|
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
|
|
|
nix profile install nixpkgs#hello
|
|
|
|
hello
|
2023-01-13 19:07:57 +01:00
|
|
|
nix store gc
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
2023-01-13 19:07:57 +01:00
|
|
|
- name: Test bash
|
|
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
|
|
if: success() || failure()
|
|
|
|
shell: bash --login {0}
|
|
|
|
- name: Test sh
|
|
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
|
|
if: success() || failure()
|
|
|
|
shell: sh -l {0}
|
|
|
|
- name: Test zsh
|
|
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
|
|
if: success() || failure()
|
|
|
|
shell: zsh --login --interactive {0}
|
2023-01-13 21:09:36 +01:00
|
|
|
- name: Install Nix again (noop)
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
logger: pretty
|
|
|
|
log-directives: nix_installer=trace
|
|
|
|
backtrace: full
|
2023-01-13 21:18:14 +01:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
|
|
|
nix profile install nixpkgs#hello
|
|
|
|
hello
|
2023-01-13 21:18:14 +01:00
|
|
|
nix store gc
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
2023-01-13 21:09:36 +01:00
|
|
|
- name: Reinstall Nix
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
logger: pretty
|
|
|
|
log-directives: nix_installer=trace
|
|
|
|
backtrace: full
|
2024-05-02 18:54:44 +02:00
|
|
|
reinstall: true
|
2023-01-28 00:10:13 +01:00
|
|
|
extra-conf: |
|
|
|
|
use-sqlite-wal = true
|
2023-01-13 21:18:14 +01:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
|
|
if: success() || failure()
|
|
|
|
run: |
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
|
|
|
nix profile install nixpkgs#hello
|
|
|
|
hello
|
2023-01-13 21:18:14 +01:00
|
|
|
nix store gc
|
2023-05-25 17:54:25 +02:00
|
|
|
nix run nixpkgs#hello
|
2023-01-28 00:10:13 +01:00
|
|
|
- name: Verify the generated nix.conf
|
|
|
|
run: |
|
2023-07-01 22:59:30 +02:00
|
|
|
cat /etc/nix/nix.conf
|
2023-01-28 00:10:13 +01:00
|
|
|
grep -E "^trusted-users = .*$USER" /etc/nix/nix.conf
|
2023-01-28 00:10:13 +01:00
|
|
|
grep -E "^use-sqlite-wal = true" /etc/nix/nix.conf
|
2024-04-11 17:58:56 +02:00
|
|
|
- name: Breakpoint if tests failed
|
|
|
|
if: failure()
|
|
|
|
uses: namespacelabs/breakpoint-action@v0
|
|
|
|
with:
|
|
|
|
duration: 5m
|
|
|
|
authorized-users: grahamc
|
2024-05-17 01:37:01 +02:00
|
|
|
|
2024-05-17 01:49:32 +02:00
|
|
|
install-with-non-default-source-url:
|
|
|
|
name: Install Nix using non-default source-url inputs
|
2024-05-17 01:37:01 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2024-05-17 01:41:04 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-17 01:49:32 +02:00
|
|
|
versions:
|
|
|
|
- { nix-installer: "0.12.0", nix: "2.20.0" }
|
|
|
|
- { nix-installer: "0.14.0", nix: "2.20.0" }
|
|
|
|
- { nix-installer: "0.18.0", nix: "2.20.0" }
|
2024-05-17 01:37:01 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: DeterminateSystems/nix-installer-action@main
|
|
|
|
with:
|
2024-05-17 01:49:32 +02:00
|
|
|
source-url: https://github.com/DeterminateSystems/nix-installer/releases/download/v${{ matrix.versions.nix-installer }}/nix-installer-x86_64-linux
|
2024-05-17 01:50:21 +02:00
|
|
|
- name: Compare Nix version with expected version
|
|
|
|
run: |
|
2024-05-17 01:49:32 +02:00
|
|
|
NIX_VERSION_OUTPUT=$(nix --version)
|
2024-05-17 01:50:21 +02:00
|
|
|
NIX_VERSION=$(echo "${NIX_VERSION}" | awk '{print $NF}')
|
2024-05-17 01:49:32 +02:00
|
|
|
EXPECTED_OUTPUT="nix (Nix) ${{ matrix.versions.nix }}"
|
|
|
|
if [ "${NIX_VERSION_OUTPUT}" != "${EXPECTED_OUTPUT}" ]; then
|
|
|
|
echo "Nix version ${NIX_VERSION} didn't match expected version ${{ matrix.versions.nix }}"
|
|
|
|
exit 1
|
|
|
|
fi
|