-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (46 loc) · 1.55 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
41
42
43
44
45
46
47
48
49
50
51
name: test
on:
workflow_call:
inputs:
# arrays are not supported yet, so we use `string` + `fromJSON` as a temporarily workaround;
# see https://github.com/orgs/community/discussions/11692 for details.
runs-on:
type: string
required: false
default: '[ "ubuntu-latest" ]'
description: OSes to run tests on (JSON array)
go-versions:
type: string
required: false
default: '[ "oldstable", "stable" ]'
description: Go versions to test against (JSON array)
packages:
type: string
required: false
default: './...'
description: Space-separated list of Go packages to test
jobs:
test:
strategy:
matrix:
os: ${{ fromJSON(inputs.runs-on) }}
go: ${{ fromJSON(inputs.go-versions) }}
runs-on: ${{ matrix.os }}
steps:
# https://github.com/actions/setup-go
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
# do not use `=` to join flags and values, it won't work on Windows;
# see https://github.com/PowerShell/PowerShell/issues/6291 for details.
run: go test -v -race -shuffle on -coverprofile coverage.out ${{ inputs.packages }}
# https://github.com/codecov/codecov-action
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: coverage.out