mirror of
https://github.com/swc-project/swc.git
synced 2024-12-01 09:52:57 +03:00
340 lines
9.6 KiB
YAML
340 lines
9.6 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
|
|
DIFF: 0
|
|
|
|
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
|
|
|
|
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 - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }}
|
|
runs-on: ${{ matrix.settings.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
settings:
|
|
# Use scripts/github/create-matrix.sh to create this.
|
|
- crate: ast_node
|
|
os: ubuntu-latest
|
|
- crate: better_scoped_tls
|
|
os: ubuntu-latest
|
|
- crate: enum_kind
|
|
os: ubuntu-latest
|
|
- crate: from_variant
|
|
os: ubuntu-latest
|
|
- crate: jsdoc
|
|
os: ubuntu-latest
|
|
- crate: node
|
|
os: ubuntu-latest
|
|
- crate: node_macro_deps
|
|
os: ubuntu-latest
|
|
- crate: preset_env_base
|
|
os: ubuntu-latest
|
|
- crate: string_enum
|
|
os: ubuntu-latest
|
|
- crate: swc
|
|
os: ubuntu-latest
|
|
- crate: swc
|
|
os: windows-latest
|
|
- crate: swc_atoms
|
|
os: ubuntu-latest
|
|
- crate: swc_bundler
|
|
os: ubuntu-latest
|
|
- crate: swc_cli
|
|
os: ubuntu-latest
|
|
- crate: swc_cli
|
|
os: windows-latest
|
|
- crate: swc_common
|
|
os: ubuntu-latest
|
|
- crate: swc_common
|
|
os: windows-latest
|
|
- crate: swc_css
|
|
os: ubuntu-latest
|
|
- crate: swc_css_ast
|
|
os: ubuntu-latest
|
|
- crate: swc_css_codegen
|
|
os: ubuntu-latest
|
|
- crate: swc_css_codegen
|
|
os: windows-latest
|
|
- crate: swc_css_codegen_macros
|
|
os: ubuntu-latest
|
|
- crate: swc_css_minifier
|
|
os: ubuntu-latest
|
|
- crate: swc_css_parser
|
|
os: ubuntu-latest
|
|
- crate: swc_css_parser
|
|
os: windows-latest
|
|
- crate: swc_css_utils
|
|
os: ubuntu-latest
|
|
- crate: swc_css_visit
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_ast
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_codegen
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_codegen
|
|
os: windows-latest
|
|
- crate: swc_ecma_codegen_macros
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_dep_graph
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_ext_transforms
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_lints
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_loader
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_loader
|
|
os: windows-latest
|
|
- crate: swc_ecma_minifier
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_parser
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_parser
|
|
os: windows-latest
|
|
- crate: swc_ecma_preset_env
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_preset_env
|
|
os: windows-latest
|
|
- crate: swc_ecma_transforms
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_base
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_classes
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_compat
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_macros
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_module
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_module
|
|
os: windows-latest
|
|
- crate: swc_ecma_transforms_optimization
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_proposal
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_react
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_testing
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_transforms_testing
|
|
os: windows-latest
|
|
- crate: swc_ecma_transforms_typescript
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_utils
|
|
os: ubuntu-latest
|
|
- crate: swc_ecma_visit
|
|
os: ubuntu-latest
|
|
- crate: swc_ecmascript
|
|
os: ubuntu-latest
|
|
- crate: swc_eq_ignore_macros
|
|
os: ubuntu-latest
|
|
- crate: swc_estree_ast
|
|
os: ubuntu-latest
|
|
- crate: swc_estree_compat
|
|
os: ubuntu-latest
|
|
- crate: swc_fast_graph
|
|
os: ubuntu-latest
|
|
- crate: swc_graph_analyzer
|
|
os: ubuntu-latest
|
|
- crate: swc_macros_common
|
|
os: ubuntu-latest
|
|
- crate: swc_node_base
|
|
os: ubuntu-latest
|
|
- crate: swc_node_bundler
|
|
os: ubuntu-latest
|
|
- crate: swc_node_bundler
|
|
os: windows-latest
|
|
- crate: swc_node_comments
|
|
os: ubuntu-latest
|
|
- crate: swc_plugin
|
|
os: ubuntu-latest
|
|
- crate: swc_plugin
|
|
os: windows-latest
|
|
- crate: swc_plugin_macro
|
|
os: ubuntu-latest
|
|
- crate: swc_plugin_runner
|
|
os: ubuntu-latest
|
|
- crate: swc_plugin_runner
|
|
os: macos-latest
|
|
- crate: swc_plugin_runner
|
|
os: windows-latest
|
|
- crate: swc_plugin_testing
|
|
os: ubuntu-latest
|
|
- crate: swc_plugin_testing
|
|
os: windows-latest
|
|
- crate: swc_stylis
|
|
os: ubuntu-latest
|
|
- crate: swc_timer
|
|
os: ubuntu-latest
|
|
- crate: swc_visit
|
|
os: ubuntu-latest
|
|
- crate: swc_visit_macros
|
|
os: ubuntu-latest
|
|
- crate: swc_webpack_ast
|
|
os: ubuntu-latest
|
|
- crate: testing
|
|
os: ubuntu-latest
|
|
- crate: testing_macros
|
|
os: ubuntu-latest
|
|
- crate: wasm
|
|
os: 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@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
|
|
target: wasm32-wasi
|
|
|
|
- uses: denoland/setup-deno@v1
|
|
if: matrix.settings.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.settings.crate }}-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
cargo-dev--${{ runner.os }}-${{ matrix.settings.crate }}
|
|
|
|
- name: Run cargo test
|
|
run: |
|
|
jest -v && mocha --version
|
|
cargo test --color always -p ${{ matrix.settings.crate }}
|
|
|
|
- name: Run cargo test (swc_ecma_parser)
|
|
if: matrix.settings.crate == 'swc_ecma_parser'
|
|
run: |
|
|
cargo test --color always -p swc_ecma_parser --features verify
|
|
|
|
- name: Run cargo test (swc_ecma_transforms)
|
|
if: matrix.settings.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.settings.crate }}
|
|
|
|
- name: Run cargo test (swc, concurrent)
|
|
shell: bash
|
|
if: matrix.settings.crate == 'swc' && runner.os != 'Windows'
|
|
run: |
|
|
cargo test --color always -p swc --features concurrent
|