Update GitHub Actions workflow: remove test coverage from summary req… #3
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: "Build and Test" | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags-ignore: | |
| - '**' | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu, windows, macos ] | |
| runs-on: ${{ matrix.os }}-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup Go with cache | |
| uses: jfrog/.github/actions/install-go-with-cache@main | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Build binary | |
| run: make build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jfrog-evidence-${{ matrix.os }} | |
| path: build/jfrog-evidence* | |
| retention-days: 7 | |
| test: | |
| name: Test ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu, windows, macos ] | |
| runs-on: ${{ matrix.os }}-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup Go with cache | |
| uses: jfrog/.github/actions/install-go-with-cache@main | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Run unit tests | |
| run: make coverage | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| coverage/coverage.out | |
| coverage/coverage.html | |
| retention-days: 30 | |
| - name: Display coverage summary | |
| run: | | |
| echo "### Test Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "```" >> $GITHUB_STEP_SUMMARY | |
| go tool cover -func=coverage/coverage.out | tail -n 1 >> $GITHUB_STEP_SUMMARY | |
| echo "```" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📊 Full coverage report available in artifacts" >> $GITHUB_STEP_SUMMARY | |
| - name: Check coverage threshold | |
| run: | | |
| COVERAGE=$(go tool cover -func=coverage/coverage.out | grep total | awk '{print $3}' | sed 's/%//') | |
| echo "Total coverage: ${COVERAGE}%" | |
| THRESHOLD=70 | |
| if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then | |
| echo "⚠️ Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%" | |
| echo "::warning::Code coverage ${COVERAGE}% is below the recommended threshold of ${THRESHOLD}%" | |
| else | |
| echo "✅ Coverage ${COVERAGE}% meets threshold ${THRESHOLD}%" | |
| fi | |
| benchmark: | |
| name: Benchmarks | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Go with cache | |
| uses: jfrog/.github/actions/install-go-with-cache@main | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Run benchmarks | |
| run: make benchmark | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: benchmark-results.txt | |
| retention-days: 30 | |
| if: always() | |
| multi-platform-build: | |
| name: Multi-Platform Build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Go with cache | |
| uses: jfrog/.github/actions/install-go-with-cache@main | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Build for all platforms | |
| run: make build-all | |
| code-quality: | |
| name: Code Quality Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup Go with cache | |
| uses: jfrog/.github/actions/install-go-with-cache@main | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Install tools | |
| run: make install-tools | |
| - name: Format check | |
| run: | | |
| make fmt | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "::error::Code is not properly formatted. Please run 'make fmt'" | |
| git diff | |
| exit 1 | |
| fi | |
| - name: Run vet | |
| run: make vet | |
| - name: Run linter | |
| run: make lint | |
| continue-on-error: true | |
| summary: | |
| name: Test Summary | |
| needs: [build, test, code-quality] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Summary | |
| run: | | |
| echo "## Workflow Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ needs.build.result }}" == "success" ]]; then | |
| echo "✅ **Build:** Passed" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "❌ **Build:** Failed" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [[ "${{ needs.test.result }}" == "success" ]]; then | |
| echo "✅ **Tests:** Passed" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "❌ **Tests:** Failed" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [[ "${{ needs.code-quality.result }}" == "success" ]]; then | |
| echo "✅ **Code Quality:** Passed" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ **Code Quality:** Issues found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📦 Artifacts available for download in the workflow run" >> $GITHUB_STEP_SUMMARY |