-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
setput github CI
- Loading branch information
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# To validate: | ||
# cat codecov.yml | curl --data-binary @- https://codecov.io/validate | ||
|
||
codecov: | ||
notify: | ||
require_ci_to_pass: yes | ||
|
||
allow_coverage_offsets: true | ||
|
||
coverage: | ||
precision: 2 | ||
round: down | ||
range: "50...75" | ||
|
||
status: | ||
project: | ||
default: | ||
threshold: 1 | ||
# Disable patch since it is noisy and not correct | ||
patch: | ||
default: | ||
enabled: no | ||
if_not_found: success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: actions | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
jobs: | ||
test: | ||
if: ${{ !github.event.pull_request.draft }} | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: | ||
- "golang:1.21" | ||
- "golang:1.20" | ||
- "golang:1.19" | ||
- "golang:1.18" | ||
- "golang:1.17" | ||
- "golang:1.16" | ||
- "golang:1.15" | ||
- "golang:1.14" | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run Unit tests. | ||
env: | ||
BUILD_IMAGE: ${{ matrix.go-version }} | ||
run: make test | ||
|
||
- name: Coverage | ||
run: bash <(curl -s https://codecov.io/bash) | ||
|
||
build: | ||
if: ${{ !github.event.pull_request.draft }} | ||
name: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.14 | ||
cache: true | ||
|
||
- name: Run Build. | ||
run: go build ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.* | ||
!.gitignore | ||
|
||
coverage.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
test: | ||
bash ./ut.sh | ||
|
||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
echo "" > coverage.txt | ||
|
||
for d in $(go list ./test/... | grep -v test/fake); do | ||
echo "--------Run test package: $d" | ||
GO111MODULE=on go test -gcflags="all=-N -l" -v -coverprofile=profile.out -coverpkg=./... -covermode=atomic $d | ||
echo "--------Finish test package: $d" | ||
if [ -f profile.out ]; then | ||
cat profile.out >> coverage.txt | ||
rm profile.out | ||
fi | ||
done |