|
2 | 2 |
|
3 | 3 | name: "CI" |
4 | 4 | on: |
5 | | - workflow_dispatch: {} |
6 | 5 | push: |
7 | 6 | branches: ["main"] |
8 | 7 | pull_request: |
9 | 8 | branches: ["main"] |
10 | | - |
11 | 9 | jobs: |
12 | | - tests: |
| 10 | + check-quality: |
13 | 11 | runs-on: "ubuntu-latest" |
14 | 12 | steps: |
15 | | - - uses: "cachix/install-nix-action@v25" |
| 13 | + # setup |
| 14 | + - uses: "webfactory/[email protected]" |
| 15 | + with: |
| 16 | + ssh-private-key: "${{ secrets.SSH_PRIVATE_KEY }}" |
| 17 | + - uses: "actions/checkout@v4" |
| 18 | + - uses: "DeterminateSystems/nix-installer-action@v16" |
16 | 19 | with: |
17 | | - nix_path: "nixpkgs=channel:nixpkgs-unstable" |
18 | | - - uses: "actions/checkout@v3" |
19 | | - - name: "Print installed nixpkgs version" |
20 | | - run: "nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'" |
| 20 | + diagnostic-endpoint: "" |
| 21 | + - uses: "DeterminateSystems/magic-nix-cache-action@v8" |
| 22 | + with: |
| 23 | + diagnostic-endpoint: "" |
21 | 24 | - name: "Print flake metadata" |
22 | 25 | run: "nix flake metadata" |
| 26 | + - uses: "DeterminateSystems/flake-checker-action@v9" |
| 27 | + with: |
| 28 | + fail-mode: true |
| 29 | + ignore-missing-flake-lock: false |
| 30 | + nixpkgs-keys: "nixpkgs" |
| 31 | + send-statistics: false |
23 | 32 | - name: "Setup shell" |
24 | 33 | run: "nix develop --command true" |
| 34 | + |
| 35 | + # tests |
| 36 | + - name: "Flake check" |
| 37 | + run: "nix flake check --all-systems --print-build-logs" |
| 38 | + |
| 39 | + - name: "Files respect Editorconfig configuration" |
| 40 | + run: "nix develop --command editorconfig-checker" |
| 41 | + |
| 42 | + - name: "Files respect treefmt format" |
| 43 | + run: | |
| 44 | + # we need to explicitly add all formatters except cue |
| 45 | + # this is due to cue re-generating files, which would cause --fail-on-change to fail. |
| 46 | + nix develop --command \ |
| 47 | + treefmt \ |
| 48 | + --no-cache --fail-on-change \ |
| 49 | + --formatters alejandra \ |
| 50 | + --formatters gci \ |
| 51 | + --formatters gofumpt \ |
| 52 | + --formatters goimports \ |
| 53 | + --formatters jsonfmt \ |
| 54 | + --formatters mdsh \ |
| 55 | + --formatters shfmt \ |
| 56 | + --formatters yamlfmt |
| 57 | +
|
25 | 58 | - name: "Run go unit tests" |
26 | 59 | run: "nix develop --command go test -v -race -count=1 ./..." |
27 | | - - name: "Lint nix files" |
28 | | - run: "nix develop --command ./scripts/lint-nix.sh" |
29 | | - - name: "Lint go files" |
30 | | - run: "nix develop --command ./scripts/lint-go.sh" |
31 | | - - name: "Lint shell files" |
32 | | - run: "nix develop --command shellcheck **/*.sh" |
33 | | - - name: "Lint yaml files" |
34 | | - run: "nix develop --command yamllint --config-file .yamllint.yml ." |
35 | | - |
36 | | -... |
| 60 | + |
| 61 | + - name: "Lint Github Actions" |
| 62 | + run: "nix develop --command lint-ghaction" |
| 63 | + |
| 64 | + - name: "Lint Shell scripts" |
| 65 | + run: "nix develop --command lint-sh" |
| 66 | + |
| 67 | + - name: "Lint Yaml configurations files" |
| 68 | + run: "nix develop --command lint-yaml" |
| 69 | + |
| 70 | + - name: "Lint Go code" |
| 71 | + run: "nix develop --command lint-go" |
| 72 | + |
| 73 | + - name: "Lint Nix code" |
| 74 | + run: "nix develop --command lint-nix" |
0 commit comments