name: Test on: push: branches: ["**"] pull_request: branches: [main] jobs: test: name: Go Test runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: go.mod cache: true - name: Install gotestsum run: go install gotest.tools/gotestsum@latest - name: Vet run: go vet ./... - name: Run tests 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" echo echo "| Metric | Value |" echo "|--------|-------|" echo "| Total coverage | **${COVERAGE}** |" } >> "$GITHUB_STEP_SUMMARY" - name: Upload test artifacts if: always() uses: actions/upload-artifact@v4 with: name: test-results path: | test-results.xml coverage.out