mirror of
https://github.com/swc-project/swc.git
synced 2024-12-26 07:02:28 +03:00
280 lines
6.8 KiB
YAML
280 lines
6.8 KiB
YAML
name: Cargo
|
|
|
|
on: [push, pull_request]
|
|
#on:
|
|
# push:
|
|
# # Ignore commits created by bors
|
|
# branches-ignore:
|
|
# - 'staging'
|
|
# - 'trying'
|
|
# pull_request:
|
|
# branches-ignore:
|
|
# - 'staging'
|
|
# - 'trying'
|
|
|
|
env:
|
|
CI: 1
|
|
CARGO_INCREMENTAL: 0
|
|
RUST_LOG: "debug"
|
|
SWC_CACHE_TEST: 1
|
|
|
|
jobs:
|
|
check-license:
|
|
name: Check license
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- name: Install required tools
|
|
run: |
|
|
cargo install cargo-deny
|
|
|
|
- name: Check licenses
|
|
run: |
|
|
cargo deny check
|
|
|
|
fmt:
|
|
name: fmt
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUST_LOG: "0"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
# We explicitly do this to cache properly.
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
components: rustfmt
|
|
|
|
- name: Run cargo fmt
|
|
run: cargo fmt --all -- --check
|
|
|
|
check:
|
|
name: Check
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- macos-10.15
|
|
- windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
# We explicitly do this to cache properly.
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/
|
|
target
|
|
Cargo.lock
|
|
key: cargo-dev--${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
cargo-dev--${{ runner.os }}
|
|
|
|
# Ensure that all components are compilable.
|
|
- name: Run cargo check for all targets
|
|
run: cargo check --color always --all --all-targets
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
# - macos-10.15
|
|
- windows-latest
|
|
crate:
|
|
- ast_node
|
|
- enum_kind
|
|
- from_variant
|
|
- jsdoc
|
|
- node
|
|
- string_enum
|
|
- swc
|
|
- swc_atoms
|
|
- swc_bundler
|
|
- swc_cli
|
|
- swc_common
|
|
- swc_css
|
|
- swc_css_ast
|
|
- swc_css_codegen
|
|
- swc_css_codegen_macros
|
|
- swc_css_minifier
|
|
- swc_css_parser
|
|
- swc_css_utils
|
|
- swc_css_visit
|
|
- swc_ecma_ast
|
|
- swc_ecma_codegen
|
|
- swc_ecma_codegen_macros
|
|
- swc_ecma_dep_graph
|
|
- swc_ecma_diff
|
|
- swc_ecma_ext_transforms
|
|
- swc_ecma_lints
|
|
- swc_ecma_loader
|
|
- swc_ecma_minifier
|
|
- swc_ecma_parser
|
|
- swc_ecma_preset_env
|
|
- swc_ecma_transforms
|
|
- swc_ecma_transforms_base
|
|
- swc_ecma_transforms_classes
|
|
- swc_ecma_transforms_compat
|
|
- swc_ecma_transforms_macros
|
|
- swc_ecma_transforms_module
|
|
- swc_ecma_transforms_optimization
|
|
- swc_ecma_transforms_proposal
|
|
- swc_ecma_transforms_react
|
|
- swc_ecma_transforms_testing
|
|
- swc_ecma_transforms_typescript
|
|
- swc_ecma_utils
|
|
- swc_ecma_visit
|
|
- swc_ecmascript
|
|
- swc_eq_ignore_macros
|
|
- swc_estree_ast
|
|
- swc_estree_compat
|
|
- swc_fast_graph
|
|
- swc_graph_analyzer
|
|
- swc_macros_common
|
|
- swc_node_base
|
|
- swc_node_bundler
|
|
- swc_node_comments
|
|
- swc_plugin
|
|
- swc_plugin_js_api
|
|
- swc_plugin_runner
|
|
- swc_plugin_testing
|
|
- swc_stylis
|
|
- swc_timer
|
|
- swc_visit
|
|
- swc_visit_macros
|
|
- swc_webpack_ast
|
|
- testing
|
|
- testing_macros
|
|
- wasm
|
|
exclude:
|
|
- os: windows-latest
|
|
crate: swc_node_bundler
|
|
|
|
- os: windows-latest
|
|
crate: swc_ecma_utils
|
|
|
|
- os: windows-latest
|
|
crate: swc_ecma_visit
|
|
|
|
- os: windows-latest
|
|
crate: swc_visit
|
|
|
|
- os: windows-latest
|
|
crate: swc_visit_macros
|
|
|
|
- os: windows-latest
|
|
crate: testing_macros
|
|
|
|
include:
|
|
- os: macos-latest
|
|
crate: swc_plugin_runner
|
|
|
|
steps:
|
|
- name: Handle line endings
|
|
shell: bash
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
git config --system core.autocrlf false
|
|
git config --system core.eol lf
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
# Source map format
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: "16"
|
|
cache: "yarn"
|
|
|
|
# We explicitly do this to cache properly.
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- uses: denoland/setup-deno@v1
|
|
if: matrix.crate == 'swc_bundler'
|
|
with:
|
|
deno-version: v1.x
|
|
|
|
- name: Install node dependencies
|
|
shell: bash
|
|
run: |
|
|
# This does not have any effect on windows.
|
|
npm config set prefix $HOME/npm
|
|
yarn
|
|
npm i -g jest mocha
|
|
echo $HOME
|
|
echo $HOME/npm/bin >> $GITHUB_PATH
|
|
|
|
- name: Configure path (windows)
|
|
shell: bash
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
echo 'C:\\npm\\prefix' >> $GITHUB_PATH
|
|
|
|
- name: Verify dependencies
|
|
shell: bash
|
|
run: |
|
|
jest -v && mocha --version
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/
|
|
target
|
|
Cargo.lock
|
|
key: cargo-dev--${{ runner.os }}-${{ matrix.crate }}-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
cargo-dev--${{ runner.os }}-${{ matrix.crate }}
|
|
|
|
- name: Run cargo test
|
|
run: |
|
|
jest -v && mocha --version
|
|
cargo test --color always -p ${{ matrix.crate }}
|
|
|
|
- name: Run cargo test (swc_ecma_parser)
|
|
if: matrix.crate == 'swc_ecma_parser'
|
|
run: |
|
|
cargo test --color always -p swc_ecma_parser --features verify
|
|
|
|
- name: Run cargo test (swc_ecma_transforms)
|
|
if: matrix.crate == 'swc_ecma_transforms'
|
|
run: |
|
|
cargo test --color always -p swc_ecma_transforms --all-features
|
|
|
|
- name: Run cargo test (concurrent)
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: |
|
|
./scripts/ci/test-concurrent.sh ${{ matrix.crate }}
|
|
|
|
- name: Run cargo test (swc, concurrent)
|
|
shell: bash
|
|
if: matrix.crate == 'swc' && runner.os != 'Windows'
|
|
run: |
|
|
cargo test --color always -p swc --features concurrent
|