Skip to content

Commit 524e4d9

Browse files
committed
ci: update wasm package links
1 parent 65d3000 commit 524e4d9

File tree

7 files changed

+50
-20
lines changed

7 files changed

+50
-20
lines changed

.github/workflows/pages-deploy.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ jobs:
1212
with:
1313
fetch-depth: 0
1414

15-
- uses: dtolnay/rust-toolchain@stable
16-
with:
17-
targets: wasm32-unknown-unknown
18-
19-
- name: Install wasm-bindgen-cli
20-
run: cargo install wasm-bindgen-cli --version 0.2.106
21-
2215
- uses: pnpm/action-setup@v3
2316
with:
2417
version: 9
@@ -42,9 +35,26 @@ jobs:
4235
working-directory: pearl_calculator_ui
4336
run: pnpm install
4437

45-
- name: Build WASM & Frontend
38+
- uses: dtolnay/rust-toolchain@stable
39+
with:
40+
targets: wasm32-unknown-unknown
41+
42+
- name: Install wasm-bindgen-cli
43+
shell: bash
44+
run: |
45+
VERSION=$(cargo tree -p wasm-bindgen --depth 0 | head -n 1 | cut -d' ' -f2 | cut -c 2-)
46+
cargo install wasm-bindgen-cli --version "$VERSION"
47+
48+
- uses: Swatinem/rust-cache@v2
49+
50+
- name: Build WASM
51+
run: |
52+
cargo build -p pearl_calculator_wasm --target wasm32-unknown-unknown --release
53+
wasm-bindgen target/wasm32-unknown-unknown/release/pearl_calculator_wasm.wasm --out-dir pearl_calculator_wasm/pkg --target bundler
54+
55+
- name: Build Frontend (TS + Vite)
4656
working-directory: pearl_calculator_ui
47-
run: pnpm build
57+
run: pnpm exec tsc && pnpm exec vite build
4858

4959
- name: Deploy to Cloudflare Pages
5060
uses: cloudflare/pages-action@v1

.github/workflows/release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,21 @@ jobs:
7979

8080
- uses: dtolnay/rust-toolchain@stable
8181
with:
82-
targets: ${{ matrix.target }}
82+
targets: ${{ matrix.target }},wasm32-unknown-unknown
83+
84+
- name: Install wasm-bindgen-cli
85+
shell: bash
86+
run: |
87+
VERSION=$(cargo tree -p wasm-bindgen --depth 0 | head -n 1 | cut -d' ' -f2 | cut -c 2-)
88+
cargo install wasm-bindgen-cli --version "$VERSION"
8389
8490
- uses: Swatinem/rust-cache@v2
8591
with:
8692
workspaces: |
8793
.
8894
pearl_calculator_ui/src-tauri
8995
96+
9097
- name: Sync Version from Tag
9198
shell: bash
9299
run: |

.github/workflows/test.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,32 @@ jobs:
4747
cache: 'pnpm'
4848
cache-dependency-path: '**/pnpm-lock.yaml'
4949

50-
- name: Install Frontend Dependencies
51-
working-directory: pearl_calculator_ui
52-
run: pnpm install
53-
5450
- name: Setup Rust
5551
uses: dtolnay/rust-toolchain@stable
5652
with:
5753
targets: wasm32-unknown-unknown
5854

55+
- name: Install wasm-bindgen-cli
56+
shell: bash
57+
run: |
58+
VERSION=$(cargo tree -p wasm-bindgen --depth 0 | head -n 1 | cut -d' ' -f2 | cut -c 2-)
59+
cargo install wasm-bindgen-cli --version "$VERSION"
60+
5961
- name: Rust Cache
6062
uses: Swatinem/rust-cache@v2
6163

62-
- name: Frontend Check (WASM + TS + Vite)
64+
- name: Install Frontend Dependencies
65+
working-directory: pearl_calculator_ui
66+
run: pnpm install
67+
68+
- name: Build WASM
69+
run: |
70+
cargo build -p pearl_calculator_wasm --target wasm32-unknown-unknown --release
71+
wasm-bindgen target/wasm32-unknown-unknown/release/pearl_calculator_wasm.wasm --out-dir pearl_calculator_wasm/pkg --target bundler
72+
73+
- name: Frontend Build (TS + Vite)
6374
working-directory: pearl_calculator_ui
64-
run: pnpm build
75+
run: pnpm exec tsc && pnpm exec vite build
6576

6677
- name: Run tests
6778
run: cargo test --verbose

pearl_calculator_ui/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"lucide-react": "^0.554.0",
4040
"motion": "^12.23.24",
4141
"next-themes": "^0.4.6",
42-
"pearl_calculator_wasm": "link:..\\pearl_calculator_wasm\\pkg",
4342
"react": "^19.1.0",
4443
"react-dom": "^19.1.0",
4544
"react-i18next": "^16.3.5",

pearl_calculator_ui/pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module "pearl_calculator_wasm" {
2+
export function calculate_tnt_amount(input: unknown): unknown[];
3+
export function calculate_pearl_trace(input: unknown): unknown;
4+
export function calculate_raw_trace(input: unknown): unknown;
5+
}

pearl_calculator_ui/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default defineConfig(async () => ({
1212
resolve: {
1313
alias: {
1414
"@": path.resolve(__dirname, "./src"),
15+
"pearl_calculator_wasm": path.resolve(__dirname, "../pearl_calculator_wasm/pkg/pearl_calculator_wasm.js"),
1516
},
1617
},
1718

0 commit comments

Comments
 (0)