2020-06-13 17:09:45 +03:00
|
|
|
name: Integration tests
|
2020-05-28 16:23:53 +03:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
|
|
|
|
jobs:
|
2021-01-24 16:02:44 +03:00
|
|
|
publish-test:
|
|
|
|
name: node-api
|
2022-02-27 09:27:15 +03:00
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
2021-01-24 16:02:44 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/checkout@v3
|
2021-01-24 16:02:44 +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-05-04 13:04:48 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2021-01-24 16:02:44 +03:00
|
|
|
with:
|
2022-05-04 13:04:48 +03:00
|
|
|
node-version: 16
|
2021-12-12 10:16:20 +03:00
|
|
|
cache: "yarn"
|
2021-01-24 16:02:44 +03:00
|
|
|
|
|
|
|
- name: Cache
|
2022-05-04 13:04:48 +03:00
|
|
|
uses: actions/cache@v3
|
2021-01-24 16:02:44 +03:00
|
|
|
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: Prepare
|
|
|
|
run: |
|
2022-07-15 05:10:13 +03:00
|
|
|
rustup target add wasm32-wasi
|
2022-04-01 14:06:35 +03:00
|
|
|
yarn
|
2021-01-24 16:02:44 +03:00
|
|
|
|
2022-04-01 14:06:35 +03:00
|
|
|
yarn build:dev
|
|
|
|
yarn test
|
2021-01-24 16:02:44 +03:00
|
|
|
|
2020-05-28 16:23:53 +03:00
|
|
|
integration-test:
|
2021-01-24 16:02:44 +03:00
|
|
|
name: swc-cli
|
2022-02-27 09:27:15 +03:00
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
2020-05-28 16:23:53 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/checkout@v3
|
2020-05-28 16:23:53 +03:00
|
|
|
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2020-05-28 16:23:53 +03:00
|
|
|
with:
|
2021-01-11 13:39:17 +03:00
|
|
|
node-version: 14
|
2021-12-12 10:16:20 +03:00
|
|
|
cache: "yarn"
|
2020-05-28 16:23:53 +03:00
|
|
|
|
2020-08-03 19:33:23 +03:00
|
|
|
- name: Cache
|
2022-05-04 13:04:48 +03:00
|
|
|
uses: actions/cache@v3
|
2020-08-03 19:33:23 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/
|
|
|
|
**/target/
|
|
|
|
key: ${{ runner.os }}-cargo-integration
|
|
|
|
|
2020-08-30 09:29:42 +03:00
|
|
|
- name: Set platform name
|
|
|
|
run: |
|
|
|
|
export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
|
2020-11-22 12:14:22 +03:00
|
|
|
echo "PLATFORM_NAME=$NODE_PLATFORM_NAME" >> $GITHUB_ENV
|
2020-08-30 09:29:42 +03:00
|
|
|
shell: bash
|
|
|
|
|
2020-05-28 16:23:53 +03:00
|
|
|
- name: Prepare
|
|
|
|
run: |
|
2022-04-01 14:06:35 +03:00
|
|
|
yarn
|
2020-08-30 09:29:42 +03:00
|
|
|
|
2022-04-01 14:06:35 +03:00
|
|
|
yarn build:dev
|
|
|
|
|
|
|
|
# Avoid no space left on device, copyfile
|
|
|
|
cargo clean
|
|
|
|
|
|
|
|
yarn global add @swc/cli@0.1.33
|
|
|
|
yarn link
|
|
|
|
yarn global add file:$PWD
|
2020-05-28 16:23:53 +03:00
|
|
|
|
2020-07-01 10:31:55 +03:00
|
|
|
- name: (swc) three.js
|
2020-05-28 16:23:53 +03:00
|
|
|
run: |
|
2021-06-24 11:01:21 +03:00
|
|
|
mkdir -p tests/integration/three-js
|
2022-04-01 14:06:35 +03:00
|
|
|
yarn global add qunit failonlyreporter
|
2020-05-28 16:23:53 +03:00
|
|
|
|
|
|
|
# Download three.js
|
2021-06-24 11:01:21 +03:00
|
|
|
git clone --depth 1 https://github.com/mrdoob/three.js.git -b r117 tests/integration/three-js/repo
|
2020-05-28 16:23:53 +03:00
|
|
|
|
2022-07-12 08:35:44 +03:00
|
|
|
swc -C isModule=unknown -C test=\".*.js$\" -C module.type=commonjs --sync tests/integration/three-js/repo/ -d tests/integration/three-js/build/
|
2020-05-28 16:23:53 +03:00
|
|
|
|
2021-06-24 11:01:21 +03:00
|
|
|
(cd tests/integration/three-js/build/test && qunit -r failonlyreporter unit/three.source.unit.js)
|
2020-05-28 16:23:53 +03:00
|
|
|
|
|
|
|
# terser: contains with statement in test
|
|
|
|
# Rome.js: I forgot the cause, but it didn't work.
|
|
|
|
# jQuery: browser only (window.document is required)
|
2020-07-01 10:31:55 +03:00
|
|
|
- name: (swc) redux
|
2020-05-28 16:23:53 +03:00
|
|
|
run: |
|
2021-06-24 11:01:21 +03:00
|
|
|
mkdir -p tests/integration/redux
|
2022-04-01 14:06:35 +03:00
|
|
|
yarn global add qunit failonlyreporter
|
2020-05-28 16:23:53 +03:00
|
|
|
|
|
|
|
# Download
|
2021-06-24 11:01:21 +03:00
|
|
|
git clone --depth 1 https://github.com/reduxjs/redux.git -b v4.1.0 tests/integration/redux/repo
|
|
|
|
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
|
|
|
|
swc --sync tests/integration/redux/repo/src/ -d tests/integration/redux/repo/test/
|
|
|
|
swc --sync tests/integration/redux/repo/test/ -d tests/integration/redux/repo/test/
|
|
|
|
|
2022-04-01 14:06:35 +03:00
|
|
|
(cd tests/integration/redux/repo && yarn)
|
2021-06-24 11:01:21 +03:00
|
|
|
(cd tests/integration/redux/repo && npx jest '.*.js' --modulePathIgnorePatterns 'typescript')
|
2021-11-09 14:42:49 +03:00
|
|
|
- name: (swcpack) example react app
|
2020-08-06 08:55:16 +03:00
|
|
|
run: |
|
2022-04-01 14:06:35 +03:00
|
|
|
(cd crates/swc_node_bundler/tests/integration/react && yarn && npx spack)
|