-
Notifications
You must be signed in to change notification settings - Fork 507
66 lines (64 loc) · 1.82 KB
/
Copy pathtest.yaml
File metadata and controls
66 lines (64 loc) · 1.82 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
59
60
61
62
63
64
65
66
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:
strategy:
matrix:
go-version: ["oldstable", "stable"]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
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@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
go-test:
needs: go-fmt-and-vet
strategy:
matrix:
go-version: ["oldstable", "stable"]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Install dependencies
run: make test-deps
- 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 ./...