mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 11:11:30 +03:00
857 lines
27 KiB
YAML
857 lines
27 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
types: ["opened", "reopened", "synchronize"]
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
CI: 1
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_TERM_COLOR: "always"
|
|
DIFF: 0
|
|
# For faster CI
|
|
RUST_LOG: "off"
|
|
# https://github.com/swc-project/swc/pull/3742
|
|
RUST_MIN_STACK: 4194304
|
|
|
|
jobs:
|
|
cargo-fmt:
|
|
name: Cargo fmt
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUST_LOG: "0"
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
# We explicitly do this to cache properly.
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
components: rustfmt
|
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
cargo-clippy:
|
|
name: Cargo clippy
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
components: clippy
|
|
|
|
- run: cargo clippy --all --all-targets -- -D warnings
|
|
|
|
cargo-crev:
|
|
name: Cargo crev
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- name: Remove unrelated
|
|
run: |
|
|
rm -rf packages
|
|
rm -rf tests
|
|
ls -al
|
|
|
|
- name: Install cargo-crev
|
|
uses: baptiste0928/cargo-install@v1.1.0
|
|
with:
|
|
crate: cargo-crev
|
|
version: "0.23.1"
|
|
|
|
- name: Configure cargo-crev
|
|
run: |
|
|
git config --global user.name 'SWC bot'
|
|
git config --global user.email 'bot@swc.rs'
|
|
|
|
cargo crev trust --level high https://github.com/kdy1/crev-proofs
|
|
cargo crev repo fetch all
|
|
|
|
- name: Check dependencies
|
|
run: |
|
|
./scripts/crev/verify.sh
|
|
|
|
cargo-deny:
|
|
name: Check license of dependencies
|
|
runs-on: ubuntu-latest
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- name: Install cargo-deny
|
|
uses: baptiste0928/cargo-install@v1.1.0
|
|
with:
|
|
crate: cargo-deny
|
|
version: "0.11.3"
|
|
|
|
- name: Check licenses
|
|
run: |
|
|
cargo deny check
|
|
|
|
cargo-check:
|
|
name: Check
|
|
runs-on: ${{ matrix.os }}
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- macos-latest
|
|
- windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
# We explicitly do this to cache properly.
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
# MSRV is current stable for ES crates and nightly for other languages
|
|
# toolchain: stable
|
|
# override: true
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "18"
|
|
cache: "yarn"
|
|
|
|
- name: Install node dependencies
|
|
shell: bash
|
|
run: |
|
|
corepack enable
|
|
yarn
|
|
|
|
# Ensure that all components are compilable.
|
|
- name: Run cargo check for all targets
|
|
run: cargo check --all --all-targets
|
|
|
|
test-wasm:
|
|
name: Test wasm
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
# We explicitly do this to cache properly.
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- name: Patch
|
|
shell: bash
|
|
run: |
|
|
echo '[patch.crates-io]' >> bindings/Cargo.toml
|
|
./scripts/cargo/patch-section.sh >> bindings/Cargo.toml
|
|
cd bindings && cargo update -p swc_core
|
|
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "18"
|
|
cache: "yarn"
|
|
|
|
- name: Install node dependencies
|
|
shell: bash
|
|
run: |
|
|
corepack enable
|
|
yarn
|
|
|
|
- name: Build
|
|
run: |
|
|
(cd bindings/binding_core_wasm && ./scripts/build.sh --features plugin)
|
|
|
|
- name: Test
|
|
run: |
|
|
(cd bindings/binding_core_wasm && ./scripts/test.sh)
|
|
|
|
cargo-test:
|
|
name: Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }}
|
|
runs-on: ${{ matrix.settings.runner }}
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
settings:
|
|
# Use scripts/github/create-matrix.sh to create this.
|
|
- crate: ast_node
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: better_scoped_tls
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: binding_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: dbg-swc
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: from_variant
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: jsdoc
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: preset_env_base
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: string_enum
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps --exclude-features debug --exclude-features plugin --exclude-features plugin_transform_schema_v1 --exclude-features plugin_transform_schema_vtest --exclude-features plugin-bytecheck
|
|
- crate: swc
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_atoms
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_bundler
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_cached
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_common
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps --exclude-features plugin_transform_schema_vtest --exclude-features __plugin --exclude-features __plugin_mode --exclude-features __plugin_rt --exclude-features __rkyv --exclude-features plugin-bytecheck-base --exclude-features plugin-bytecheck-mode --exclude-features plugin-bytecheck-rt --exclude-features rkyv-bytecheck-impl --exclude-features rkyv-impl
|
|
- crate: swc_common
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_config
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_config_macro
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_core
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_ast
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_codegen
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_codegen
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_css_codegen_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_compat
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_lints
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_minifier
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_modules
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_parser
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_parser
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_css_prefixer
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_utils
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_css_visit
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_ast
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps --exclude-features __rkyv --exclude-features rkyv-bytecheck-impl
|
|
- crate: swc_ecma_codegen
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_codegen
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_ecma_codegen_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_dep_graph
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_ext_transforms
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_lints
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_loader
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_ecma_loader
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_ecma_minifier
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_parser
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_parser
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_ecma_preset_env
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_preset_env
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_ecma_quote
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_quote_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_testing
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_transforms
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_ecma_transforms_base
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_ecma_transforms_classes
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_transforms_compat
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_ecma_transforms_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_transforms_module
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_transforms_module
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_ecma_transforms_optimization
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_ecma_transforms_proposal
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_transforms_react
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_transforms_testing
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_transforms_testing
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_ecma_transforms_typescript
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_ecma_utils
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_ecma_visit
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo hack check --feature-powerset --no-dev-deps
|
|
- crate: swc_ecmascript
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_eq_ignore_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_error_reporters
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_estree_ast
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_estree_compat
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_fast_graph
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_graph_analyzer
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html_ast
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html_codegen
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html_codegen
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_html_codegen_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html_minifier
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html_parser
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html_parser
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_html_utils
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_html_visit
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_macros_common
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_node_base
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_node_bundler
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
check: |
|
|
cargo check
|
|
cargo check --no-default-features --features swc_v2
|
|
- crate: swc_node_bundler
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_node_comments
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_nodejs_common
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_plugin
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_plugin
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_plugin_macro
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_plugin_proxy
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_plugin_runner
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_plugin_runner
|
|
os: macos-latest
|
|
runner: macos-latest
|
|
- crate: swc_plugin_runner
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_plugin_testing
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_plugin_testing
|
|
os: windows-latest
|
|
runner: windows-latest
|
|
- crate: swc_timer
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_trace_macro
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_visit
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_visit_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_xml
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_xml_ast
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_xml_codegen
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_xml_codegen_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_xml_parser
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: swc_xml_visit
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: testing
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
- crate: testing_macros
|
|
os: ubuntu-latest
|
|
runner: ubuntu-latest
|
|
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@v3
|
|
with:
|
|
submodules: true
|
|
|
|
# Source map format
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "18"
|
|
cache: "yarn"
|
|
|
|
# We explicitly do this to cache properly.
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
target: wasm32-wasi
|
|
# MSRV is current stable for ES crates and nightly for other languages
|
|
# toolchain: stable
|
|
# override: true
|
|
|
|
- uses: denoland/setup-deno@v1
|
|
if: matrix.settings.crate == 'swc_bundler'
|
|
with:
|
|
deno-version: v1.x
|
|
|
|
- name: Install node dependencies
|
|
shell: bash
|
|
run: |
|
|
yarn
|
|
# I don't want to think deeply about this
|
|
yarn global add jest@27 mocha || \
|
|
yarn global add jest@27 mocha || \
|
|
yarn global add jest@27 mocha || \
|
|
yarn global add jest@27 mocha || \
|
|
yarn global add jest@27 mocha || \
|
|
yarn global add jest@27 mocha || \
|
|
yarn global add jest@27 mocha || \
|
|
yarn global add jest@27 mocha || true
|
|
|
|
- name: Configure path (windows)
|
|
shell: bash
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
echo $(yarn global bin) >> $GITHUB_PATH
|
|
|
|
- name: Verify dependencies
|
|
shell: bash
|
|
run: |
|
|
jest --version && mocha --version
|
|
|
|
- name: Cache rust artifacts
|
|
uses: Swatinem/rust-cache@v2
|
|
if: matrix.settings.crate == 'swc' || matrix.settings.crate == 'swc_plugin_runner'
|
|
with:
|
|
shared-key: cargo-test-${{ matrix.settings.crate }}
|
|
cache-on-failure: true
|
|
|
|
- name: Configure execution cache
|
|
shell: bash
|
|
run: |
|
|
mkdir -p .swc-exec-cache
|
|
echo "SWC_ECMA_TESTING_CACHE_DIR=$(pwd)/.swc-exec-cache" >> $GITHUB_ENV
|
|
|
|
- name: Cache execution results
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
.swc-exec-cache
|
|
key: swc-exec-cache-${{ runner.os }}-${{ matrix.settings.crate }}-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
swc-exec-cache-${{ matrix.settings.crate }}-${{ runner.os }}
|
|
|
|
- name: Run cargo test
|
|
if: matrix.settings.crate != 'swc_plugin_runner' && matrix.settings.crate != 'swc_ecma_minifier' && matrix.settings.crate != 'swc_core' && matrix.settings.crate != 'swc_ecma_quote' && matrix.settings.crate != 'swc_cli' && matrix.settings.crate != 'binding_core_wasm'
|
|
run: |
|
|
cargo test -p ${{ matrix.settings.crate }}
|
|
|
|
- name: Run cargo test (core)
|
|
if: matrix.settings.crate == 'swc_core'
|
|
run: |
|
|
rustup target add wasm32-unknown-unknown
|
|
cargo test -p swc_core --features ecma_quote --features common --features ecma_utils
|
|
|
|
- name: Run cargo test (binding_core_wasm)
|
|
if: matrix.settings.crate == 'binding_core_wasm'
|
|
run: |
|
|
cargo test --manifest-path ./bindings/binding_core_wasm/Cargo.toml
|
|
|
|
- name: Run cargo test (cli)
|
|
if: matrix.settings.crate == 'swc_cli'
|
|
run: |
|
|
cargo test --manifest-path ./bindings/swc_cli/Cargo.toml --features plugin
|
|
|
|
- name: Run cargo test (plugin)
|
|
if: matrix.settings.crate == 'swc_plugin_runner'
|
|
run: |
|
|
# export CARGO_TARGET_DIR=$(pwd)/target
|
|
cargo test -p swc_plugin_runner --release --features plugin_transform_schema_v1 --features rkyv-impl --features ecma --features css
|
|
|
|
- name: Run cargo test (swc_ecma_minifier)
|
|
if: matrix.settings.crate == 'swc_ecma_minifier'
|
|
run: |
|
|
cargo test -p swc_ecma_minifier --features concurrent
|
|
|
|
- name: Run cargo test (all features)
|
|
if: matrix.settings.crate == 'swc_ecma_parser' || matrix.settings.crate == 'swc_ecma_loader' || matrix.settings.crate == 'swc_ecma_transforms'
|
|
run: |
|
|
cargo test -p ${{ matrix.settings.crate }} --all-features
|
|
|
|
- name: Run cargo test (concurrent)
|
|
if: runner.os == 'Linux' && matrix.settings.crate != 'swc_ecma_minifier'
|
|
shell: bash
|
|
env:
|
|
SWC_FORCE_CONCURRENT: "1"
|
|
run: |
|
|
./scripts/ci/test-concurrent.sh ${{ matrix.settings.crate }}
|
|
|
|
- name: Run cargo test (swc, concurrent)
|
|
shell: bash
|
|
if: matrix.settings.crate == 'swc' && runner.os == 'Linux'
|
|
env:
|
|
SWC_FORCE_CONCURRENT: "1"
|
|
run: |
|
|
cargo test -p swc --features concurrent
|
|
|
|
- name: Install cargo-hack
|
|
uses: baptiste0928/cargo-install@v1.1.0
|
|
if: matrix.settings.os == 'ubuntu-latest' && matrix.settings.check
|
|
with:
|
|
crate: cargo-hack
|
|
version: "0.5.7"
|
|
|
|
- name: Check compilation
|
|
if: matrix.settings.check
|
|
working-directory: "crates/${{ matrix.settings.crate }}"
|
|
run: "${{ matrix.settings.check }}"
|
|
|
|
node-test:
|
|
name: Test node bindings - ${{ matrix.os }}
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- windows-latest
|
|
- macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
# We explicitly do this to cache properly.
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: "yarn"
|
|
|
|
- name: Patch
|
|
shell: bash
|
|
run: |
|
|
echo '[patch.crates-io]' >> bindings/Cargo.toml
|
|
./scripts/cargo/patch-section.sh
|
|
./scripts/cargo/patch-section.sh >> bindings/Cargo.toml
|
|
cd bindings && cargo update -p swc_core
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/
|
|
**/target/
|
|
key: ${{ runner.os }}-node-api-test
|
|
|
|
- name: Set platform name
|
|
run: |
|
|
export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
|
|
echo "PLATFORM_NAME=$NODE_PLATFORM_NAME" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
- name: Prepare
|
|
run: |
|
|
rustup target add wasm32-wasi
|
|
yarn
|
|
|
|
yarn build:dev
|
|
yarn test
|
|
|
|
integration-test:
|
|
name: "Test with @swc/cli"
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 14
|
|
cache: "yarn"
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/
|
|
**/target/
|
|
key: ${{ runner.os }}-cargo-integration
|
|
|
|
- name: Set platform name
|
|
run: |
|
|
export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
|
|
echo "PLATFORM_NAME=$NODE_PLATFORM_NAME" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
- name: Patch
|
|
shell: bash
|
|
run: |
|
|
echo '[patch.crates-io]' >> bindings/Cargo.toml
|
|
./scripts/cargo/patch-section.sh >> bindings/Cargo.toml
|
|
cd bindings && cargo update -p swc_core
|
|
|
|
- name: Prepare
|
|
run: |
|
|
rustup target add wasm32-wasi
|
|
yarn
|
|
|
|
yarn build:dev
|
|
|
|
# Avoid no space left on device, copyfile
|
|
cargo clean
|
|
cargo clean --manifest-path ./bindings/binding_core_node/Cargo.toml
|
|
cargo clean --manifest-path ./bindings/binding_core_wasm/Cargo.toml
|
|
cargo clean --manifest-path ./bindings/swc_cli/Cargo.toml
|
|
|
|
yarn global add @swc/cli@0.1.56
|
|
yarn link
|
|
yarn global add file:$PWD
|
|
|
|
- name: Print info
|
|
run: |
|
|
yarn global list
|
|
|
|
- name: (swc) three.js
|
|
run: |
|
|
mkdir -p tests/integration/three-js
|
|
yarn global add qunit failonlyreporter
|
|
|
|
# Download three.js
|
|
git clone --depth 1 https://github.com/mrdoob/three.js.git -b r117 tests/integration/three-js/repo
|
|
|
|
# TODO
|
|
# swc -C isModule=unknown -C test=\".*.js$\" -C module.type=commonjs --sync tests/integration/three-js/repo/ -d tests/integration/three-js/build/
|
|
|
|
# TODO
|
|
# (cd tests/integration/three-js/build/test && qunit -r failonlyreporter unit/three.source.unit.js)
|
|
|
|
# terser: contains with statement in test
|
|
# Rome.js: I forgot the cause, but it didn't work.
|
|
# jQuery: browser only (window.document is required)
|
|
- name: (swc) redux
|
|
run: |
|
|
mkdir -p tests/integration/redux
|
|
yarn global add qunit failonlyreporter
|
|
|
|
# Download
|
|
# git clone --depth 1 https://github.com/reduxjs/redux.git -b v4.1.0 tests/integration/redux/repo
|
|
# TODO
|
|
# swc --sync tests/integration/redux/repo/src/ -d tests/integration/redux/repo/lib/
|
|
# echo "module.exports=require('./index')" > tests/integration/redux/repo/lib/redux.js
|
|
# TODO
|
|
# swc --sync tests/integration/redux/repo/src/ -d tests/integration/redux/repo/test/
|
|
# TODO
|
|
# swc --sync tests/integration/redux/repo/test/ -d tests/integration/redux/repo/test/
|
|
|
|
# TODO
|
|
# (cd tests/integration/redux/repo && yarn)
|
|
# TODO
|
|
# (cd tests/integration/redux/repo && npx jest '.*.js' --modulePathIgnorePatterns 'typescript')
|
|
- name: (swcpack) example react app
|
|
run: |
|
|
(cd crates/swc_node_bundler/tests/integration/react && yarn && npx spack)
|