Skip to content

Commit 703c39e

Browse files
authored
chore(ci): Run npm tests for PR (#433)
1 parent c8c31a6 commit 703c39e

File tree

17 files changed

+137
-77
lines changed

17 files changed

+137
-77
lines changed
Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,73 @@
1-
name: Cargo
1+
name: CI
22

33
on:
4-
- push
5-
- pull_request
4+
pull_request:
5+
types: ["opened", "reopened", "synchronize"]
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: "${{ github.event_name == 'pull_request' }}"
613

714
env:
815
RUST_LOG: debug
916
CARGO_INCREMENTAL: 0
1017
CI: "1"
1118

1219
jobs:
13-
test:
20+
npm-test:
21+
name: "Integration Test"
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup node
27+
uses: actions/setup-node@v2
28+
with:
29+
node-version: 20
30+
31+
- name: Install Rust
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
profile: minimal
35+
override: true
36+
37+
- name: Configure path (windows)
38+
shell: bash
39+
if: runner.os == 'Windows'
40+
run: |
41+
echo 'C:\\npm\\prefix' >> $GITHUB_PATH
42+
43+
- uses: Swatinem/rust-cache@v2
44+
with:
45+
shared-key: "npm-test"
46+
cache-on-failure: true
47+
48+
- run: |
49+
echo "Before: corepack version => $(corepack --version || echo 'not installed')"
50+
npm install -g corepack@latest
51+
echo "After : corepack version => $(corepack --version)"
52+
corepack enable
53+
pnpm --version
54+
pnpm i
55+
56+
- name: Install Rust
57+
uses: actions-rs/toolchain@v1
58+
with:
59+
profile: minimal
60+
61+
- name: Install wasm target
62+
shell: bash
63+
run: |
64+
rustup target add wasm32-wasip1
65+
66+
- name: Test
67+
run: |
68+
pnpm test
69+
70+
cargo-test:
1471
strategy:
1572
fail-fast: false
1673
matrix:
@@ -56,12 +113,12 @@ jobs:
56113
run: |
57114
cargo test --all --color always
58115
59-
publish:
116+
cargo-publish:
60117
name: "Publish"
61118
runs-on: ubuntu-latest
62119
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
63120
needs:
64-
- test
121+
- cargo-test
65122

66123
steps:
67124
- uses: actions/checkout@v2
@@ -86,3 +143,15 @@ jobs:
86143
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
87144
run: |
88145
cargo mono publish --no-verify
146+
147+
done:
148+
needs:
149+
- npm-test
150+
- cargo-test
151+
if: >-
152+
${{ always() }}
153+
runs-on: ubuntu-latest
154+
name: Done
155+
steps:
156+
- run: exit 1
157+
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')) }}

.github/workflows/bump-swc_core.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- ci
87

98
env:
109
RUST_LOG: debug
@@ -16,9 +15,7 @@ jobs:
1615
name: Build
1716
runs-on: ubuntu-latest
1817
steps:
19-
- uses: actions/checkout@v2
20-
with:
21-
submodules: true
18+
- uses: actions/checkout@v4
2219

2320
- name: Setup node
2421
uses: actions/setup-node@v2

packages/emotion/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "SWC plugin for emotion css-in-js library",
55
"main": "swc_plugin_emotion.wasm",
66
"scripts": {
7-
"prepack": "pnpm run build && vitest run",
7+
"prepack": "pnpm run build",
88
"build": "cargo build --release -p swc_plugin_emotion --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_emotion.wasm .",
99
"build:debug": "cargo build -p swc_plugin_emotion --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_emotion.wasm .",
10-
"test": "pnpm run build:debug && vitest run"
10+
"test": "pnpm run build:debug && vitest run --testTimeout=0"
1111
},
1212
"homepage": "https://swc.rs",
1313
"repository": {

packages/formatjs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "FormatJS SWC plugin",
55
"main": "swc_plugin_formatjs.wasm",
66
"scripts": {
7-
"prepack": "pnpm run build && vitest run",
7+
"prepack": "pnpm run build",
88
"build": "cargo build --release -p swc_plugin_formatjs --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_formatjs.wasm .",
99
"build:debug": "cargo build -p swc_plugin_formatjs --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_formatjs.wasm .",
10-
"test": "pnpm run build:debug && vitest run"
10+
"test": "pnpm run build:debug && vitest run --testTimeout=0"
1111
},
1212
"homepage": "https://swc.rs",
1313
"repository": {

packages/jest/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "SWC plugin for jest",
55
"main": "swc_plugin_jest.wasm",
66
"scripts": {
7-
"prepack": "pnpm run build && vitest run",
7+
"prepack": "pnpm run build",
88
"build": "cargo build --release -p swc_plugin_jest --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_jest.wasm .",
99
"build:debug": "cargo build -p swc_plugin_jest --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_jest.wasm .",
10-
"test": "pnpm run build:debug && vitest run"
10+
"test": "pnpm run build:debug && vitest run --testTimeout=0"
1111
},
1212
"homepage": "https://swc.rs",
1313
"repository": {

packages/loadable-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "SWC plugin for `@loadable/components`",
55
"main": "swc_plugin_loadable_components.wasm",
66
"scripts": {
7-
"prepack": "pnpm run build && vitest run",
7+
"prepack": "pnpm run build",
88
"build": "cargo build --release -p swc_plugin_loadable_components --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_loadable_components.wasm .",
99
"build:debug": "cargo build -p swc_plugin_loadable_components --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_loadable_components.wasm .",
10-
"test": "pnpm run build:debug && vitest run"
10+
"test": "pnpm run build:debug && vitest run --testTimeout=0"
1111
},
1212
"homepage": "https://swc.rs",
1313
"repository": {

packages/prefresh/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "SWC plugin for preact refresh",
55
"main": "swc_plugin_prefresh.wasm",
66
"scripts": {
7-
"prepack": "pnpm run build && vitest run",
7+
"prepack": "pnpm run build",
88
"build": "cargo build --release -p swc_plugin_prefresh --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_prefresh.wasm .",
99
"build:debug": "cargo build -p swc_plugin_prefresh --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_prefresh.wasm .",
10-
"test": "pnpm run build:debug && vitest run"
10+
"test": "pnpm run build:debug && vitest run --testTimeout=0"
1111
},
1212
"homepage": "https://swc.rs",
1313
"repository": {

packages/react-remove-properties/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "SWC plugin for https://www.npmjs.com/package/babel-plugin-react-remove-properties",
55
"main": "swc_plugin_react_remove_properties.wasm",
66
"scripts": {
7-
"prepack": "pnpm run build && vitest run",
7+
"prepack": "pnpm run build",
88
"build": "cargo build --release -p swc_plugin_react_remove_properties --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_react_remove_properties.wasm .",
99
"build:debug": "cargo build -p swc_plugin_react_remove_properties --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_react_remove_properties.wasm .",
10-
"test": "pnpm run build:debug && vitest run"
10+
"test": "pnpm run build:debug && vitest run --testTimeout=0"
1111
},
1212
"homepage": "https://swc.rs",
1313
"repository": {

packages/relay/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"main": "swc_plugin_relay.wasm",
66
"types": "./types.d.ts",
77
"scripts": {
8-
"prepack": "pnpm run build && vitest run",
8+
"prepack": "pnpm run build",
99
"build": "cargo build --release -p swc_plugin_relay --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/release/swc_plugin_relay.wasm .",
1010
"build:debug": "cargo build -p swc_plugin_relay --target wasm32-wasip1 && cp ../../target/wasm32-wasip1/debug/swc_plugin_relay.wasm .",
11-
"test": "pnpm run build:debug && vitest run"
11+
"test": "pnpm run build:debug && vitest run --testTimeout=0"
1212
},
1313
"homepage": "https://swc.rs",
1414
"repository": {

0 commit comments

Comments
 (0)