Skip to content

Commit

Permalink
Add dev wasm build
Browse files Browse the repository at this point in the history
  • Loading branch information
padmaia committed Dec 6, 2021
1 parent 78505dc commit 6ab2516
Showing 1 changed file with 67 additions and 5 deletions.
72 changes: 67 additions & 5 deletions .github/workflows/build_test_deploy.yml
Expand Up @@ -718,7 +718,7 @@ jobs:
test-wasm:
name: Test the wasm build
runs-on: ubuntu-18.04
needs: [build, build-native-dev, build-wasm]
needs: [build, build-native-dev, build-wasm-dev]

steps:
- uses: actions/cache@v2
Expand All @@ -731,8 +731,10 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: wasm-binaries
path: packages/next-swc/crates/wasm
name: wasm-dev-binary
path: packages/next-swc/crates/wasm/pkg-nodejs

- run: ls packages/next-swc/crates/wasm

- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
Expand Down Expand Up @@ -1249,7 +1251,7 @@ jobs:

build-wasm:
needs: build
# if: ${{ needs.build.outputs.isRelease == 'true' }}
if: ${{ needs.build.outputs.isRelease == 'true' }}
strategy:
matrix:
target: [web, nodejs]
Expand Down Expand Up @@ -1297,4 +1299,64 @@ jobs:
name: wasm-binaries
path: packages/next-swc/crates/wasm/pkg-*

- run: ls packages/next-swc/crates/wasm
build-wasm-dev:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}

- name: Setup node
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
uses: actions/setup-node@v2
with:
node-version: 14

- name: Install Rust
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2021-11-15
override: true
target: wasm32-unknown-unknown

- name: Cache
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
uses: actions/cache@v2
with:
path: |
~/.cargo/
**/target/
key: ${{ runner.os }}-publish-integration

- name: Cache wasm binary
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: binary-cache
uses: actions/cache@v2
with:
path: packages/next-swc/crates/wasm/pkg-nodejs
key: dev-wasm-next-swc-nightly-2021-11-15-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}

- name: Install wasm-pack
if: ${{needs.build.outputs.docsChange != 'docs only change' && steps.binary-cache.outputs.cache-hit != 'true'}}
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build
if: ${{needs.build.outputs.docsChange != 'docs only change' && steps.binary-cache.outputs.cache-hit != 'true'}}
run: (wasm-pack build packages/next-swc/crates/wasm --dev --scope=next --target nodejs)

- name: Add target to folder name
if: ${{needs.build.outputs.docsChange != 'docs only change' && steps.binary-cache.outputs.cache-hit != 'true'}}
run: mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs

- name: Upload artifact
if: ${{needs.build.outputs.docsChange != 'docs only change' && steps.binary-cache.outputs.cache-hit != 'true'}}
uses: actions/upload-artifact@v2
with:
name: wasm-dev-binary
path: packages/next-swc/crates/wasm/pkg-nodejs

0 comments on commit 6ab2516

Please sign in to comment.