-
Notifications
You must be signed in to change notification settings - Fork 20
43 lines (36 loc) · 1.04 KB
/
go-test.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
name: Test
on:
push:
tags: [ 'v*' ]
branches: [ 'main' ]
pull_request:
branches: [ 'main', 'release-*']
jobs:
test:
name: Unit Tests
strategy:
matrix:
go-version: ['1.21.x']
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Check for .codecov.yaml
id: codecov-enabled
uses: andstor/file-existence-action@v1
with:
files: .codecov.yaml
- if: steps.codecov-enabled.outputs.files_exists == 'true'
name: Produce Go Coverage
run: echo 'COVER_OPTS=-coverprofile=coverage.txt -covermode=atomic' >> $GITHUB_ENV
- name: Test
run: go test -race $COVER_OPTS ./...
- if: steps.codecov-enabled.outputs.files_exists == 'true'
name: Codecov
uses: codecov/codecov-action@v1