name: CI on: push: branches: ["**"] pull_request: branches: [main] jobs: test: name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6 with: go-version-file: go.mod cache: true - name: Install gotestsum run: go install gotest.tools/gotestsum@latest - name: Vet run: go vet ./... - name: Test run: | gotestsum \ --format github-actions \ --junitfile test-results.xml \ -- -race -coverprofile=coverage.out ./... - name: Coverage summary run: | COVERAGE=$(go tool cover -func=coverage.out | tail -1 | awk '{print $3}') echo "## Test Coverage" >> "$GITHUB_STEP_SUMMARY" echo "" >> "$GITHUB_STEP_SUMMARY" echo "| Metric | Value |" >> "$GITHUB_STEP_SUMMARY" echo "|--------|-------|" >> "$GITHUB_STEP_SUMMARY" echo "| Total coverage | **${COVERAGE}** |" >> "$GITHUB_STEP_SUMMARY" - name: Upload test results if: always() uses: actions/upload-artifact@v7 with: name: test-results path: | test-results.xml coverage.out