Create ci.yml

created ci.yml file for configuring the ci workflow
This commit is contained in:
Faiz Mohammed
2025-02-13 12:43:03 +05:30
committed by GitHub
parent 91f0b16b5c
commit 0d4cee69f6

36
.github/workflows/ci.yml vendored Normal file
View 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