-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.11 KB
/
go.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
name: Test
on: [push, workflow_dispatch]
jobs:
build:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Test examples
run: go test -v -gcflags="all=-N -l" ./examples/...
- name: Unit tests
run: go test -v -gcflags="all=-N -l" -coverprofile coverage.out .
- id: cover
name: Calculate coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
echo "COVERAGE=$(go tool cover -func coverage.out | grep total: | awk '{ print $3 }')" >> $GITHUB_OUTPUT
- id: gen_badge
name: Generate badge
if: ${{ matrix.os == 'ubuntu-latest' }}
run: curl https://img.shields.io/badge/Coverage-${{ steps.cover.outputs.COVERAGE }}25-limegreen -o coverage.svg
- name: Upload badge
#if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4
with:
name: badge
path: coverage.svg