Skip to content

Migration to Go implementation #25

Migration to Go implementation

Migration to Go implementation #25

Workflow file for this run

name: Go Tests
on:
push:
branches: [main, feature/*, develop]
pull_request:
branches: [main, develop]
jobs:
test:
name: Run Go Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: true
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -v ./... -coverprofile=coverage.out
- name: Generate coverage report
run: go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage.html
- name: Check test coverage
run: |
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
echo "Total coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 70" | bc -l) )); then
echo "Code coverage is below 70%. Please add more tests."
exit 1
fi