forked from swc-project/swc
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (122 loc) · 4.42 KB
/
integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Integration tests
on: [push, pull_request]
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: "always"
jobs:
publish-test:
name: node-api - ${{ matrix.os }}
if: >-
${{ !contains(github.event.head_commit.message, 'chore: ') }}
runs-on: ${{ matrix.os }}
strategy:
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: 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: 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: 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/[email protected]
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)