Merge pull request #19 from MimoJanra/dependabot/go_modules/github.co… #130
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: Tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test on Go ${{ matrix.go-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go-version: ["1.25", "1.26"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache: true | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.txt ./... | |
| - name: Check coverage | |
| run: | | |
| coverage=$(go tool cover -func=coverage.txt | grep total | awk '{print $3}' | sed 's/%//') | |
| echo "Coverage: ${coverage}%" | |
| if (( $(echo "$coverage < 75" | bc -l) )); then | |
| echo "Coverage is below 75%" | |
| exit 1 | |
| fi | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.txt | |
| flags: unittests | |
| name: codecov-${{ matrix.go-version }} |