-
Notifications
You must be signed in to change notification settings - Fork 46
40 lines (40 loc) · 1.01 KB
/
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
on:
push:
branches:
- main
pull_request:
name: go test
jobs:
test:
strategy:
matrix:
go-version: [1.21.x]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Caching
uses: actions/cache@v2
with:
path: ~/go/pkg
key: ${{ runner.os }}-kool-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-kool-
- name: Download dependencies
run: |
go mod download
go install
- name: Test
if: matrix.os == 'macos-latest'
run: go test ./...
- name: Test with code coverage
if: matrix.os == 'ubuntu-latest'
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Code Coverage
if: matrix.os == 'ubuntu-latest'
run: bash <(curl -s https://codecov.io/bash)