Skip to content

Commit

Permalink
Merge pull request #149 from alpha-baby/issue/#148
Browse files Browse the repository at this point in the history
setput github CI
  • Loading branch information
agiledragon authored Dec 6, 2023
2 parents 6dc9127 + 8cc6873 commit 8ddeb62
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/codecov.yaml
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
57 changes: 57 additions & 0 deletions .github/workflows/reviewdog.yaml
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 ./...
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.*
!.gitignore

coverage.*
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test:
bash ./ut.sh

.PHONY: test
14 changes: 14 additions & 0 deletions ut.sh
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

0 comments on commit 8ddeb62

Please sign in to comment.