2022-11-16 03:51:40 +01:00
|
|
|
name: test
|
2020-04-10 22:50:29 +02:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- '*.md'
|
2023-02-10 03:23:29 +01:00
|
|
|
- '.examples/**'
|
2020-04-10 22:50:29 +02:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths-ignore:
|
|
|
|
- '*.md'
|
2023-02-10 03:23:29 +01:00
|
|
|
- '.github/**'
|
|
|
|
- '.examples/**'
|
2019-09-06 06:08:29 +02:00
|
|
|
jobs:
|
2022-11-16 03:51:40 +01:00
|
|
|
test:
|
2019-09-06 06:08:29 +02:00
|
|
|
runs-on: ubuntu-latest
|
2023-10-17 03:45:00 +02:00
|
|
|
timeout-minutes: 10
|
2019-09-06 06:08:29 +02:00
|
|
|
steps:
|
2024-01-02 05:26:52 +01:00
|
|
|
- uses: actions/setup-go@v5
|
2019-09-09 03:30:21 +02:00
|
|
|
with:
|
2024-06-08 18:39:26 +02:00
|
|
|
go-version: 1.22.2
|
2023-09-30 14:06:35 +02:00
|
|
|
- uses: actions/checkout@v4
|
2020-04-10 22:50:29 +02:00
|
|
|
- name: Build binary to make sure it works
|
2022-11-16 03:51:40 +01:00
|
|
|
run: go build
|
2020-04-10 22:50:29 +02:00
|
|
|
- name: Test
|
2021-01-19 05:52:48 +01:00
|
|
|
# We're using "sudo" because one of the tests leverages ping, which requires super-user privileges.
|
2021-02-03 05:06:34 +01:00
|
|
|
# As for the 'env "PATH=$PATH" "GOROOT=$GOROOT"', we need it to use the same "go" executable that
|
2021-11-05 02:33:13 +01:00
|
|
|
# was configured by the "Set up Go" step (otherwise, it'd use sudo's "go" executable)
|
2022-11-16 03:51:40 +01:00
|
|
|
run: sudo env "PATH=$PATH" "GOROOT=$GOROOT" go test ./... -race -coverprofile=coverage.txt -covermode=atomic
|
2020-10-22 05:05:11 +02:00
|
|
|
- name: Codecov
|
2024-10-22 03:50:03 +02:00
|
|
|
uses: codecov/codecov-action@v4.6.0
|
2020-10-22 05:05:11 +02:00
|
|
|
with:
|
2021-11-05 02:33:13 +01:00
|
|
|
files: ./coverage.txt
|
2024-04-10 00:53:15 +02:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|