add CI actions #13
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
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
lints: | |
name: Lints and gen checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
- uses: HatsuneMiku3939/direnv-action@v1 | |
- name: direnv allow | |
run: direnv allow . | |
- name: go lint | |
run: direnv exec . golangci-lint run | |
- name: go mod tidy | |
run: direnv exec . go mod tidy | |
- name: gen proto | |
run: direnv exec . make gen | |
- name: exit if changed | |
run: git diff --exit-code | |
go-build: | |
name: Build and test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
- uses: HatsuneMiku3939/direnv-action@v1 | |
- name: direnv allow | |
run: direnv allow . | |
- name: Build | |
run: direnv exec . go build -v ./... | |
- name: Test | |
run: direnv exec . go test -v ./... | |
nix-build: | |
name: Build nix package | |
runs-on: ubuntu-latest | |
needs: [lints, go-build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- uses: DeterminateSystems/flake-checker-action@main | |
- name: Run `nix build` | |
run: nix build . |