-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (50 loc) · 1.57 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: CI
on:
push:
tags:
- '*'
branches:
- '*'
pull_request:
branches: [main]
jobs:
test:
strategy:
matrix:
go: [1.20.x, 1.21.x]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set NATS Server Version
run: echo "NATS_VERSION=v2.10.9" >> $GITHUB_ENV
- name: Get nats-server
run: |
wget "https://github.com/nats-io/nats-server/releases/download/$NATS_VERSION/nats-server-$NATS_VERSION-linux-amd64.zip" -O tmp.zip
unzip tmp.zip
mv nats-server-$NATS_VERSION-linux-amd64 nats-server
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{matrix.go}}
- name: Install deps
shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Lint
shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
go build
if [ "$(go fmt ./... | wc -l)" -gt 0 ]; then
echo "gofmt failed; to fix, run: 'go fmt ./...'"
exit 1
fi
go vet ./...
$HOME/go/bin/staticcheck ./...
- name: Run tests
shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
# go test -vet=off -v -run=TestNoRace --failfast -p=1 ./...
# coverage via cov.sh disabled while just testing the waters
# Also disable race since we are overwhelming the GHA runners.
go test -vet=off -v -p=1 --failfast ./...