feat(editor): add oxc.fmt.experimental
flag
#56382
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
permissions: {} | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize] | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: ${{ github.ref_name != 'main' }} | |
jobs: | |
test-ubuntu: | |
name: Test Linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
with: | |
save-cache: ${{ github.ref_name == 'main' }} | |
cache-key: warm | |
- run: cargo ck | |
- run: cargo test --workspace --all-features --exclude website | |
- run: cargo test -p website # Run separately to avoid feature unification problems with `oxlint` | |
- run: git diff --exit-code # Must commit everything | |
test-ubuntu-aarch64: | |
if: ${{ github.ref_name == 'main' }} | |
name: Test Linux ARM64 | |
runs-on: ubuntu-24.04-arm | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
with: | |
save-cache: ${{ github.ref_name == 'main' }} | |
cache-key: warm-aarch64 | |
- run: cargo ck | |
- run: cargo test --workspace --all-features --exclude website | |
- run: cargo test -p website # Run separately to avoid feature unification problems with `oxlint` | |
- run: git diff --exit-code # Must commit everything | |
test-mac: # Separate job to save a job on PRs | |
if: ${{ github.ref_name == 'main' }} | |
name: Test Mac | |
runs-on: macos-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
with: | |
save-cache: ${{ github.ref_name == 'main' }} | |
cache-key: warm | |
- run: cargo ck | |
- run: cargo test --workspace --all-features --exclude website | |
- run: cargo test -p website # Run separately to avoid feature unification problems with `oxlint` | |
- run: git diff --exit-code # Must commit everything | |
test-windows: | |
if: ${{ github.ref_name == 'main' }} | |
name: Test Windows | |
runs-on: windows-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
# Unsung heroes of the internet, who led me here to speed up Windows' slowness: | |
# https://github.com/actions/cache/issues/752#issuecomment-1847036770 | |
# https://github.com/astral-sh/uv/blob/502e04200d52de30d3159894833b3db4f0d6644d/.github/workflows/ci.yml#L158 | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
- uses: samypr100/setup-dev-drive@750bec535eb7e4833d6a4c86c5738751f9887575 # v3.4.2 | |
with: | |
workspace-copy: true | |
drive-size: 8GB | |
drive-format: NTFS | |
env-mapping: | | |
CARGO_HOME,{{ DEV_DRIVE }}/.cargo | |
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup | |
- name: Install Rust | |
working-directory: ${{ env.DEV_DRIVE_WORKSPACE }} | |
shell: bash | |
run: | | |
# This `awk` command will find the value of our Minimum Supported Rust Version and store it as `MSRV`. | |
# NOTE: this will fail if there are any other items named `rust-version`. We assume there is only one in our `Cargo.toml`. | |
MSRV=$(awk -F'=' '/rust-version/ {gsub(/[" ]/, "", $2); printf "%s", ($2 + "")}' Cargo.toml) | |
# Set profile to minimal and channel to our Minimum Supported Rust Version. | |
# Running our tests on this channel ensures that our code uses APIs that are supported in our `MSRV`. | |
sed -i -e 's/profile = "default"/profile = "minimal"/g' -e "s/channel = .*/channel = \"$MSRV\"/g" rust-toolchain.toml | |
rustup set profile minimal | |
rustup show | |
git restore . | |
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 | |
with: | |
workspaces: ${{ env.DEV_DRIVE_WORKSPACE }} | |
save-if: ${{ github.ref_name == 'main' }} | |
shared-key: windows-latest | |
- name: Run tests | |
# No need for `cargo ck` because it's already checked in linux | |
# Run `website` tests separately to avoid feature unification problems with `oxlint` | |
run: | | |
cargo test --workspace --all-features --exclude website | |
cargo test -p website | |
working-directory: ${{ env.DEV_DRIVE_WORKSPACE }} | |
shell: bash | |
test-big-endian: | |
if: ${{ github.ref_name == 'main' }} | |
name: Test big-endian # s390x-unknown-linux-gnu is a big-endian | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
with: | |
save-cache: ${{ github.ref_name == 'main' }} | |
cache-key: s390x-unknown-linux-gnu | |
tools: cross | |
- run: cross test --workspace --all-features --exclude website --target s390x-unknown-linux-gnu | |
# Run separately to avoid feature unification problems with `oxlint` | |
- run: cross test -p website --target s390x-unknown-linux-gnu | |
test-wasm32-wasip1-threads: | |
name: Test wasm32-wasip1-threads | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
filters: | | |
src: | |
- '!crates/oxc_linter/**' | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
if: steps.filter.outputs.src == 'true' | |
with: | |
cache-key: wasi | |
save-cache: ${{ github.ref_name == 'main' }} | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
if: steps.filter.outputs.src == 'true' | |
- name: Build | |
if: steps.filter.outputs.src == 'true' | |
run: | | |
rustup target add wasm32-wasip1-threads | |
pnpm napi build --target wasm32-wasip1-threads --cwd ./napi/parser | |
pnpm napi build --target wasm32-wasip1-threads --cwd ./napi/transform | |
pnpm napi build --target wasm32-wasip1-threads --cwd ./napi/minify | |
git diff --exit-code # Must commit everything | |
- name: Test wasi in browser | |
if: steps.filter.outputs.src == 'true' | |
working-directory: napi/parser | |
run: | | |
rm -rf *.wasm | |
pnpm exec playwright install chromium | |
pnpm run build-wasi | |
pnpm run build-npm-dir | |
pnpm run test-browser | |
pnpm build-browser-bundle --npmDir npm-dir | |
test-napi: | |
name: Test NAPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
predicate-quantifier: "every" | |
filters: | | |
src: | |
- '!crates/oxc_linter/**' | |
- '!crates/oxc_language_server/**' | |
- '!editors/**' | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
if: steps.filter.outputs.src == 'true' | |
with: | |
cache-key: napi | |
save-cache: ${{ github.ref_name == 'main' }} | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
if: steps.filter.outputs.src == 'true' | |
- uses: ./.github/actions/clone-submodules | |
if: steps.filter.outputs.src == 'true' | |
with: | |
babel: false | |
prettier: false | |
- if: steps.filter.outputs.src == 'true' | |
name: Run tests in workspace | |
env: | |
RUN_RAW_TESTS: "true" | |
run: | | |
rustup target add wasm32-wasip1-threads | |
pnpm run build-test | |
pnpm run test | |
- if: steps.filter.outputs.src == 'true' | |
name: Run e2e tests | |
run: | | |
pnpm install --frozen-lockfile | |
pnpm run test | |
working-directory: tasks/e2e | |
- if: steps.filter.outputs.src == 'true' | |
run: | | |
git diff --exit-code # Must commit everything | |
typos: | |
name: Spell Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: crate-ci/typos@85f62a8a84f939ae994ab3763f01a0296d61a7ee # v1.36.2 | |
with: | |
files: . | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
with: | |
save-cache: ${{ github.ref_name == 'main' }} | |
cache-key: clippy | |
components: clippy rust-docs | |
- run: cargo lint -- -D warnings | |
- run: cargo lint --profile dev-no-debug-assertions -- -D warnings | |
- run: RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items | |
- run: node --run lint | |
conformance: | |
name: Conformance | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
predicate-quantifier: "every" | |
filters: | | |
src: | |
- '!.github/**' | |
- '!.vscode/**' | |
- '!apps/**' | |
- '!editors/**' | |
- '!napi/**' | |
- '!npm/**' | |
- '!crates/oxc_linter/**' | |
- '!crates/oxc_language_server/**' | |
- '!tasks/**' | |
- uses: ./.github/actions/clone-submodules | |
if: steps.filter.outputs.src == 'true' | |
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
if: steps.filter.outputs.src == 'true' | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
if: steps.filter.outputs.src == 'true' | |
with: | |
cache-key: conformance | |
save-cache: ${{ github.ref_name == 'main' }} | |
tools: just | |
- name: Check Conformance | |
if: steps.filter.outputs.src == 'true' | |
run: | | |
just update-transformer-fixtures | |
just coverage | |
git diff --exit-code | |
minification: | |
name: Minification Size | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
filters: | | |
src: | |
- '.github/workflows/ci.yml' | |
- 'crates/oxc_minifier/**' | |
- 'crates/oxc_codegen/**' | |
- 'tasks/minsize/**' | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
if: steps.filter.outputs.src == 'true' | |
with: | |
cache-key: minsize | |
save-cache: ${{ github.ref_name == 'main' }} | |
- name: Check minification size | |
if: steps.filter.outputs.src == 'true' | |
run: | | |
cargo minsize | |
git diff --exit-code | |
allocs: | |
name: Allocations | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
filters: | | |
src: | |
- '.github/workflows/ci.yml' | |
- 'crates/oxc_ast/**' | |
- 'crates/oxc_data_structures/**' | |
- 'crates/oxc_parser/**' | |
- 'crates/oxc_minifier/**' | |
- 'crates/oxc_mangler/**' | |
- 'crates/oxc_allocator/**' | |
- 'tasks/track_memory_allocations/**' | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
if: steps.filter.outputs.src == 'true' | |
with: | |
cache-key: allocs | |
save-cache: ${{ github.ref_name == 'main' }} | |
- name: Check allocations | |
if: steps.filter.outputs.src == 'true' | |
run: | | |
cargo allocs | |
git diff --exit-code || | |
(echo 'Allocations have changed. Run the `cargo allocs` command to update the allocation snapshot, otherwise please fix the regression.' && exit 1) | |
ast_changes: | |
name: AST Changes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
filters: ".github/generated/ast_changes_watch_list.yml" | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
if: steps.filter.outputs.src == 'true' | |
with: | |
components: rustfmt | |
tools: dprint | |
cache-key: ast_changes | |
save-cache: ${{ github.ref_name == 'main' }} | |
- name: Restore dprint plugin cache | |
if: steps.filter.outputs.src == 'true' | |
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
key: dprint-${{ hashFiles('dprint.json') }} | |
path: ~/.cache/dprint | |
- name: Check AST Changes | |
if: steps.filter.outputs.src == 'true' | |
run: | | |
cargo run -p oxc_ast_tools | |
git diff --exit-code || | |
(echo 'AST changes caused the "generated" code to get outdated. Have you forgotten to run the `just ast` command and/or commit generated codes?' && exit 1) | |
lintgen: | |
name: Linter changes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
filters: | | |
src: | |
- '.github/workflows/ci.yml' | |
- 'crates/oxc_linter/**' | |
- 'tasks/linter_codegen/**' | |
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 | |
if: steps.filter.outputs.src == 'true' | |
with: | |
components: rustfmt | |
cache-key: lintgen | |
save-cache: ${{ github.ref_name == 'main' }} | |
- name: Check linter changes | |
if: steps.filter.outputs.src == 'true' | |
run: | | |
cargo lintgen | |
git diff --exit-code || | |
(echo 'Linter codegen has changed. Run the `cargo lintgen` command to update the linter code generated and commit it.' && exit 1) |