nix: ensure that gc / optimise / upgrade do not run together #1135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Andrew Hayzen <[email protected]> | |
# | |
# SPDX-License-Identifier: MPL-2.0 | |
name: check | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
# Cancel any previous runs for the same pull request | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
license-check: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- name: REUSE Compliance Check | |
uses: fsfe/reuse-action@v4 | |
flake-checker: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/flake-checker-action@v9 | |
nix-fmt: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix fmt | |
run: nix fmt | |
- name: git diff | |
run: git diff --exit-code | |
shellcheck: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
# Shellcheck should already be installed on github runners | |
- name: install shellcheck | |
run: sudo apt install --yes shellcheck | |
- name: shellcheck | |
run: shellcheck scripts/*.sh | |
nix-flake-check-no-build: | |
# Run after pre checks | |
needs: [license-check, flake-checker, nix-fmt, shellcheck] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix flake check | |
# Only run a check of the flake itself without building | |
run: nix flake --option sandbox false check --no-build --print-build-logs | |
nix-flake-check-lab-actual: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-actual-test | |
nix-flake-check-lab-audiobookshelf: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-audiobookshelf-test | |
nix-flake-check-lab-bitwarden: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-bitwarden-test | |
nix-flake-check-lab-immich: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-immich-test | |
nix-flake-check-lab-jellyfin: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-jellyfin-test | |
nix-flake-check-lab-joplin: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-joplin-test | |
nix-flake-check-lab-restic: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-restic-test | |
nix-flake-check-lab-sftpgo: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.lab-sftpgo-test | |
nix-flake-check-vps: | |
# Run after flake check | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nix build | |
# nix flake check doesn't have a way to specify a specific test to run | |
# https://github.com/NixOS/nix/issues/8881 | |
run: nix build --option sandbox false --print-build-logs .#checks.x86_64-linux.vps-test | |
nixos-anywhere-vm-test-lab: | |
# Run after pre checks | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nixos-anywhere vm-test lab | |
# Use stable version from nixpkgs due to | |
# https://github.com/nix-community/nixos-anywhere/issues/375 | |
# instead of github:nix-community/nixos-anywhere | |
# | |
# TODO: can we pin this version to a release? | |
run: nix run nixpkgs#nixos-anywhere -- --flake .#lab-vm-test --vm-test | |
nixos-anywhere-vm-test-vps: | |
# Run after pre checks | |
needs: [nix-flake-check-no-build] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: nixos-anywhere vm-test vps | |
# Use stable version from nixpkgs due to | |
# https://github.com/nix-community/nixos-anywhere/issues/375 | |
# instead of github:nix-community/nixos-anywhere | |
# | |
# TODO: can we pin this version to a release? | |
run: nix run nixpkgs#nixos-anywhere -- --flake .#vps-vm-test --vm-test |