Skip to content

Commit

Permalink
ci: run sdk-ci on multiple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocaillard committed Jan 24, 2025
1 parent 19cfaa1 commit 7e39064
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
54 changes: 42 additions & 12 deletions .github/workflows/ci-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ concurrency:
cancel-in-progress: true

jobs:
build_and_test_sdk:
name: Build and test clarinet-sdk packages
build_wasm:
name: Build Wasm packages
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -39,31 +39,61 @@ jobs:
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV
echo "NODE_VERSION_HASH=$(node --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV
# - name: Cache npm
# uses: actions/cache@v4
# with:
# path: |
# ~/node_modules/
# key: clarinet-sdk-npm-${{ runner.os }}-${{ env.NODE_VERSION_HASH }}-${{ hashFiles('./package-lock.json') }}

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/
~/target/release/build/
~/target/wasm32-unknown-unknown/build/
target/release/build/
target/wasm32-unknown-unknown/
key: clarinet-sdk-cargo-${{ runner.os }}-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}

- name: Cache npm
uses: actions/cache@v4
with:
path: |
~/node_modules/
key: clarinet-sdk-npm-${{ runner.os }}-${{ env.NODE_VERSION_HASH }}-${{ hashFiles('./package-lock.json') }}

- name: Install wasm-pack
run: npm install -g wasm-pack

- name: Run wasm-bindgen-test
run: wasm-pack test --node components/clarinet-sdk-wasm


- name: Build Wasm packages
run: npm run build:sdk-wasm

- name: Upload Wasm artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-artifacts
path: components/clarinet-sdk-wasm/pkg-*

test:
name: Run tests on multiple platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
needs: build_wasm
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Download Wasm artifacts
uses: actions/download-artifact@v4
with:
name: wasm-artifacts
path: components/clarinet-sdk-wasm
- name: Display structure of downloaded files
run: ls -R components/clarinet-sdk-wasm

- name: Install dependencies
run: npm ci

Expand Down
2 changes: 1 addition & 1 deletion components/clarinet-sdk/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"clean": "rimraf dist",
"compile": "tsc -b ./tsconfig.json",
"build": "npm run clean; npm run compile",
"build": "npm run clean && npm run compile",
"prepare": "npm run build"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/clarinet-sdk/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"scripts": {
"clean": "rimraf dist",
"compile": "tsc -b ./tsconfig.json ./tsconfig.cjs.json",
"build": "npm run clean; npm run compile; node ./scripts/prepare-esm-package.js",
"build": "npm run clean && npm run compile && node ./scripts/prepare-esm-package.js",
"prepare": "npm run build",
"pretest": "tsc -b ./tsconfig.json",
"test": "vitest run"
Expand Down
4 changes: 2 additions & 2 deletions components/clarity-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"lint": "eslint ./client/src ./server/src",
"dev:watch": "webpack -c ./webpack.config.dev.js -w",
"dev:browser": "vscode-test-web --extensionDevelopmentPath=. ./test-data --open-devtools",
"dev": "webpack -c ./webpack.config.dev.js; concurrently \"npm:dev:*\"",
"vscode:prepublish": "npm run clean; NODE_ENV=production webpack",
"dev": "webpack -c ./webpack.config.dev.js && concurrently \"npm:dev:*\"",
"vscode:prepublish": "npm run clean && NODE_ENV=production webpack",
"vsce:package": "vsce package",
"vsce:publish": "vsce publish",
"vsce:prerelease": "vsce publish --pre-release"
Expand Down

0 comments on commit 7e39064

Please sign in to comment.