Files
Boshen 17a3aad5a7 perf(ci): parallelize independent workflow steps (#27476)
## Summary

- run independent setup, cache, artifact, and release preparation steps in parallel
- keep producer/consumer chains and shared-cache operations sequential
- apply grouping-only changes across CI, maintenance, and release workflows
- pin security-action v1.0.9 and restrict GitHub App tokens to required permissions
- use dedicated `$/.github/...` references for local actions and workflows

## CI timing

Measured from GitHub job timestamps on 2026-10-09. Setup-stage comparisons are used where the test workload differs between runs.

| Path | Sequential | Parallel | Difference |
| --- | ---: | ---: | ---: |
| Autofix job | 75–78 s | 51 s | 24–27 s faster (32–35%) |
| NAPI Compiler setup | 52 s | 36 s | 16 s faster (31%) |
| Codegen setup | 53 s | 38 s | 15 s faster (28%) |
| Lexer setup | 40–42 s | 26–28 s | 14 s faster (33–35%) |

The lexer baseline is the sum of the same run child-step durations; the other rows compare parallel runs with sequential workflow runs.

The [latest CI workflow](https://github.com/oxc-project/oxc/actions/runs/37891107675) completed in 5m24s. Its unchanged WASM job was the critical path at 5m08s, so this run demonstrates lower affected-job latency and runner time, but no material end-to-end workflow reduction.

Timing sources: [parallel autofix](https://github.com/oxc-project/oxc/actions/runs/37891107670), [sequential autofix A](https://github.com/oxc-project/oxc/actions/runs/37891199647), [sequential autofix B](https://github.com/oxc-project/oxc/actions/runs/37891193640), [sequential NAPI Compiler](https://github.com/oxc-project/oxc/actions/runs/37846341918), and [sequential Codegen](https://github.com/oxc-project/oxc/actions/runs/37815684125).

## Validation

- parsed every changed workflow as YAML
- verified all 31 parallel groups contain valid steps
- compared flattened workflows against main to confirm no steps or settings changed
- ran `zizmor .github` with zero findings
- passed the Security Analysis workflow
- ran `git diff --check`

Uses the GitHub Actions parallel steps feature: https://github.blog/changelog/2026-06-25-actions-steps-can-now-be-run-in-parallel/

## AI assistance

AI assistance was used to audit, implement, validate, and measure these workflow changes. The contributor remains responsible for reviewing and understanding the changes before merge.
2026-10-09 06:24:44 +00:00

70 lines
2.0 KiB
YAML

name: Release Crates
permissions: {}
on:
workflow_dispatch:
push:
branches:
- main
paths:
- crates/oxc/Cargo.toml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
if: github.repository == 'oxc-project/oxc'
name: Release crates
runs-on: ubuntu-latest
environment: crates
permissions:
contents: write # For git tag push
id-token: write # Required for OIDC token exchange
steps:
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
client-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0 # for changelog
persist-credentials: true
- uses: oxc-project/setup-rust@3d6fb132fbe7cdcb66bf8ec193911c2945369d12 # v1.0.17
with:
cache-key: warm
tools: cargo-release-oxc
- run: cargo ck
- name: Generate changelog
run: |
mkdir -p target
cargo release-oxc changelog --release crates
- uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
id: auth
- name: Run
id: run
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: |
cargo release-oxc publish --release crates
echo "TAG=$(cat ./target/CRATES_VERSION)" >> $GITHUB_OUTPUT
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
GIT_TAG: ${{ steps.run.outputs.TAG }}
GIT_TARGET: ${{ github.sha }}
TITLE: "oxc ${{ steps.run.outputs.TAG }}"
run: gh release create ${GIT_TAG} --latest=false --title "${TITLE}" --notes-file ./target/CRATES_CHANGELOG --target ${GIT_TARGET}