Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup github CI #149

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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