mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 03:31:45 +03:00
125 lines
3.8 KiB
YAML
125 lines
3.8 KiB
YAML
name: Integration tests
|
|
|
|
on: [push, pull_request]
|
|
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
jobs:
|
|
publish-test:
|
|
name: node-api
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
# We explicitly do this to cache properly.
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 14
|
|
cache: "yarn"
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v2
|
|
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: |
|
|
npm config set prefix ~/npm
|
|
npm i
|
|
export PATH="$PATH:$HOME/npm/bin"
|
|
|
|
npm run build:dev
|
|
npm test
|
|
|
|
integration-test:
|
|
name: swc-cli
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 14
|
|
cache: "yarn"
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v2
|
|
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: Prepare
|
|
run: |
|
|
npm config set prefix ~/npm
|
|
npm i
|
|
export PATH="$PATH:$HOME/npm/bin"
|
|
|
|
npm run build:dev
|
|
npm i -g @swc/cli@0.1.33
|
|
npm link
|
|
|
|
- name: (swc) three.js
|
|
run: |
|
|
export PATH="$PATH:$HOME/npm/bin"
|
|
mkdir -p tests/integration/three-js
|
|
npm i -g qunit failonlyreporter
|
|
|
|
# Download three.js
|
|
git clone --depth 1 https://github.com/mrdoob/three.js.git -b r117 tests/integration/three-js/repo
|
|
|
|
swc --sync tests/integration/three-js/repo/ -d tests/integration/three-js/build/
|
|
# swc tests/integration/three-js/repo/src/ -d tests/integration/three-js/repo/build/
|
|
# swc tests/integration/three-js/repo/test/unit/**/*.js -d tests/integration/three-js/repo/test/unit/build/
|
|
|
|
(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: |
|
|
export PATH="$PATH:$HOME/npm/bin"
|
|
mkdir -p tests/integration/redux
|
|
npm i -g qunit failonlyreporter
|
|
|
|
# Download
|
|
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/
|
|
|
|
(cd tests/integration/redux/repo && npm i)
|
|
(cd tests/integration/redux/repo && npx jest '.*.js' --modulePathIgnorePatterns 'typescript')
|
|
- name: (swcpack) example react app
|
|
run: |
|
|
export PATH="$PATH:$HOME/npm/bin"
|
|
(cd crates/swc_node_bundler/tests/integration/react && npm i && npx spack)
|