37 lines
967 B
YAML
37 lines
967 B
YAML
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
|