summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorJan Schmitt <git@smittie.de>2023-05-19 13:33:38 +0200
committerJan Schmitt <git@smittie.de>2023-05-19 13:33:38 +0200
commitebdd18cdc169f680a1385c0d26dfe92dc5062ade (patch)
tree13af0c36251f3254ad9a926ff28afa9234b1b87f /.github
parentd222200091f2d739bf811b98056fbd0062ea0789 (diff)
ci: refactor to several jobs to enable optional checks
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/test.yml167
1 files changed, 133 insertions, 34 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 57cd01b..c117a19 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -3,12 +3,11 @@ on:
pull_request:
push:
+env:
+ CURRENT_STABLE_CHANNEL: nixpkgs-22.11-darwin
+
jobs:
- tests:
- strategy:
- fail-fast: true
- matrix:
- channel: [nixpkgs-22.11-darwin, nixpkgs-unstable]
+ test-stable:
runs-on: macos-12
timeout-minutes: 30
steps:
@@ -19,23 +18,26 @@ jobs:
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- if: ${{ matrix.channel == 'nixpkgs-22.11-darwin' }}
+ - run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A tests
+ - run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A manpages
+ - run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A examples.simple
+
+ test-unstable:
+ runs-on: macos-12
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v3
- name: Install nix from current unstable channel
uses: cachix/install-nix-action@v20
with:
- nix_path: nixpkgs=channel:${{ matrix.channel }}
+ nix_path: nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }}
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- if: ${{ matrix.channel == 'nixpkgs-unstable' }}
- - run: nix-build ./release.nix -I nixpkgs=channel:${{ matrix.channel }} -I darwin=. -A tests
- - run: nix-build ./release.nix -I nixpkgs=channel:${{ matrix.channel }} -I darwin=. -A manpages
- - run: nix-build ./release.nix -I nixpkgs=channel:${{ matrix.channel }} -I darwin=. -A examples.simple
-
- install:
- strategy:
- fail-fast: true
- matrix:
- channel: [nixpkgs-22.11-darwin, nixpkgs-unstable]
+ - run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A tests
+ - run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A manpages
+ - run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A examples.simple
+
+ install-against-stable:
runs-on: macos-12
timeout-minutes: 30
steps:
@@ -44,20 +46,48 @@ jobs:
uses: cachix/install-nix-action@v20
with:
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
- nix_path: nixpkgs=channel:${{ matrix.channel }}
+ nix_path: nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }}
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- if: ${{ matrix.channel == 'nixpkgs-22.11-darwin' }}
+ - name: Install ${{ env.CURRENT_STABLE_CHANNEL }} channel
+ run: |
+ nix-channel --add https://nixos.org/channels/${{ env.CURRENT_STABLE_CHANNEL }} nixpkgs
+ nix-channel --update
+ - name: Install nix-darwin and test
+ run: |
+ export NIX_PATH=$HOME/.nix-defexpr/channels
+ nix-shell -A installer
+ nix-shell -A installer.check
+ - name: Build and activate default derivation
+ run: |
+ . /etc/static/bashrc
+ darwin-rebuild switch -I darwin=.
+ - name: Test uninstallation of nix-darwin
+ run: |
+ export NIX_PATH=$HOME/.nix-defexpr/channels
+ nix-shell -A uninstaller
+ nix-shell -A uninstaller.check
+ - name: Debugging tmate session
+ if: ${{ failure() }}
+ uses: mxschmitt/action-tmate@v3
+ timeout-minutes: 15
+ with:
+ limit-access-to-actor: true
+
+ install-against-unstable:
+ runs-on: macos-12
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v3
- name: Install nix from current unstable channel
uses: cachix/install-nix-action@v20
with:
- nix_path: nixpkgs=channel:${{ matrix.channel }}
+ nix_path: nixpkgs=channel:nixpkgs-unstable
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- if: ${{ matrix.channel == 'nixpkgs-unstable' }}
- - name: Install ${{ matrix.channel }} channel
+ - name: Install nixpkgs-unstable channel
run: |
- nix-channel --add https://nixos.org/channels/${{ matrix.channel }} nixpkgs
+ nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
nix-channel --update
- name: Install nix-darwin and test
run: |
@@ -80,11 +110,7 @@ jobs:
with:
limit-access-to-actor: true
- install-flake:
- strategy:
- fail-fast: true
- matrix:
- channel: [nixpkgs-22.11-darwin, nixpkgs-unstable]
+ install-flake-against-stable:
runs-on: macos-12
timeout-minutes: 30
steps:
@@ -93,20 +119,93 @@ jobs:
uses: cachix/install-nix-action@v20
with:
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
- nix_path: nixpkgs=channel:${{ matrix.channel }}
+ nix_path: nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }}
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- if: ${{ matrix.channel == 'nixpkgs-22.11-darwin' }}
+ - name: Install ${{ env.CURRENT_STABLE_CHANNEL }} channel
+ run: |
+ nix-channel --add https://nixos.org/channels/${{ env.CURRENT_STABLE_CHANNEL }} nixpkgs
+ nix-channel --update
+ - name: Install nix-darwin and test result
+ run: |
+ export NIX_PATH=$HOME/.nix-defexpr/channels
+ nix-shell -A installer
+ nix-shell -A installer.check
+ - name: Build simple flake configuration
+ run: |
+ nix build ./modules/examples#darwinConfigurations.simple.system --override-input darwin .
+ - name: Activate derivation of simple flake build
+ run: |
+ ./result/sw/bin/darwin-rebuild switch --flake ./modules/examples#simple --override-input darwin .
+ - name: Rebuild and activate simple flake, but this time using nix-darwins flake interface
+ run: |
+ . /etc/static/bashrc
+ darwin-rebuild build --flake ./modules/examples#simple --override-input darwin .
+ - name: Test git submodules
+ run: |
+ . /etc/static/bashrc
+
+ mkdir -p /tmp/{test-nix-darwin-submodules,example-submodule}
+
+ pushd /tmp/example-submodule
+ echo '"hello"' > hello.nix
+ git init
+ git add .
+ git commit -m "add a submodule we will import"
+ popd
+
+ cp -a ./modules/examples/. /tmp/test-nix-darwin-submodules
+
+ pushd /tmp/test-nix-darwin-submodules
+ /usr/bin/sed -i.bak \
+ '\#modules = \[#s#darwin.darwinModules.simple#./simple.nix#' \
+ ./flake.nix
+ /usr/bin/sed -i.bak \
+ 's#pkgs.vim#pkgs."${import ./submodule-test/hello.nix}"#' \
+ ./simple.nix
+ git init
+ git add flake.nix simple.nix
+ git \
+ -c protocol.file.allow=always \
+ submodule add /tmp/example-submodule submodule-test
+ popd
+
+ # Should fail
+ darwin-rebuild build \
+ --flake /tmp/test-nix-darwin-submodules#simple \
+ --override-input darwin . \
+ && {
+ printf 'succeeded while expecting failure due to submodule\n' >/dev/stderr
+ exit 1
+ }
+ # Should also fail
+ darwin-rebuild build \
+ --flake /tmp/test-nix-darwin-submodules?submodules=0#simple \
+ --override-input darwin . \
+ && {
+ printf 'succeeded while expecting failure due to submodule\n' >/dev/stderr
+ exit 1
+ }
+
+ # Should succeed
+ darwin-rebuild build \
+ --flake /tmp/test-nix-darwin-submodules?submodules=1#simple \
+ --override-input darwin .
+
+ install-flake-against-unstable:
+ runs-on: macos-12
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v3
- name: Install nix from current unstable channel
uses: cachix/install-nix-action@v20
with:
- nix_path: nixpkgs=channel:${{ matrix.channel }}
+ nix_path: nixpkgs=channel:nixpkgs-unstable
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- if: ${{ matrix.channel == 'nixpkgs-unstable' }}
- - name: Install ${{ matrix.channel }} channel
+ - name: Install nixpkgs-unstable channel
run: |
- nix-channel --add https://nixos.org/channels/${{ matrix.channel }} nixpkgs
+ nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
nix-channel --update
- name: Install nix-darwin and test result
run: |