chore: update examples to new structure #431
Workflow file for this run
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
name: CI/CD | |
on: push | |
jobs: | |
core: | |
name: Core | |
runs-on: ubuntu-latest | |
steps: | |
# checkout | |
- uses: actions/checkout@v3 | |
# setup | |
- uses: actions/setup-node@v3 | |
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@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry/cache | |
~/.cargo/registry/index | |
core/target | |
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-debug | |
restore-keys: | | |
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}- | |
cargo-${{ runner.os }}- | |
- name: Cache WASI SDK | |
uses: actions/cache@v3 | |
with: | |
path: core/wasi-sdk-* | |
key: wasisdk-${{ runner.os }}-${{ runner.arch }} | |
- name: Install wasm-opt | |
run: | | |
sudo apt-get update | |
sudo apt-get install binaryen | |
- name: Install rust target | |
run: rustup target add wasm32-wasi | |
- name: Install Wasmtime | |
run: | | |
curl https://wasmtime.dev/install.sh -sSf | bash | |
echo $HOME/.wasmtime/bin >> $GITHUB_PATH | |
# build and store | |
- name: Run make to build core | |
env: | |
CARGO_INCREMENTAL: "0" # disable incremental to reduce load on the cache | |
run: make build_core OS=${{ runner.os }} | |
- name: Upload artifact core-async.wasm | |
uses: actions/upload-artifact@v3 | |
with: | |
name: core-async-wasm | |
path: core/dist/core-async.wasm | |
- name: Upload artifact core.wasm | |
uses: actions/upload-artifact@v3 | |
with: | |
name: core-wasm | |
path: core/dist/core.wasm | |
# test | |
- name: Run tests | |
working-directory: core | |
run: cargo test | |
- name: Upload artifact test-core-async.wasm | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-core-async-wasm | |
path: core/dist/test-core-async.wasm | |
- name: Upload artifact core.wasm | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-core-wasm | |
path: core/dist/test-core.wasm | |
core_js: | |
name: Core JS (Map STD) | |
runs-on: ubuntu-latest | |
steps: | |
# checkout | |
- uses: actions/checkout@v3 | |
# setup | |
- uses: actions/setup-node@v3 | |
with: | |
registry-url: https://registry.npmjs.org/ | |
node-version: "18" | |
cache: yarn | |
cache-dependency-path: core_js/yarn.lock | |
# test and build | |
- name: Install Yarn dependencies | |
working-directory: core_js | |
run: yarn install --frozen-lockfile | |
## first we need map-std which is used in profile-validator | |
- name: Build Map STD | |
working-directory: core_js/map-std | |
run: yarn build | |
- name: Test Map STD | |
working-directory: core_js/map-std | |
run: yarn test | |
- name: Build Profile validator | |
working-directory: core_js/profile-validator | |
run: yarn build | |
- name: Test Profile validator | |
working-directory: core_js/profile-validator | |
run: yarn test | |
host-nodejs: | |
name: Node.js Host | |
needs: [core] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/nodejs_host | |
steps: | |
# checkout | |
- uses: actions/checkout@v3 | |
# setup | |
- uses: actions/setup-node@v3 | |
with: | |
registry-url: https://registry.npmjs.org/ | |
node-version: "18" | |
cache: yarn | |
cache-dependency-path: packages/nodejs_host/yarn.lock | |
- uses: actions/download-artifact@v3 | |
with: | |
name: core-async-wasm | |
path: packages/nodejs_host/assets | |
- uses: actions/download-artifact@v3 | |
with: | |
name: test-core-async-wasm | |
path: packages/nodejs_host/assets | |
# test and build | |
- name: Install Yarn dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Run tests | |
run: yarn test | |
host-cfw: | |
name: Cloudflare worker Host | |
needs: [core] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/cloudflare_worker_host | |
steps: | |
# checkout | |
- uses: actions/checkout@v3 | |
# setup | |
- uses: actions/setup-node@v3 | |
with: | |
registry-url: https://registry.npmjs.org/ | |
node-version: "18" | |
cache: yarn | |
cache-dependency-path: packages/cloudflare_worker_host/yarn.lock | |
- uses: actions/download-artifact@v3 | |
with: | |
name: core-async-wasm | |
path: packages/cloudflare_worker_host/assets | |
- uses: actions/download-artifact@v3 | |
with: | |
name: test-core-async-wasm | |
path: packages/cloudflare_worker_host/assets | |
# test and build | |
- name: Install Yarn dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Run tests | |
run: yarn test | |
host-python: | |
name: Python Host | |
needs: [core] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/python_host | |
steps: | |
# checkout | |
- uses: actions/checkout@v3 | |
# setup | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- uses: actions/download-artifact@v3 | |
with: | |
name: core-wasm | |
path: packages/python_host/src/one_sdk/assets | |
- uses: actions/download-artifact@v3 | |
with: | |
name: test-core-wasm | |
path: packages/python_host/src/one_sdk/assets | |
# test and build | |
- name: Install dependencies and package locally | |
run: python -m pip install . | |
- name: Run tests | |
run: python -m unittest discover tests/ |