-
Notifications
You must be signed in to change notification settings - Fork 23
63 lines (53 loc) · 1.57 KB
/
test.yml
File metadata and controls
63 lines (53 loc) · 1.57 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
name: Test
on:
push:
branches: [ "main" ]
pull_request_target:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['stable']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout PR code
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
- name: Build
run: go build -v ./...
# Linux test step
- name: Test with coverage (Ubuntu)
if: runner.os == 'Linux'
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
# macOS test step
- name: Test with coverage (MacOS)
if: runner.os == 'macOS'
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
# Windows test step (separate to handle PowerShell issues)
- name: Test with coverage (Windows)
if: runner.os == 'Windows'
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
shell: cmd
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6.0.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.out
flags: ${{ matrix.os }}-go${{ matrix.go }}
name: codecov-${{ matrix.os }}-go${{ matrix.go }}
fail_ci_if_error: true
verbose: true