-
Notifications
You must be signed in to change notification settings - Fork 499
58 lines (56 loc) · 1.59 KB
/
test.yaml
File metadata and controls
58 lines (56 loc) · 1.59 KB
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 Tests
on:
pull_request:
paths-ignore:
- 'README.md'
push:
branches:
- 'main'
paths-ignore:
- 'README.md'
permissions:
contents: read
jobs:
go-fmt-and-vet:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: '>=1.21'
cache: true
- name: Go formatting
run: |
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
- name: Lint code
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
go-test:
needs: go-fmt-and-vet
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: '>=1.21'
cache: true
- name: Run test and generate coverage report
run: |
go test -race ./... -v -coverprofile=coverage.out
- name: Upload Coverage Report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: coverage.out
name: Coverage-report
- name: Display Coverage report
run: go tool cover -func=coverage.out
- name: Build Go
run: go build ./...