Skip to content

ci: test latest two Go releases explicitly - #329

Merged
yizha1 merged 2 commits into
notaryproject:mainfrom
cshung:users/yinghungau/go-ci-matrix
Dec 1, 2026
Merged

yizha1 merged 2 commits into
notaryproject:mainfrom
cshung:users/yinghungau/go-ci-matrix

Conversation

@cshung

@cshung cshung commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Test the latest stable Go release and the previous release explicitly in the
shared build and CodeQL workflows: currently Go 1.27 and Go 1.26.

  • Replace the Go 1.23/1.24 default matrix with 1.26.x and 1.27.x, retaining check-latest: true so setup-go selects the latest patch of each series.
  • Add an optional JSON go-versions input so callers can override the default matrix when needed.
  • Set GOTOOLCHAIN=local so a matrix job cannot silently download and test a different Go version.
  • Print the effective Go version, toolchain setting, and GOROOT before testing or analysis.

No module minimum, dependency, JWT, or production code changes are included.
The default matrix should be rolled forward when a new stable Go series is released.

Motivation

The shared workflows currently install Go 1.23/1.24. For callers requiring a
newer compiler, automatic toolchain switching can make both jobs test the same
newer compiler while their labels still suggest older-version coverage.

For example, notaryproject/notation-go#598 installed Go 1.24 but actually ran
Go 1.26.0, hitting the switched-toolchain coverage bug
golang/go#75031.
Installing the current patch explicitly avoids relying on that old toolchain.

Because callers consume these reusable workflows via @main, merging this PR
changes their default compiler matrix too. The version override allows an
explicit caller-specific matrix; disabling automatic switching makes incompatible
module requirements fail visibly rather than invalidating the advertised matrix.

Related work and merge order

Validation

  • actionlint passed for both reusable workflows and their local build/CodeQL callers.
  • Full notation-go #598 race/coverage suites passed with explicit Go 1.26.11 and Go 1.27.4 toolchains and GOTOOLCHAIN=local.
  • Core's full race/coverage suites reproduced only the existing DigiCert certificate-subject failure on both compilers; the same assertion also fails with Go 1.24.0.
  • An older installed compiler correctly rejected notation-go's Go 1.26 module requirement with GOTOOLCHAIN=local, rather than silently switching.
  • The workflow diff preserves the existing CRLF line endings; git diff --check passes with core.whitespace=cr-at-eol.

GitHub-hosted workflow execution and CodeQL analysis have not been validated locally.

Default the shared build and CodeQL matrices to Go 1.26.x and 1.27.x,
selecting the latest patch of each series. Allow callers to override
the matrix through a JSON go-versions input.

Disable automatic toolchain switching and print the selected compiler
so matrix labels reflect the versions actually used for validation.
Keep module requirements and dependencies unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a297bdb-d8ae-492d-bae7-d555afa73630
Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the shared build and CodeQL workflow updates that make Go toolchain selection explicit.

No open issues 🎉

What changed in this PR

Updates the shared build and CodeQL workflows to explicitly test Go 1.26 and 1.27, preventing automatic toolchain switching from masking which compiler each job uses. Callers inherit the new defaults without changes to module requirements or production code.

Changes:

  • Default both matrices to 1.26.x and 1.27.x, retain latest-patch selection, and add an optional JSON go-versions override.
  • Set GOTOOLCHAIN=local so incompatible module requirements fail rather than silently switching compilers.
  • Log the effective Go version, toolchain setting, and GOROOT before testing or analysis.
File Description
.github/​workflows/​reusable-codeql.yml Adds configurable Go versions, disables toolchain switching, and logs toolchain details before analysis.
.github/​workflows/​reusable-build.yml Applies the same matrix controls and toolchain diagnostics to unit-test jobs.

Review effort: Balanced

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.96%. Comparing base (7c62b47) to head (e1bc78a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #329      +/-   ##
==========================================
+ Coverage   92.60%   94.96%   +2.36%     
==========================================
  Files          30       30              
  Lines        1947     1947              
==========================================
+ Hits         1803     1849      +46     
  Misses         98       98              
+ Partials       46        0      -46     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yizha1 yizha1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yizha1
yizha1 merged commit 6f6883e into notaryproject:main Dec 1, 2026
9 checks passed
@cshung
cshung deleted the users/yinghungau/go-ci-matrix branch December 2, 2026 01:09
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.

4 participants