mirror of
https://github.com/danbulant/oxc
synced 2026-05-20 04:38:54 +00:00
160 lines
3.7 KiB
YAML
160 lines
3.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
paths-ignore:
|
|
- '!**/*.md'
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: ${{ github.ref_name != 'main' }}
|
|
|
|
jobs:
|
|
cache: # Warm cache factory for all other CI jobs
|
|
name: Check and Build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
- os: ubuntu-latest
|
|
- os: macos-latest
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install cargo-nextest
|
|
uses: taiki-e/install-action@cargo-nextest
|
|
|
|
- name: Install Rust Toolchain
|
|
uses: ./.github/actions/rustup
|
|
with:
|
|
save-cache: ${{ github.ref_name == 'main' }}
|
|
|
|
# NAPI crashes nextest on windows
|
|
# https://github.com/napi-rs/napi-rs/issues/1405
|
|
- name: Build cache by Cargo Check and Cargo Test
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
cargo ck --release # for benchmark
|
|
cargo ck
|
|
cargo test run --workspace --all-targets --all-features --no-run
|
|
|
|
- name: Build cache by Cargo Check and Cargo Test
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
cargo ck --release # for benchmark
|
|
cargo ck
|
|
cargo nextest run --workspace --all-targets --all-features --no-run
|
|
|
|
typos:
|
|
name: Spell Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: crate-ci/typos@master
|
|
with:
|
|
files: .
|
|
|
|
check-dependencies:
|
|
name: Check Unused Dependencies
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
src:
|
|
- 'Cargo.lock'
|
|
|
|
- name: Install cargo-udeps
|
|
if: steps.filter.outputs.src == 'true'
|
|
uses: taiki-e/install-action@cargo-udeps
|
|
|
|
- if: steps.filter.outputs.src == 'true'
|
|
run: cargo udeps
|
|
|
|
deny:
|
|
name: Cargo Deny
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
src:
|
|
- 'Cargo.lock'
|
|
|
|
- name: Install cargo-deny
|
|
if: steps.filter.outputs.src == 'true'
|
|
uses: taiki-e/install-action@cargo-deny
|
|
|
|
- if: steps.filter.outputs.src == 'true'
|
|
run: cargo deny check
|
|
|
|
format:
|
|
name: Format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Rust
|
|
uses: ./.github/actions/rustup
|
|
with:
|
|
fmt: true
|
|
restore-cache: false
|
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
lint:
|
|
name: Clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Rust
|
|
uses: ./.github/actions/rustup
|
|
with:
|
|
clippy: true
|
|
|
|
- name: Run Clippy
|
|
run: cargo lint -- -D warnings
|
|
|
|
test:
|
|
name: Test
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
- os: ubuntu-latest
|
|
- os: macos-latest
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Rust Toolchain
|
|
uses: ./.github/actions/rustup
|
|
|
|
- name: Install cargo-nextest
|
|
uses: taiki-e/install-action@cargo-nextest
|
|
|
|
# NAPI crashes nextest on windows
|
|
# https://github.com/napi-rs/napi-rs/issues/1405
|
|
- if: runner.os == 'Windows'
|
|
run: cargo test
|
|
|
|
- if: runner.os != 'Windows'
|
|
run: cargo nextest run
|