Skip to content

Reusable workflows->composite actions - #89

Draft
samuelburnham wants to merge 4 commits into
mainfrom
ci-hardening
Draft

Reusable workflows->composite actions#89
samuelburnham wants to merge 4 commits into
mainfrom
ci-hardening

Conversation

@samuelburnham

Copy link
Copy Markdown
Member

No description provided.

- Drop the GitHub App token everywhere: automation runs on the scoped
  `GITHUB_TOKEN` with job-level `permissions` blocks and fail-closed
  workflow defaults. repo-sync falls back to opening an issue asking for
  a manual sync when a push touches workflow files, which the token
  cannot write.
- Replace JasonEtco/create-an-issue and peter-evans/create-issue-from-file
  with a first-party `create-issue` action: stdlib Python around the gh
  CLI that dedupes by title and updates the existing open issue.
- Convert reusable workflows to composite actions: repo-sync,
  rust-version-check, unused-deps, links-check, typos, lints, msrv, wasm,
  codecov, gpu-ci (cuda and opencl merged behind a `gpu-framework`
  input), and gpu-bench. Keep docs and licenses-audits as reusable
  workflows since they take no configuration. Remove check-lurk-compiles
  and bench-pr-comment, superseded in ix.
- Reference sibling actions and same-repo actions with `$/`
  self-repository refs, deleting all ci-workflows self-checkouts along
  with their default-branch version skew; actionlint gets an ignore for
  its `$/` false positive (rhysd/actionlint#711), and zizmor's
  self-repository audit endorses the syntax.
- Standardize on actions-rust-lang/setup-rust-toolchain: Rust CI actions
  assume the caller provisions the toolchain and cache (or a wrapper like
  ix's), while release-pr and typos provision their own since Rust is
  incidental there. ci-env is gone; the toolchain action covers its env
  vars.
- gpu-bench reports regressions via a step output because composite
  steps silently ignore `continue-on-error`; also fix its NUM_VCPUS
  typo and release-pr's unguarded `cd`s.

Callers migrate from `uses: .../.github/workflows/<x>.yml@main` to job
steps calling `.../.github/actions/<x>@<ref>`; each action description
documents its required permissions and setup assumptions.
The github-actions ecosystem's "/" directory only covers
`.github/workflows/`, so the third-party actions that moved into
composite actions would no longer receive update PRs without listing
their directories explicitly.
- create-issue runs end-to-end against a stub `gh` on PATH that records
  its calls: the create + label path, the update-existing-by-title path,
  and rejection when both `body` and `body-file` are set, asserted
  against the recorded call log
- lints, wasm, and unused-deps run on a generated fixture crate through
  the documented caller pattern (checkout, then setup-rust-toolchain,
  then the action)
- rust-version-check runs twice against the stub `gh`: an up-to-date
  pin must not open an issue, and an outdated pin (installed so
  `rustup show` reports it as active) must open exactly one with the
  parsed version in the body
actionlint can't parse composite actions (rhysd/actionlint#46), so their
bash `run:` blocks otherwise go unchecked — the class of bug that
produced the NUM_VCPUS typo and release-pr's unguarded `cd`s. A Python
script beside the action extracts each block via `yq -o=json`, masks
`${{ }}` expressions the way actionlint does, and batches everything
through one shellcheck invocation. Both tools are preinstalled on
GitHub-hosted runners.
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