2022-09-30 10:57:15 +03:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
2022-11-21 03:54:01 +03:00
|
|
|
pull_request:
|
2022-11-30 07:27:59 +03:00
|
|
|
types: ["opened", "reopened", "synchronize"]
|
2022-11-21 03:54:01 +03:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2020-01-04 07:33:25 +03:00
|
|
|
|
|
|
|
env:
|
2022-09-30 10:57:15 +03:00
|
|
|
CI: 1
|
2020-01-04 07:33:25 +03:00
|
|
|
CARGO_INCREMENTAL: 0
|
2022-09-30 10:57:15 +03:00
|
|
|
CARGO_TERM_COLOR: "always"
|
2022-02-11 11:43:48 +03:00
|
|
|
DIFF: 0
|
2022-09-30 10:57:15 +03:00
|
|
|
# For faster CI
|
|
|
|
RUST_LOG: "off"
|
2023-11-20 20:57:16 +03:00
|
|
|
# https://github.com/actions/setup-node/issues/899#issuecomment-1819151595
|
|
|
|
SKIP_YARN_COREPACK_CHECK: 1
|
2020-01-04 07:33:25 +03:00
|
|
|
|
2024-03-04 12:36:17 +03:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: "${{ github.event_name == 'pull_request' }}"
|
|
|
|
|
2020-01-04 07:33:25 +03:00
|
|
|
jobs:
|
2022-09-30 10:57:15 +03:00
|
|
|
cargo-fmt:
|
|
|
|
name: Cargo fmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
RUST_LOG: "0"
|
|
|
|
steps:
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
# 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:
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-10-31 10:59:29 +03:00
|
|
|
with:
|
|
|
|
submodules: true
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
components: clippy
|
|
|
|
|
2022-10-31 10:59:29 +03:00
|
|
|
- run: cargo clippy --all --all-targets -- -D warnings
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
cargo-deny:
|
|
|
|
name: Check license of dependencies
|
2021-03-26 18:45:51 +03:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-08 11:55:51 +03:00
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
2021-03-26 18:45:51 +03:00
|
|
|
steps:
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-03-26 18:45:51 +03:00
|
|
|
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
|
2024-07-06 07:46:41 +03:00
|
|
|
- name: Install cargo-deny
|
|
|
|
uses: taiki-e/install-action@v2
|
2022-03-15 17:17:03 +03:00
|
|
|
with:
|
2024-07-06 04:18:03 +03:00
|
|
|
tool: cargo-deny@0.14.15
|
2021-03-26 18:45:51 +03:00
|
|
|
|
|
|
|
- name: Check licenses
|
|
|
|
run: |
|
|
|
|
cargo deny check
|
|
|
|
|
2022-09-30 10:57:15 +03:00
|
|
|
cargo-check:
|
2021-03-22 13:42:42 +03:00
|
|
|
name: Check
|
|
|
|
runs-on: ${{ matrix.os }}
|
2022-05-08 11:55:51 +03:00
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
2021-03-22 13:42:42 +03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
2022-07-25 07:48:01 +03:00
|
|
|
- macos-latest
|
2021-05-10 10:18:31 +03:00
|
|
|
- windows-latest
|
2021-01-22 12:39:57 +03:00
|
|
|
steps:
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-12-27 11:32:47 +03:00
|
|
|
with:
|
|
|
|
submodules: true
|
2021-11-10 12:08:45 +03:00
|
|
|
|
2021-03-25 19:22:09 +03:00
|
|
|
# We explicitly do this to cache properly.
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-09-14 13:33:49 +03:00
|
|
|
# MSRV is current stable for ES crates and nightly for other languages
|
|
|
|
# toolchain: stable
|
|
|
|
# override: true
|
2021-03-25 19:22:09 +03:00
|
|
|
|
2024-05-18 03:23:06 +03:00
|
|
|
- run: corepack enable
|
|
|
|
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2022-03-11 15:49:53 +03:00
|
|
|
with:
|
2022-08-30 12:55:18 +03:00
|
|
|
node-version: "18"
|
2022-03-11 15:49:53 +03:00
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- name: Install node dependencies
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-05-18 03:23:06 +03:00
|
|
|
corepack enable
|
2022-03-11 15:49:53 +03:00
|
|
|
yarn
|
|
|
|
|
2021-03-22 13:42:42 +03:00
|
|
|
# Ensure that all components are compilable.
|
2021-01-22 12:39:57 +03:00
|
|
|
- name: Run cargo check for all targets
|
2022-09-24 06:33:47 +03:00
|
|
|
run: cargo check --all --all-targets
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
test-wasm:
|
|
|
|
name: Test wasm
|
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
|
|
runs-on: ubuntu-latest
|
2024-07-05 15:07:24 +03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
pkg:
|
|
|
|
- binding_core_wasm
|
|
|
|
- binding_minifier_wasm
|
|
|
|
- binding_typescript_wasm
|
2022-09-30 10:57:15 +03:00
|
|
|
steps:
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-09-30 10:57:15 +03:00
|
|
|
|
2024-05-18 03:23:06 +03:00
|
|
|
- shell: bash
|
|
|
|
run: corepack enable
|
|
|
|
|
2022-09-30 10:57:15 +03:00
|
|
|
# We explicitly do this to cache properly.
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
|
2022-11-15 08:48:57 +03:00
|
|
|
- name: Patch
|
2022-11-20 13:03:26 +03:00
|
|
|
shell: bash
|
2022-11-15 08:48:57 +03:00
|
|
|
run: |
|
|
|
|
echo '[patch.crates-io]' >> bindings/Cargo.toml
|
|
|
|
./scripts/cargo/patch-section.sh >> bindings/Cargo.toml
|
2024-07-20 22:10:35 +03:00
|
|
|
cd bindings && cargo update -p swc_core -p swc_fast_ts_strip
|
2022-11-15 08:48:57 +03:00
|
|
|
|
2022-09-30 10:57:15 +03:00
|
|
|
- name: Install wasm-pack
|
|
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2022-09-30 10:57:15 +03:00
|
|
|
with:
|
2022-11-15 03:52:44 +03:00
|
|
|
node-version: "18"
|
2022-09-30 10:57:15 +03:00
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- name: Install node dependencies
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-05-18 03:23:06 +03:00
|
|
|
corepack enable
|
2022-09-30 10:57:15 +03:00
|
|
|
yarn
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: |
|
2024-07-05 15:07:24 +03:00
|
|
|
(cd bindings/${{ matrix.pkg }} && ./scripts/test.sh)
|
2022-09-30 10:57:15 +03:00
|
|
|
|
2024-07-14 07:19:15 +03:00
|
|
|
list-cargo-tests:
|
2022-02-27 08:44:26 +03:00
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
2024-07-14 07:19:15 +03:00
|
|
|
name: List crates
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
settings: ${{ steps.list-tests.outputs.settings }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- uses: ./.github/actions/setup-node
|
|
|
|
|
|
|
|
- name: List crates
|
|
|
|
id: list-tests
|
|
|
|
run: echo "settings=$(npx zx ./scripts/github/get-test-matrix.mjs)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
cargo-test:
|
|
|
|
name: Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }}
|
|
|
|
runs-on: ${{ matrix.settings.os }}
|
|
|
|
needs:
|
|
|
|
- list-cargo-tests
|
2021-01-22 12:39:57 +03:00
|
|
|
strategy:
|
2021-02-19 09:34:22 +03:00
|
|
|
fail-fast: false
|
2021-01-22 12:39:57 +03:00
|
|
|
matrix:
|
2024-07-14 07:19:15 +03:00
|
|
|
settings: ${{fromJson(needs.list-cargo-tests.outputs.settings)}}
|
2020-01-04 07:33:25 +03:00
|
|
|
steps:
|
2021-03-22 13:42:42 +03:00
|
|
|
- name: Handle line endings
|
|
|
|
shell: bash
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
git config --system core.autocrlf false
|
|
|
|
git config --system core.eol lf
|
|
|
|
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-12-27 11:32:47 +03:00
|
|
|
with:
|
|
|
|
submodules: true
|
2020-01-04 07:33:25 +03:00
|
|
|
|
2024-05-18 03:23:06 +03:00
|
|
|
- run: corepack enable
|
|
|
|
|
2021-06-23 13:50:27 +03:00
|
|
|
# Source map format
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2021-06-23 13:50:27 +03:00
|
|
|
with:
|
2022-08-30 12:55:18 +03:00
|
|
|
node-version: "18"
|
2021-12-12 10:16:20 +03:00
|
|
|
cache: "yarn"
|
2021-06-23 13:50:27 +03:00
|
|
|
|
2021-03-25 19:22:09 +03:00
|
|
|
# We explicitly do this to cache properly.
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-01-15 07:40:00 +03:00
|
|
|
target: wasm32-wasi
|
2022-09-14 13:33:49 +03:00
|
|
|
# MSRV is current stable for ES crates and nightly for other languages
|
|
|
|
# toolchain: stable
|
|
|
|
# override: true
|
2021-03-25 19:22:09 +03:00
|
|
|
|
2021-07-13 15:41:40 +03:00
|
|
|
- uses: denoland/setup-deno@v1
|
2022-02-14 15:13:25 +03:00
|
|
|
if: matrix.settings.crate == 'swc_bundler'
|
2021-04-14 17:00:33 +03:00
|
|
|
with:
|
|
|
|
deno-version: v1.x
|
|
|
|
|
2020-01-04 07:33:25 +03:00
|
|
|
- name: Install node dependencies
|
2021-03-22 13:42:42 +03:00
|
|
|
shell: bash
|
2020-01-04 07:33:25 +03:00
|
|
|
run: |
|
2024-05-18 03:23:06 +03:00
|
|
|
corepack enable
|
2021-08-02 18:49:34 +03:00
|
|
|
yarn
|
2022-04-25 14:44:50 +03:00
|
|
|
# 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
|
2021-03-22 13:42:42 +03:00
|
|
|
|
|
|
|
- name: Configure path (windows)
|
|
|
|
shell: bash
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
2022-04-25 14:44:50 +03:00
|
|
|
echo $(yarn global bin) >> $GITHUB_PATH
|
2021-03-22 13:42:42 +03:00
|
|
|
|
|
|
|
- name: Verify dependencies
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-05-18 03:23:06 +03:00
|
|
|
yarn jest --version && yarn mocha --version
|
2020-01-04 07:33:25 +03:00
|
|
|
|
2022-05-25 09:23:35 +03:00
|
|
|
- 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
|
2024-06-16 14:19:40 +03:00
|
|
|
if: ${{ matrix.settings.crate }} == 'swc' || ${{ startsWith(matrix.settings.crate, 'swc_ecma_transforms_') }}
|
2022-05-25 09:23:35 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.swc-exec-cache
|
2024-06-16 14:19:40 +03:00
|
|
|
key: swc-exec-cache-${{ matrix.settings.crate }}-${{ hashFiles('**/Cargo.lock') }}
|
2022-05-25 09:23:35 +03:00
|
|
|
restore-keys: |
|
2024-06-16 14:19:40 +03:00
|
|
|
swc-exec-cache-${{ matrix.settings.crate }}
|
2022-05-25 09:23:35 +03:00
|
|
|
|
2021-01-05 08:29:52 +03:00
|
|
|
- name: Run cargo test
|
2024-06-25 03:31:10 +03:00
|
|
|
if: matrix.settings.crate != 'swc_plugin_runner' && matrix.settings.crate != 'swc_ecma_parser' && 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'
|
2020-01-04 07:33:25 +03:00
|
|
|
run: |
|
2022-09-24 06:33:47 +03:00
|
|
|
cargo test -p ${{ matrix.settings.crate }}
|
2021-03-17 09:24:35 +03:00
|
|
|
|
2022-08-05 10:37:42 +03:00
|
|
|
- name: Run cargo test (core)
|
|
|
|
if: matrix.settings.crate == 'swc_core'
|
|
|
|
run: |
|
2022-11-18 04:21:23 +03:00
|
|
|
rustup target add wasm32-unknown-unknown
|
2022-09-24 06:33:47 +03:00
|
|
|
cargo test -p swc_core --features ecma_quote --features common --features ecma_utils
|
2022-08-05 10:37:42 +03:00
|
|
|
|
2022-08-16 09:01:49 +03:00
|
|
|
- name: Run cargo test (binding_core_wasm)
|
|
|
|
if: matrix.settings.crate == 'binding_core_wasm'
|
|
|
|
run: |
|
2022-09-24 06:33:47 +03:00
|
|
|
cargo test --manifest-path ./bindings/binding_core_wasm/Cargo.toml
|
2022-08-16 09:01:49 +03:00
|
|
|
|
|
|
|
- name: Run cargo test (cli)
|
|
|
|
if: matrix.settings.crate == 'swc_cli'
|
|
|
|
run: |
|
2022-09-24 06:33:47 +03:00
|
|
|
cargo test --manifest-path ./bindings/swc_cli/Cargo.toml --features plugin
|
2022-08-16 09:01:49 +03:00
|
|
|
|
2022-07-11 04:44:00 +03:00
|
|
|
- name: Run cargo test (plugin)
|
|
|
|
if: matrix.settings.crate == 'swc_plugin_runner'
|
|
|
|
run: |
|
2023-02-07 17:33:13 +03:00
|
|
|
# export CARGO_TARGET_DIR=$(pwd)/target
|
2022-12-02 13:14:46 +03:00
|
|
|
cargo test -p swc_plugin_runner --release --features plugin_transform_schema_v1 --features rkyv-impl --features ecma --features css
|
2022-07-11 04:44:00 +03:00
|
|
|
|
2022-08-01 08:16:51 +03:00
|
|
|
- name: Run cargo test (swc_ecma_minifier)
|
|
|
|
if: matrix.settings.crate == 'swc_ecma_minifier'
|
|
|
|
run: |
|
2022-09-24 06:33:47 +03:00
|
|
|
cargo test -p swc_ecma_minifier --features concurrent
|
2022-08-01 08:16:51 +03:00
|
|
|
|
2024-06-25 03:31:10 +03:00
|
|
|
- name: Run cargo test (swc_ecma_parser)
|
|
|
|
if: matrix.settings.crate == 'swc_ecma_parser'
|
|
|
|
run: |
|
|
|
|
cargo test -p swc_ecma_parser --features verify
|
|
|
|
|
2022-04-10 12:33:18 +03:00
|
|
|
- name: Run cargo test (all features)
|
2024-04-16 13:43:58 +03:00
|
|
|
if: matrix.settings.crate == 'swc_ecma_parser' || matrix.settings.crate == 'swc_ecma_loader'
|
2021-12-13 05:39:17 +03:00
|
|
|
run: |
|
2022-09-24 06:33:47 +03:00
|
|
|
cargo test -p ${{ matrix.settings.crate }} --all-features
|
2021-12-13 05:39:17 +03:00
|
|
|
|
2024-04-16 13:43:58 +03:00
|
|
|
- name: Run cargo test (transforms with stacker)
|
|
|
|
if: matrix.settings.crate == 'swc_ecma_transforms'
|
|
|
|
run: |
|
|
|
|
cargo test -p ${{ matrix.settings.crate }} --all-features --features swc_ecma_utils/stacker
|
|
|
|
|
2022-06-13 14:15:18 +03:00
|
|
|
- name: Run cargo test (concurrent)
|
2022-08-11 05:04:58 +03:00
|
|
|
if: runner.os == 'Linux' && matrix.settings.crate != 'swc_ecma_minifier'
|
2022-06-13 14:15:18 +03:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-08-09 11:35:36 +03:00
|
|
|
./scripts/github/test-concurrent.sh ${{ matrix.settings.crate }}
|
2022-06-13 14:15:18 +03:00
|
|
|
|
2024-07-06 07:46:41 +03:00
|
|
|
- name: Install cargo-hack
|
|
|
|
uses: taiki-e/install-action@v2
|
2023-08-09 11:35:36 +03:00
|
|
|
if: matrix.settings.os == 'ubuntu-latest'
|
2022-02-24 09:06:03 +03:00
|
|
|
with:
|
2024-07-06 04:18:03 +03:00
|
|
|
tool: cargo-hack@0.5.29
|
2022-02-24 09:06:03 +03:00
|
|
|
|
|
|
|
- name: Check compilation
|
2024-07-14 10:20:42 +03:00
|
|
|
if: matrix.settings.os == 'ubuntu-latest'
|
2023-08-09 11:35:36 +03:00
|
|
|
run: |
|
|
|
|
./scripts/github/run-cargo-hack.sh ${{ matrix.settings.crate }}
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
node-test:
|
|
|
|
name: Test node bindings - ${{ matrix.os }}
|
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
2022-11-20 13:03:26 +03:00
|
|
|
fail-fast: false
|
2022-09-30 10:57:15 +03:00
|
|
|
matrix:
|
|
|
|
os:
|
2024-05-18 04:44:19 +03:00
|
|
|
# - ubuntu-latest
|
2024-07-22 08:41:50 +03:00
|
|
|
# - windows-latest
|
2022-09-30 10:57:15 +03:00
|
|
|
- macos-latest
|
|
|
|
steps:
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
2024-05-18 03:23:06 +03:00
|
|
|
- shell: bash
|
2023-12-11 07:45:04 +03:00
|
|
|
run: corepack enable
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
# We explicitly do this to cache properly.
|
|
|
|
- name: Install Rust
|
2023-12-11 07:45:04 +03:00
|
|
|
uses: dtolnay/rust-toolchain@stable
|
2022-09-30 10:57:15 +03:00
|
|
|
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2022-09-30 10:57:15 +03:00
|
|
|
with:
|
2024-05-18 03:23:06 +03:00
|
|
|
node-version: 18
|
2022-09-30 10:57:15 +03:00
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- name: Patch
|
2022-11-20 13:03:26 +03:00
|
|
|
shell: bash
|
2022-09-30 10:57:15 +03:00
|
|
|
run: |
|
|
|
|
echo '[patch.crates-io]' >> bindings/Cargo.toml
|
2022-11-20 13:03:26 +03:00
|
|
|
./scripts/cargo/patch-section.sh
|
2022-09-30 10:57:15 +03:00
|
|
|
./scripts/cargo/patch-section.sh >> bindings/Cargo.toml
|
2024-07-20 22:10:35 +03:00
|
|
|
cd bindings && cargo update -p swc_core -p swc_fast_ts_strip
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
- 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
|
2023-12-11 07:45:04 +03:00
|
|
|
corepack enable
|
2022-09-30 10:57:15 +03:00
|
|
|
yarn
|
|
|
|
|
2024-05-18 03:23:06 +03:00
|
|
|
- name: Build
|
|
|
|
working-directory: packages/core
|
|
|
|
run: |
|
2022-09-30 10:57:15 +03:00
|
|
|
yarn build:dev
|
2024-05-18 03:23:06 +03:00
|
|
|
|
|
|
|
- name: Test
|
|
|
|
working-directory: packages/core
|
|
|
|
run: |
|
2022-09-30 10:57:15 +03:00
|
|
|
yarn test
|
|
|
|
|
|
|
|
integration-test:
|
|
|
|
name: "Test with @swc/cli"
|
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
2024-05-18 03:23:06 +03:00
|
|
|
- shell: bash
|
2023-12-11 07:45:04 +03:00
|
|
|
run: corepack enable
|
2022-09-30 10:57:15 +03:00
|
|
|
|
2023-12-11 07:45:04 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2022-09-30 10:57:15 +03:00
|
|
|
with:
|
2023-12-11 07:45:04 +03:00
|
|
|
node-version: 20
|
2022-09-30 10:57:15 +03:00
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- 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
|
2022-11-20 13:03:26 +03:00
|
|
|
shell: bash
|
2022-09-30 10:57:15 +03:00
|
|
|
run: |
|
|
|
|
echo '[patch.crates-io]' >> bindings/Cargo.toml
|
|
|
|
./scripts/cargo/patch-section.sh >> bindings/Cargo.toml
|
2024-07-20 22:10:35 +03:00
|
|
|
cd bindings && cargo update -p swc_core -p swc_fast_ts_strip
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
- name: Prepare
|
|
|
|
run: |
|
|
|
|
rustup target add wasm32-wasi
|
2023-12-11 07:45:04 +03:00
|
|
|
corepack enable
|
2022-09-30 10:57:15 +03:00
|
|
|
yarn
|
|
|
|
|
|
|
|
yarn build:dev
|
|
|
|
|
|
|
|
# Avoid no space left on device, copyfile
|
|
|
|
cargo clean
|
2023-10-11 08:21:25 +03:00
|
|
|
(cd ./bindings && cargo clean)
|
2022-09-30 10:57:15 +03:00
|
|
|
|
2023-12-11 07:45:04 +03:00
|
|
|
npm install -g @swc/cli@0.1.56
|
|
|
|
npm link
|
|
|
|
npm install -g file:$PWD
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
- name: Print info
|
|
|
|
run: |
|
2023-12-11 07:45:04 +03:00
|
|
|
npm list -g
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
- name: (swc) three.js
|
|
|
|
run: |
|
2023-10-11 08:21:25 +03:00
|
|
|
# mkdir -p tests/integration/three-js
|
|
|
|
# yarn global add qunit failonlyreporter
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
# Download three.js
|
2023-10-11 08:21:25 +03:00
|
|
|
# git clone --depth 1 https://github.com/mrdoob/three.js.git -b r117 tests/integration/three-js/repo
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
# 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: |
|
2023-10-11 08:21:25 +03:00
|
|
|
# mkdir -p tests/integration/redux
|
|
|
|
# yarn global add qunit failonlyreporter
|
2022-09-30 10:57:15 +03:00
|
|
|
|
|
|
|
# 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: |
|
2023-12-11 07:45:04 +03:00
|
|
|
export NODE_OPTIONS="--unhandled-rejections=warn"
|
|
|
|
(cd crates/swc_node_bundler/tests/integration/react && npm install && npx spack)
|
2023-10-02 18:46:14 +03:00
|
|
|
|
2024-04-12 06:59:25 +03:00
|
|
|
miri:
|
|
|
|
name: Miri
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
crate:
|
|
|
|
- better_scoped_tls
|
|
|
|
- string_enum
|
|
|
|
- swc
|
|
|
|
- swc_bundler
|
|
|
|
- swc_ecma_codegen
|
|
|
|
- swc_ecma_minifier
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
2024-05-18 03:23:06 +03:00
|
|
|
- shell: bash
|
|
|
|
run: corepack enable
|
|
|
|
|
2024-04-12 06:59:25 +03:00
|
|
|
- uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: "18"
|
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- name: Install node dependencies
|
|
|
|
shell: bash
|
2024-05-18 03:23:06 +03:00
|
|
|
run: |
|
|
|
|
corepack enable
|
|
|
|
yarn
|
2024-04-12 06:59:25 +03:00
|
|
|
|
|
|
|
- name: Print rustup toolchain version
|
|
|
|
shell: bash
|
|
|
|
id: rustup-version
|
|
|
|
run: |
|
|
|
|
export RUST_TOOLCHAIN="$(cat rust-toolchain | tr -d '\n')"
|
|
|
|
echo "Rust toolchain: $RUST_TOOLCHAIN"
|
|
|
|
echo "RUST_TOOLCHAIN=$RUST_TOOLCHAIN" >> "$GITHUB_OUTPUT"
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
toolchain: "${{ steps.rustup-version.outputs.RUST_TOOLCHAIN }}"
|
|
|
|
components: miri
|
|
|
|
|
|
|
|
- run: cargo miri test -p ${{ matrix.crate }} --no-fail-fast
|
|
|
|
continue-on-error: true
|
|
|
|
env:
|
|
|
|
MIRIFLAGS: "-Zmiri-disable-isolation"
|
2023-10-02 18:46:14 +03:00
|
|
|
done:
|
|
|
|
needs:
|
|
|
|
- cargo-fmt
|
|
|
|
- cargo-clippy
|
|
|
|
- cargo-deny
|
|
|
|
- cargo-check
|
|
|
|
- test-wasm
|
|
|
|
- cargo-test
|
|
|
|
- node-test
|
|
|
|
- integration-test
|
2023-11-11 20:25:36 +03:00
|
|
|
if: >-
|
|
|
|
${{ always() && !contains(github.event.head_commit.message, 'chore: ') }}
|
2023-10-02 18:46:14 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Done
|
|
|
|
steps:
|
|
|
|
- run: exit 1
|
|
|
|
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')) }}
|