-
Notifications
You must be signed in to change notification settings - Fork 6
67 lines (56 loc) · 1.56 KB
/
build.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
# SPDX-FileCopyrightText: 2023 Steffen Vogel <[email protected]>
# SPDX-License-Identifier: CC0-1.0
name: Build and Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get install traceroute make libpcap-dev tshark
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
check-latest: true
cache: true
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
path: |
/root/go/pkg/mod
/root/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Test
run: |
sudo --preserve-env \
env "PATH=$PATH" \
go test -coverpkg ./... -coverprofile coverage.out -json -v ./pkg ./internal/... 2>&1 \
| tee /tmp/gotest.log \
| gotestfmt
- name: Upload test log
uses: actions/upload-artifact@v3
if: always()
with:
name: test-log
path: /tmp/gotest.log
if-no-files-found: error
- uses: codecov/codecov-action@v3
with:
files: coverage.out