forked from canonical/chisel
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.01 KB
/
tests.yaml
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
name: Tests
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
pull_request:
branches: [main]
jobs:
unit-tests:
runs-on: ubuntu-22.04
name: Unit Tests
env:
TEST_COVERAGE_FILE: test-coverage.out
TEST_COVERAGE_HTML_FILE: test-coverage.html
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run unit tests
run: go test -v -cover -coverprofile=${TEST_COVERAGE_FILE} ./...
- name: Convert test coverage to HTML
if: always()
continue-on-error: true
run: |
set -eu
if [ -f ${TEST_COVERAGE_FILE} ]
then
go tool cover -html=${TEST_COVERAGE_FILE} \
-o=${TEST_COVERAGE_HTML_FILE}
fi
- name: Upload HTML test coverage
uses: actions/upload-artifact@v3
if: always()
continue-on-error: true
with:
name: chisel-test-coverage.html
path: ./*.html