Skip to content

ci: fix matrix stride, pin actions, add timeouts#643

Closed
dev-jodee wants to merge 1 commit into
mainfrom
ci/harden-workflows
Closed

ci: fix matrix stride, pin actions, add timeouts#643
dev-jodee wants to merge 1 commit into
mainfrom
ci/harden-workflows

Conversation

@dev-jodee

Copy link
Copy Markdown
Collaborator
  • Fix matrix slicing stride: jobs sliced with hardcoded
    MIN_PROJECTS_PER_JOB while the matrix was sized with the computed
    projects_per_job, silently skipping projects once a project type
    crosses 256 directories. Slicing now uses the computed value.
  • Cancel superseded in-progress runs on PR pushes (concurrency groups).
  • Add timeout-minutes to every job so a hung validator cannot run to
    the 6-hour ceiling.
  • Add least-privilege top-level permissions (contents: read).
  • Pin third-party actions (dorny/paths-filter, pnpm/action-setup,
    extractions/setup-just, heyAyushh/setup-solana,
    dtolnay/rust-toolchain) to full commit SHAs; upgrade solana-asm's
    paths-filter from v3 to the same pinned v4 used elsewhere.

Stack created with GitHub Stacks CLIGive Feedback 💬

- Fix matrix slicing stride: jobs sliced with hardcoded
  MIN_PROJECTS_PER_JOB while the matrix was sized with the computed
  projects_per_job, silently skipping projects once a project type
  crosses 256 directories. Slicing now uses the computed value.
- Cancel superseded in-progress runs on PR pushes (concurrency groups).
- Add timeout-minutes to every job so a hung validator cannot run to
  the 6-hour ceiling.
- Add least-privilege top-level permissions (contents: read).
- Pin third-party actions (dorny/paths-filter, pnpm/action-setup,
  extractions/setup-just, heyAyushh/setup-solana,
  dtolnay/rust-toolchain) to full commit SHAs; upgrade solana-asm's
  paths-filter from v3 to the same pinned v4 used elsewhere.
@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

The PR hardens and bounds CI execution while correcting dynamic matrix sharding.

  • Uses the computed projects-per-job value consistently when generating and consuming framework build matrices.
  • Adds workflow concurrency cancellation, least-privilege token permissions, and per-job timeouts.
  • Pins third-party actions to commit SHAs and aligns the ASM path filter with v4.

Confidence Score: 5/5

The PR appears safe to merge with no concrete changed-code failures identified.

The computed shard width is emitted for every buildable project count and consumed consistently, while the permission, concurrency, timeout, and action-pinning changes preserve the existing workflow paths.

Important Files Changed

Filename Overview
.github/actions/setup-anchor/action.yml Pins the Solana setup action without changing its inputs or setup flow.
.github/workflows/anchor.yml Corrects dynamic shard slicing and adds bounded, least-privilege CI execution.
.github/workflows/just.yml Adds concurrency, permissions, timeouts, and immutable third-party action references.
.github/workflows/rust.yml Bounds formatting and lint jobs and preserves the stable toolchain explicitly while pinning its action.
.github/workflows/solana-asm.yml Aligns path filtering with sibling workflows and corrects dynamic matrix slicing.
.github/workflows/solana-native.yml Corrects dynamic project sharding and adds CI hardening controls.
.github/workflows/solana-pinocchio.yml Corrects dynamic project sharding and adds CI hardening controls.
.github/workflows/typescript.yml Adds bounded, cancellable execution and pins pnpm setup.

Reviews (1): Last reviewed commit: "ci: fix matrix stride, pin actions, add ..." | Re-trigger Greptile

@dev-jodee

Copy link
Copy Markdown
Collaborator Author

Superseded by a single combined PR.

@dev-jodee dev-jodee closed this Jul 24, 2026
@dev-jodee
dev-jodee deleted the ci/harden-workflows branch July 24, 2026 15:54
dev-jodee added a commit that referenced this pull request Jul 24, 2026
…#650)

## Summary

Combined CI overhaul (supersedes the closed stack #643#647, #649). Six commits, reviewable one by one:

- **Hardening** — fix the matrix stride bug (jobs sliced with hardcoded `MIN_PROJECTS_PER_JOB` while the matrix was sized with the computed `projects_per_job`, silently skipping projects past 256 dirs of one type); cancel superseded PR runs; `timeout-minutes` on every job; top-level `permissions: contents: read`; third-party actions pinned to commit SHAs.
- **Beta → nightly** — Solana beta legs ran double the build on every PR while `continue-on-error` made them unfailable. They now run only on the nightly schedule, skip the test leg when beta setup fails, and report passed/failed/skipped explicitly in the job summary.
- **Typecheck** — nothing in CI ran `tsc` (Biome only lints; ts-mocha/tsx transpile without checking). Every build workflow now runs `tsc --noEmit` per project — after `anchor build` for anchor so generated `target/types`/`target/idl` resolve. 79 of ~100 projects failed the initial audit; all CI-covered projects were repaired (tsconfig hygiene, `@types/node`, TS 4→5 bumps, lockfile regens) including real bugs: `counter/native` called `createIncrementInstruction` with two args, `close-account/native` was missing its `borsh` dependency.
- **Caching** — pnpm store, shared cargo-registry cache, Solana toolchain cache, sbpf binary keyed on its pinned rev.
- **Repo checks** — workspace-membership ratchet: crates outside the root Cargo workspace escape fmt/clippy; `.github/.workspace-ignore` seeds the 53 current gaps and CI fails on new ones. Dependabot now covers npm (grouped, biweekly, patch-only). `typescript.yml` renamed to Lint.
- **Unified setup action** — single `.github/actions/setup` with `install-*` toggles + version inputs (pnpm/Node, Solana, Anchor, just, sbpf) and built-in caching, called by every build workflow. Absorbs the vendored setup-anchor and removes all remote `heyAyushh/setup-solana` references — that action checks out its own default branch at runtime, so even SHA-pinned it executed unpinned code. Also fixes an inherited bug that is live today: with no beta tag, `channel-info.sh`'s positional output shifts stable into the beta slot and "stable" resolves to nothing.
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.

1 participant