mirror of
https://github.com/gortc/stun.git
synced 2025-09-26 20:41:36 +08:00
ci: move coverage to separate pipeline
This commit is contained in:
21
.github/workflows/pr.yml
vendored
21
.github/workflows/pr.yml
vendored
@@ -78,6 +78,27 @@ jobs:
|
||||
${{ runner.os }}-go-${{ matrix.golang }}-
|
||||
- name: Run tests
|
||||
run: make test
|
||||
coverage:
|
||||
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
golang:
|
||||
- 1.15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.golang }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: coverage-${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
coverage-${{ runner.os }}-go-${{ matrix.golang }}-
|
||||
- name: Run tests with coverage
|
||||
run: make coverage
|
||||
- name: Convert coverage.out to coverage.lcov
|
||||
uses: jandelgado/gcov2lcov-action@v1.0.6
|
||||
- name: Coveralls
|
||||
|
2
Makefile
2
Makefile
@@ -54,3 +54,5 @@ check-api:
|
||||
@cd api && bash ./check.sh
|
||||
test:
|
||||
@./go.test.sh
|
||||
coverage:
|
||||
@./go.coverage.sh
|
||||
|
12
go.coverage.sh
Executable file
12
go.coverage.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
touch coverage.out
|
||||
|
||||
for d in $(go list ./... | grep -v vendor); do
|
||||
go test -coverprofile=profile.out -covermode=atomic "$d"
|
||||
if [[ -f profile.out ]]; then
|
||||
cat profile.out >> coverage.out
|
||||
rm profile.out
|
||||
fi
|
||||
done
|
13
go.test.sh
13
go.test.sh
@@ -1,24 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
touch coverage.txt
|
||||
|
||||
# test fuzz inputs
|
||||
go test -tags gofuzz -run TestFuzz -v .
|
||||
|
||||
# quick-test without -race
|
||||
go test ./...
|
||||
|
||||
# test with "debug" tag
|
||||
go test -tags debug ./...
|
||||
|
||||
# test concurrency
|
||||
go test -race -cpu=1,2,4 -run TestClient_DoConcurrent
|
||||
|
||||
for d in $(go list ./... | grep -v vendor); do
|
||||
go test -race -coverprofile=profile.out -covermode=atomic "$d"
|
||||
if [[ -f profile.out ]]; then
|
||||
cat profile.out >> coverage.out
|
||||
rm profile.out
|
||||
fi
|
||||
done
|
||||
# test with -race
|
||||
go test -race ./...
|
||||
|
Reference in New Issue
Block a user