Skip to content

Commit 6af641d

Browse files
committed
Setup CI
1 parent 8f7640f commit 6af641d

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/ci.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
flags: [ '', '-race' ]
20+
go-version: [ '1.19', '1.20', '1.21' ]
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup Go ${{ matrix.go-version }}
25+
uses: actions/setup-go@v4
26+
with:
27+
go-version: ${{ matrix.go-version }}
28+
29+
- name: Build
30+
run: go build -v ./...
31+
32+
- name: Test
33+
env:
34+
GOFLAGS: ${{ matrix.flags }}
35+
run: go test -coverprofile=profile.out -covermode=atomic -v -coverpkg=./... ./...
36+
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: coverage
41+
path: |
42+
profile.out
43+
if-no-files-found: error
44+
retention-days: 1
45+
46+
upload:
47+
runs-on: ubuntu-latest
48+
needs:
49+
- test
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Download artifact
55+
uses: actions/download-artifact@v3
56+
with:
57+
name: coverage
58+
59+
- name: Send coverage
60+
uses: codecov/codecov-action@v3
61+
with:
62+
files: profile.out

0 commit comments

Comments
 (0)