fix: Fix non-CGO build for v8.2.0 release #403
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: Coverage | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [develop, main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| coverage: | |
| name: Test Coverage | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 2 # Required for Codecov to determine PR base SHA | |
| - name: Set up Go | |
| uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Install scip-go | |
| run: go install github.com/sourcegraph/scip-go/cmd/scip-go@latest | |
| - name: Run tests with coverage | |
| run: | | |
| go test -v -race -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./... 2>&1 | tee test-output.txt | |
| COVERAGE="N/A" | |
| if [ -f coverage.out ]; then | |
| go tool cover -func=coverage.out -o coverage.txt | |
| COVERAGE=$(grep "^total:" coverage.txt | awk '{print $3}' | sed 's/%//') | |
| else | |
| : > coverage.txt | |
| fi | |
| # Job summary | |
| echo "### ✅ Tests | ${COVERAGE}% Coverage" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Coverage threshold enforced by [Codecov](https://app.codecov.io/gh/${{ github.repository }})." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "<details>" >> $GITHUB_STEP_SUMMARY | |
| echo "<summary>Coverage by package</summary>" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| head -50 coverage.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "</details>" >> $GITHUB_STEP_SUMMARY | |
| - name: Upload to Codecov | |
| uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 | |
| with: | |
| files: coverage.out | |
| flags: unit | |
| fail_ci_if_error: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload coverage | |
| if: always() | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: coverage | |
| path: | | |
| coverage.out | |
| coverage.txt | |
| test-output.txt | |
| retention-days: 7 |