Create ci.yml
created ci.yml file for configuring the ci workflow
This commit is contained in:
36
.github/workflows/ci.yml
vendored
Normal file
36
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Go CI
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- beck-onix-v1.0-develop
|
||||||
|
- beck-onix-v1.0
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- beck-onix-v1.0-develop
|
||||||
|
- beck-onix-v1.0
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.20'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: go mod tidy
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -coverprofile=coverage.out ./...
|
||||||
|
- name: Check coverage
|
||||||
|
run: |
|
||||||
|
coverage=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
||||||
|
if (( $(echo "$coverage < 90" | bc -l) )); then
|
||||||
|
echo "Coverage is below 90%"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Run golangci-lint
|
||||||
|
run: golangci-lint run
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v5
|
||||||
|
with:
|
||||||
|
files: ./coverage.out
|
||||||
Reference in New Issue
Block a user