style: add deadnix
and statix
checks and clean up the warnings from them
#2317
Workflow file for this run
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
name: CI | |
on: | |
pull_request: | |
merge_group: | |
concurrency: | |
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
sort-build-systems: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: cachix/install-nix-action@v23 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: actions/checkout@v4 | |
- name: Check format | |
run: nix-shell --packages jq --pure --run 'diff --unified overrides/build-systems.json <(jq --from-file overrides/sort-build-systems.jq --raw-output --sort-keys < overrides/build-systems.json)' | |
nixpkgs-fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: cachix/install-nix-action@v23 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: actions/checkout@v4 | |
- name: Check format | |
run: nix run 'nixpkgs#nixpkgs-fmt' -- --check . | |
statix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: cachix/install-nix-action@v23 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: actions/checkout@v4 | |
- name: Check format with statix | |
run: nix run 'nixpkgs#statix' -- check | |
deadnix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: cachix/install-nix-action@v23 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: actions/checkout@v4 | |
- name: Check format with deadnix | |
run: nix run 'nixpkgs#deadnix' | |
black-fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: cachix/install-nix-action@v23 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: actions/checkout@v4 | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: poetry2nix | |
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw==" | |
- name: Check format | |
run: nix-shell --arg packages 'pkgs:[ pkgs.p2nix-tools.env ]' --run 'black --check .' | |
nix-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v23 | |
- id: set-matrix | |
name: Generate Nix Matrix | |
run: | | |
set -Eeu | |
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT" | |
nix-build: | |
needs: nix-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v23 | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: poetry2nix | |
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw==" | |
- run: nix build -L ".#${{ matrix.attr }}" | |
collect: | |
runs-on: ubuntu-latest | |
needs: | |
- nixpkgs-fmt | |
- black-fmt | |
- nix-build | |
- sort-build-systems | |
steps: | |
- run: true |