Skip to content

Honor Go settings written with go env -w (#344) #1330

Honor Go settings written with go env -w (#344)

Honor Go settings written with go env -w (#344) #1330

name: Go patch compatibility
# Real Go releases (1.18 = first with go.work, 1.21, 1.24 = the CI pin,
# 1.26 = newest) through the hermetic hosted, vendored, go.work and
# go-patches capstones, each ending in the manifest-less VEX step. The
# suites use a file GOPROXY, so no network beyond the toolchain download.
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
# Only this ecosystem's own files. A change to shared engine code
# (vendor/, patch/, vex/, scan/, Cargo.lock, ...) runs the full matrix on
# push to main (when it is in the push filter below) or nightly, or on
# demand via workflow_dispatch on the PR branch;
# ci.yml's per-ecosystem blocking slice still runs on every PR and in
# the merge queue (#1198).
paths:
- '.github/workflows/go-compatibility.yml'
- 'crates/*/src/**/*golang*'
- 'crates/*/src/**/*golang*/**'
- 'crates/socket-patch-core/src/vendor/go*.rs'
- 'crates/socket-patch-core/src/crawlers/go_crawler.rs'
- 'crates/socket-patch-core/src/crawlers/go_crawler/**'
- 'crates/socket-patch-cli/tests/e2e_golang_*build.rs'
- 'crates/socket-patch-cli/tests/e2e_vendor_golang_build.rs'
- 'crates/socket-patch-cli/tests/golang_e2e_matrix/**'
- 'crates/socket-patch-cli/tests/e2e_vex_lockfile/golang.rs'
push:
branches: [main]
# The ecosystem's pre-#1198 relevance set (the shared engine code its
# cells run through), its PR paths and the toolchain files. A main
# push outside this set waits for the nightly run below.
paths:
- '.github/workflows/go-compatibility.yml'
- 'crates/socket-patch-core/src/vendor/go*.rs'
- 'crates/socket-patch-core/src/vendor/golang.rs'
- 'crates/socket-patch-core/src/patch/redirect/**'
- 'crates/socket-patch-core/src/crawlers/go_crawler.rs'
- 'crates/socket-patch-core/src/vex/**'
- 'crates/socket-patch-cli/src/commands/vex*.rs'
- 'crates/socket-patch-cli/src/commands/vendor*'
- 'crates/socket-patch-cli/tests/e2e_golang_*build.rs'
- 'crates/socket-patch-cli/tests/e2e_vendor_golang_build.rs'
- 'crates/socket-patch-cli/tests/golang_e2e_matrix/**'
- 'crates/socket-patch-cli/tests/e2e_vex_lockfile/golang.rs'
- 'crates/socket-patch-cli/tests/vex_e2e_common/**'
- 'crates/*/src/**/*golang*'
- 'crates/*/src/**/*golang*/**'
- 'crates/socket-patch-core/src/crawlers/go_crawler/**'
- 'Cargo.lock'
- 'Cargo.toml'
- 'crates/*/Cargo.toml'
- 'rust-toolchain.toml'
- '.cargo/**'
schedule:
# Nightly full matrix, so a main change outside the push filter
# still gets a run within a day.
- cron: '17 4 * * *'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: go-compat-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
SOCKET_NO_CONFIG: '1'
SOCKET_NO_UPDATE_CHECK: '1'
SOCKET_TELEMETRY_DISABLED: '1'
jobs:
go:
if: github.event.pull_request.draft != true
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
go: ['1.18.10', '1.21.13', '1.24.13', '1.26.3']
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps: &go-steps
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- run: rustup show
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: dev-${{ matrix.os }}
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ matrix.go }}
cache: false
- name: Real-go hosted + vendored flows with manifest-less VEX
env:
SOCKET_PATCH_GO_E2E_VERSION: ${{ matrix.go }}
SOCKET_PATCH_GO_E2E_REQUIRED: '1'
# The hermetic manifest-less VEX cells are the `golang::` module of
# the shared `e2e_vex_lockfile` binary; its filter goes in a second
# command so it does not also filter the build suites' tests.
run: |
cargo test -p socket-patch-cli --no-fail-fast \
--test e2e_golang_hosted_build --test e2e_vendor_golang_build \
--test e2e_golang_build --test e2e_golang_workspace_build -- --nocapture
cargo test -p socket-patch-cli --test e2e_vex_lockfile -- golang:: --nocapture
# The macOS rows of `go`: they run on push to main (and nightly
# where scheduled), not on every PR push, so PRs stop queueing on the
# small macOS runner pool.
go-macos:
if: github.event_name != 'pull_request'
strategy:
fail-fast: false
matrix:
os: [macos-latest]
# macOS-latest dyld refuses binaries without LC_UUID (Go < 1.24
# linkers; see ci.yml's vexctl step).
go: ['1.24.13', '1.26.3']
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps: *go-steps