Skip to content

Commit 9715e16

Browse files
committed
.github: update workflows to use flake.nix go version etc
And also run lints. This is cribbed from the ngrok-go repo
1 parent 0c953f2 commit 9715e16

File tree

7 files changed

+64
-25
lines changed

7 files changed

+64
-25
lines changed

.envrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if ! has nix_direnv_version || ! nix_direnv_version 2.2.0; then
2+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
3+
fi
4+
dotenv_if_exists
5+
GOPATH=`pwd`/.direnv/go
6+
PATH=${GOPATH}/bin:${PATH}
7+
use flake

.github/workflows/go.yml

-25
This file was deleted.

.github/workflows/lint.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: lint
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
pull_request:
6+
branches: [ "main" ]
7+
permissions:
8+
contents: read
9+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
10+
# pull-requests: read
11+
jobs:
12+
lint:
13+
name: lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 2
19+
- uses: cachix/install-nix-action@v18
20+
- uses: HatsuneMiku3939/direnv-action@v1
21+
- name: direnv allow
22+
run: direnv allow .
23+
- name: Run goimports
24+
shell: bash
25+
run: |
26+
shopt -s globstar
27+
direnv exec . goimports -format-only -w -local github.com/ngrok/tableroll **/*.go
28+
- name: Lint
29+
run: direnv exec . golangci-lint run .
30+
- name: Check diff
31+
shell: bash
32+
run: git diff --exit-code

.github/workflows/test.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Go
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
pull_request:
6+
branches: [ "main" ]
7+
jobs:
8+
build-and-test:
9+
runs-on: ubuntu-latest
10+
env:
11+
NGROK_TEST_ONLINE: 1
12+
NGROK_TEST_LONG: 1
13+
NGROK_TEST_FLAKEY: 1
14+
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: cachix/install-nix-action@v18
18+
- uses: HatsuneMiku3939/direnv-action@v1
19+
- name: direnv allow
20+
run: direnv allow .
21+
- name: Test
22+
run: direnv exec . go test -v ./...

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.direnv

dup_file.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build go1.12
12
// +build go1.12
23

34
package tableroll

dup_file_legacy.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !go1.12
12
// +build !go1.12
23

34
package tableroll

0 commit comments

Comments
 (0)