Merge pull request #100 from superfaceai/chore/fix_tag_and_version #407
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: integration/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 | |
integration: | |
name: Integration (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: integration/yarn.lock | |
# test and build | |
- name: Install Yarn dependencies | |
working-directory: integration | |
run: yarn install --frozen-lockfile | |
## first we need map-std which is used in profile-validator | |
- name: Build Map STD | |
working-directory: integration/map-std | |
run: yarn build | |
- name: Test Map STD | |
working-directory: integration/map-std | |
run: yarn test | |
- name: Build Profile validator | |
working-directory: integration/profile-validator | |
run: yarn build | |
- name: Test Profile validator | |
working-directory: integration/profile-validator | |
run: yarn test | |
host-javascript: | |
name: JavaScript Host | |
needs: [core] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: host/javascript | |
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: host/javascript/yarn.lock | |
- uses: actions/download-artifact@v3 | |
with: | |
name: core-async-wasm | |
path: host/javascript/assets | |
- uses: actions/download-artifact@v3 | |
with: | |
name: test-core-async-wasm | |
path: host/javascript/assets | |
# test and build | |
- name: Install Yarn dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build host/javascript | |
run: yarn build | |
- name: Run tests | |
run: yarn test | |
host-python: | |
name: Python Host | |
needs: [core] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: host/python | |
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: host/python/src/one_sdk/assets | |
- uses: actions/download-artifact@v3 | |
with: | |
name: test-core-wasm | |
path: host/python/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/ |