Skip to content

Commit

Permalink
.github: update workflows to use flake.nix go version etc
Browse files Browse the repository at this point in the history
And also run lints.

This is cribbed from the ngrok-go repo
  • Loading branch information
euank committed Jul 24, 2024
1 parent 2af9894 commit e5721ab
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
fi
dotenv_if_exists
GOPATH=`pwd`/.direnv/go
PATH=${GOPATH}/bin:${PATH}
use flake
25 changes: 0 additions & 25 deletions .github/workflows/go.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: lint
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: cachix/install-nix-action@v18
- uses: HatsuneMiku3939/direnv-action@v1
- name: direnv allow
run: direnv allow .
- name: Run goimports
shell: bash
run: direnv exec . goimports -format-only -w -local github.com/ngrok/tableroll **/*.go
- name: Lint
run: direnv exec . golangci-lint run .
- name: Check diff
shell: bash
run: git diff --exit-code
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
NGROK_TEST_ONLINE: 1
NGROK_TEST_LONG: 1
NGROK_TEST_FLAKEY: 1
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: HatsuneMiku3939/direnv-action@v1
- name: direnv allow
run: direnv allow .
- name: Test
run: direnv exec . go test -v ./...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.direnv
1 change: 1 addition & 0 deletions dup_file.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build go1.12
// +build go1.12

package tableroll
Expand Down
1 change: 1 addition & 0 deletions dup_file_legacy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !go1.12
// +build !go1.12

package tableroll
Expand Down

0 comments on commit e5721ab

Please sign in to comment.