Skip to content

perf: Add Session::new_without_boot_contracts() to avoid loading them in unit tests #2036

perf: Add Session::new_without_boot_contracts() to avoid loading them in unit tests

perf: Add Session::new_without_boot_contracts() to avoid loading them in unit tests #2036

Workflow file for this run

name: CI - Clarinet SDK
on:
pull_request:
branches:
- main
paths-ignore:
- "**/CHANGELOG.md"
push:
branches:
- main
paths-ignore:
- "**/CHANGELOG.md"
# Cancel previous runs for the same workflow
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
build_wasm:
name: Build and test Wasm packages
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-Dwarnings"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust toolchain
run: rustup toolchain install stable --profile minimal --component rustfmt,clippy --target wasm32-unknown-unknown
- name: Setup cache keys
run: |
RUST_VERSION=$(rustc -vV | shasum -a 256 | cut -d ' ' -f1)
echo "RUST_VERSION=$RUST_VERSION" >> $GITHUB_ENV
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/
target/
key: ${{ runner.os }}-${{ github.job }}-${{ env.RUST_VERSION }}-${{ hashFiles('./Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ env.RUST_VERSION }}-
${{ runner.os }}-${{ github.job }}-
- name: Run clippy
run: cargo clippy --package clarinet-sdk-wasm --target wasm32-unknown-unknown
- name: Install wasm-pack if not available
run: |
if ! command -v wasm-pack &> /dev/null; then
cargo install wasm-pack
fi
- name: Build Wasm packages
run: npm run build:sdk-wasm
- name: Run wasm-bindgen-test
run: wasm-pack test --node components/clarinet-sdk-wasm
- name: Upload Wasm artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-artifacts
path: components/clarinet-sdk-wasm/pkg-*
test:
name: Run clarinet-sdk tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [20.x, 24.x]
needs: build_wasm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Download Wasm artifacts
uses: actions/download-artifact@v4
with:
name: wasm-artifacts
path: components/clarinet-sdk-wasm
- name: Install dependencies
run: npm ci
- name: Run tests
env:
HIRO_API_KEY: ${{ secrets.HIRO_API_KEY }}
run: npm run test