Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

defaults:
run:
shell: bash
shell: nix develop --command bash -eo pipefail {0}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] This workflow-level default shell now also applies to all-green, which runs on a bare ubuntu-latest with no checkout and no Nix. Today its only step is exit 1, so the job still fails when it should — but it fails because nix: command not found, not because of the exit 1. That hides why it failed, and any step added to that job later would break too. Consider moving this defaults.run.shell onto the Nix-using jobs (lint/format/test/audit), or setting defaults: run: shell: bash on all-green.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, fixed in the next commit: all-green now sets defaults.run.shell to bash, so a failure there reports the exit 1 and not a missing nix. It passed here only because its single step was skipped.


jobs:
nix-lint:
Expand All @@ -33,15 +33,11 @@ jobs:
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Set up Nix
uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0

- name: Run golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.15.0
run: golangci-lint run

format:
runs-on: ubuntu-latest
Expand All @@ -54,16 +50,8 @@ jobs:
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod

- name: Install golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.15.0
install-only: true
- name: Set up Nix
uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0

- name: Run golangci-lint fmt
run: golangci-lint fmt --diff
Expand All @@ -79,10 +67,8 @@ jobs:
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Set up Nix
uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0

- name: Run tests
run: go test -race -cover ./...
Expand All @@ -98,10 +84,8 @@ jobs:
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Set up Nix
uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0

- name: Run govulncheck
run: go tool govulncheck ./...
Expand Down Expand Up @@ -161,6 +145,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 1
permissions: {}
defaults:
run:
shell: bash
steps:
- name: Fail if any prerequisite did not succeed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
Expand Down
49 changes: 30 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,37 @@
outputs =
{ nixpkgs, nixpkgs-unstable, ... }:
let
system = "aarch64-darwin";
pkgs = import nixpkgs { inherit system; };
unstable = nixpkgs-unstable.legacyPackages.${system};
systems = [
"aarch64-darwin"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
devShells.${system}.default = pkgs.mkShell {
env.GOTOOLCHAIN = "local";
packages = with pkgs; [
commitlint
deadnix
go_1_27
gopls
# lefthook before 2.1.6 runs hooks under a pty, which agent sandboxes deny.
unstable.lefthook
# golangci-lint refuses modules newer than the Go that built it.
unstable.golangci-lint
ls-lint
nixfmt
statix
];
};
devShells = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
unstable = nixpkgs-unstable.legacyPackages.${system};
in
{
default = pkgs.mkShell {
env.GOTOOLCHAIN = "local";
packages = with pkgs; [
commitlint
deadnix
go_1_27
gopls
# lefthook before 2.1.6 runs hooks under a pty, which agent sandboxes deny.
unstable.lefthook
# golangci-lint refuses modules newer than the Go that built it.
unstable.golangci-lint
ls-lint
nixfmt
statix
];
};
}
);
};
}
Loading