Skip to content

Adapter Code Coverage workflow: Support Go version upgrades#4760

Open
anishb-ms wants to merge 3 commits into
prebid:masterfrom
anishb-ms:fixing-covdata
Open

Adapter Code Coverage workflow: Support Go version upgrades#4760
anishb-ms wants to merge 3 commits into
prebid:masterfrom
anishb-ms:fixing-covdata

Conversation

@anishb-ms
Copy link
Copy Markdown

## Problem

The `adapter-code-coverage.yml` workflow currently installs Go before checking out PR code:

```yaml
steps:
  - name: Install Go
    uses: actions/setup-go@v5
    with:
      go-version: 1.24.0       # hardcoded

  - name: Checkout Code        # PR code checked out after

Since this workflow uses pull_request_target, GitHub always runs the master branch's version of the workflow file. This means any PR that upgrades the Go version in go.mod will fail because:

  1. Master installs Go 1.24.0
  2. PR's go.mod declares a newer Go version (e.g., go 1.25 or go 1.26)
  3. At build time, Go 1.24.0 auto-downloads the newer toolchain — but auto-downloaded toolchains are lightweight bundles missing the covdata tool
  4. Tests fail with: go: no such tool "covdata"

This makes it impossible to upgrade Go via a PR — the adapter coverage check will always block it.

Fix
Swap the step order and use go-version-file to dynamically read the Go version from the checked-out PR code:

  steps:
  - name: Checkout Code        # checkout FIRST
    uses: actions/checkout@v4
    ...

  - name: Install Go           # then install based on go.mod
    uses: actions/setup-go@v5
    with:
      go-version-file: go.mod

This ensures actions/setup-go performs a full installation of whatever Go version the PR requires — no auto-download, no missing tools, no version mismatch.

Impact

  • Zero risk for current PRs: master's go.mod declares go 1.23.0, so setup-go installs 1.23.x — same behavior as today.

  • Unblocks future Go upgrades: version upgrades will work automatically without needing to update this workflow.

@anishb-ms anishb-ms marked this pull request as ready for review April 29, 2026 09:17
@bsardo bsardo self-assigned this Apr 29, 2026
@anishb-ms anishb-ms requested review from SyntaxNode and bsardo May 4, 2026 09:10
@bsardo bsardo changed the title Fix Adapter Code Coverage workflow to support Go version upgrades Adapter Code Coverage workflow: Support Go version upgrades May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants