mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
rustup show always install the profiles set in rust-toolchain.toml, I added an action to remove this line so we can install components selectively. This should reduce Rust installation time, which can be significant on Windows.
130 lines
2.6 KiB
YAML
130 lines
2.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
paths:
|
|
- 'crates/**'
|
|
- 'tasks/**'
|
|
- 'Cargo.toml'
|
|
- 'Cargo.lock'
|
|
- 'rust-toolchain.toml'
|
|
- '!**/*.md'
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'crates/**'
|
|
- 'tasks/**'
|
|
- 'Cargo.toml'
|
|
- 'Cargo.lock'
|
|
- 'rust-toolchain.toml'
|
|
- '!**/*.md'
|
|
|
|
# cancel previous job runs for the same workflow + pr
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_QUIET: true
|
|
|
|
jobs:
|
|
format:
|
|
name: Format Rust Files
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Rust Toolchain
|
|
uses: ./.github/actions/rustup
|
|
with:
|
|
minimal: false
|
|
fmt: true
|
|
|
|
- name: Run rustfmt
|
|
run: cargo fmt --all -- --check
|
|
|
|
lint:
|
|
name: Lint Rust Files
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Rust Toolchain
|
|
uses: ./.github/actions/rustup
|
|
with:
|
|
clippy: true
|
|
|
|
- name: Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: check
|
|
|
|
- name: Run cargo check
|
|
run: cargo check --workspace --all-targets --all-features --release --locked
|
|
|
|
- name: Run clippy
|
|
run: cargo lint -- -D warnings
|
|
|
|
typos:
|
|
name: Spell Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: crate-ci/typos@master
|
|
with:
|
|
files: .
|
|
|
|
check-dependencies:
|
|
name: Check Dependencies
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout PR Branch
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Rust Toolchain
|
|
uses: ./.github/actions/rustup
|
|
|
|
- name: Install cargo-udeps
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-udeps
|
|
|
|
- name: Run udeps
|
|
run: cargo udeps
|
|
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
- os: ubuntu-latest
|
|
- os: macos-latest
|
|
|
|
name: Test
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Rust Toolchain
|
|
uses: ./.github/actions/rustup
|
|
|
|
- name: Install cargo-nextest
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-nextest
|
|
|
|
- name: Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: check
|
|
|
|
- name: Build tests
|
|
run: cargo nextest run --no-run --locked
|
|
|
|
- name: Run tests
|
|
run: cargo nextest run
|