-
Notifications
You must be signed in to change notification settings - Fork 4
61 lines (47 loc) · 1.38 KB
/
ci.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
name: CI
on: [push, pull_request]
jobs:
test-library:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.21', '1.22', '1.23.x' ]
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go get .
- name: Go formatting analysis
run: |
if [ -n "$(gofmt -l .)" ]; then
gofmt -d .
exit 1
fi
- name: Go code quality analysis
run: go vet ./...
- name: Go unit testing
run: |
go test -race $(go list ./... | grep -v /vendor/) -v -coverprofile=coverage.out
go tool cover -func=coverage.out
- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.out
test-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.2
echo "$HOME/bin" >> $GITHUB_PATH
- name: Run golangci-lint
run: ./bin/golangci-lint run -v