-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from superfaceai/feat/nodejs_comlink_package
Feat/nodejs comlink package
- Loading branch information
Showing
38 changed files
with
1,808 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: "Prepare core" | ||
description: "Build core components" | ||
|
||
inputs: | ||
CARGO_PROFILE: | ||
description: "Cargo profile name to use for cargo cache key" | ||
required: false | ||
default: 'release' | ||
CORE_WASM: | ||
description: "Whether to build core.wasm and core-async.wasm, oneOf `none, build, upload`" | ||
required: false | ||
default: 'none' | ||
TEST_CORE_WASM: | ||
description: "Whether to build test-core.wasm and test-core-async.wasm, oneOf `none, build, upload`" | ||
required: false | ||
default: 'none' | ||
COMLINK_WASM: | ||
description: "Whether to build comlink.wasm, oneOf `none, build, upload`" | ||
required: false | ||
default: 'none' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
registry-url: https://registry.npmjs.org/ | ||
node-version: "18" | ||
cache: yarn | ||
cache-dependency-path: core_js/yarn.lock | ||
- name: Cache cargo registry and build directory | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/git | ||
~/.cargo/registry/cache | ||
~/.cargo/registry/index | ||
core/target | ||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-${{ inputs.CARGO_PROFILE }} | ||
restore-keys: | | ||
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- | ||
cargo-${{ runner.os }}- | ||
- name: Cache WASI SDK | ||
uses: actions/cache@v4 | ||
with: | ||
path: core/wasi-sdk-* | ||
key: wasisdk-${{ runner.os }}-${{ runner.arch }} | ||
- name: Install wasm-opt | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install binaryen | ||
- name: Install rust target | ||
shell: bash | ||
run: rustup target add wasm32-wasi | ||
# build and store core.wasm, core-async.wasm | ||
- name: Run make to build core.wasm | ||
if: ${{ inputs.CORE_WASM != 'none' }} | ||
env: | ||
CARGO_INCREMENTAL: "0" # disable incremental to reduce load on the cache | ||
shell: bash | ||
run: make core/dist/core.wasm core/dist/core-async.wasm OS=${{ runner.os }} CARGO_PROFILE=${{ inputs.CARGO_PROFILE }} | ||
- name: Upload artifact core-async.wasm | ||
if: ${{ inputs.CORE_WASM == 'upload' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: core-async-wasm | ||
path: core/dist/core-async.wasm | ||
- name: Upload artifact core.wasm | ||
if: ${{ inputs.CORE_WASM == 'upload' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: core-wasm | ||
path: core/dist/core.wasm | ||
# build and store test-core.wasm and test-core-async.wasm | ||
- name: Run make to build test-core.wasm | ||
if: ${{ inputs.TEST_CORE_WASM != 'none' }} | ||
env: | ||
CARGO_INCREMENTAL: "0" # disable incremental to reduce load on the cache | ||
shell: bash | ||
run: make core/dist/test-core.wasm core/dist/test-core-async.wasm OS=${{ runner.os }} CARGO_PROFILE=${{ inputs.CARGO_PROFILE }} | ||
- name: Upload artifact test-core-async.wasm | ||
if: ${{ inputs.TEST_CORE_WASM == 'upload' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-core-async-wasm | ||
path: core/dist/test-core-async.wasm | ||
- name: Upload artifact test-core.wasm | ||
if: ${{ inputs.TEST_CORE_WASM == 'upload' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-core-wasm | ||
path: core/dist/test-core.wasm | ||
# build and store comlink.wasm | ||
- name: Run make to build comlink.wasm | ||
if: ${{ inputs.COMLINK_WASM != 'none' }} | ||
env: | ||
CARGO_INCREMENTAL: "0" | ||
shell: bash | ||
run: make core/dist/comlink.wasm OS=${{ runner.os }} CARGO_PROFILE=${{ inputs.CARGO_PROFILE }} | ||
- name: Upload artifact comlink.wasm | ||
if: ${{ inputs.COMLINK_WASM == 'upload' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: comlink-wasm | ||
path: core/dist/comlink.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.