Add GitHub Actions workflow for go coverage job #2
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: Go coverage | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: ["main"] | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| go-coverage: | |
| name: Go coverage | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| pull-requests: write | |
| # container: | |
| # image: ghcr.io/tektoncd/plumbing/coverage:latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| path: ${{ github.workspace }}/src/github.com/tektoncd/chains | |
| - name: Generate coverage | |
| run: go test -cover -coverprofile=coverage.txt ./... | |
| # - name: Run go-coverage | |
| # working-directory: ${{ github.workspace }}/src/github.com/tektoncd/chains | |
| # run: | | |
| # /coverage --profile-name=coverage_profile.txt --cov-target=. --cov-threshold-percentage=0 | |
| - name: Archive coverage results | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: code-coverage | |
| path: coverage.txt | |
| - name: Comment on PR | |
| if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch | |
| uses: fgrosse/go-coverage-report@8c1d1a09864211d258937b1b1a5b849f7e4f2682 # v1.2.0 | |
| continue-on-error: true # This may fail if artifact on main branch does not exist (first run or expired) | |
| with: | |
| coverage-artifact-name: "code-coverage" | |
| coverage-file-name: "coverage.txt" |