forked from arrikto/boltstore
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 1.4 KB
/
main.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
59
60
61
62
63
64
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
strategy:
matrix:
go-version: ['1.20', '1.19']
runs-on: ubuntu-latest
env:
GO111MODULE: "on"
GOPROXY: ''
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
- name: Print the Go version
run: go version
- name: Install dependencies
run: |
set +e
output=$(go mod download 2>&1)
exit_status=$?
set -e
if [[ $exit_status -ne 0 ]]; then
if [[ $output != "go: no module dependencies to download" ]]; then
echo "$output" >&2
exit $exit_status
else
echo "No external dependencies found."
fi
else
echo $output
fi
- name: Run golint
if: matrix.go-version == '1.20'
run: |
go install golang.org/x/lint/golint@latest
golint ./...
- name: Run gofmt
if: matrix.go-version == '1.20'
run: diff -u <(echo -n) <(gofmt -d -e .)
- name: Run go vet
if: matrix.go-version == '1.20'
run: go vet -v ./...
- name: Run go test (+ race detector)
run: go test -v -race ./...