Migration to Go implementation #41
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |