-
Notifications
You must be signed in to change notification settings - Fork 44
48 lines (40 loc) · 1.07 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
name: Go
on:
push:
branches:
- main
- master
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.19', '1.20', '1.21']
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Check formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
gofmt -s -d .
exit 1
fi
- name: Build
run: go build -v .
- name: Unit tests
run: go test -v -coverprofile=coverage_unit.txt -covermode=atomic .
- name: Integration test
# The test need sudo to be able to mount/umount
run: sudo go test -v --tags=integration -coverprofile=coverage_integration.txt -covermode=atomic .
- name: Upload coverage to Codecov
if: matrix.go == '1.21'
uses: codecov/codecov-action@v2
with:
files: ./coverage_unit.txt,coverage_integration.txt