Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ca808cf
fix(wasm-sdk): correct DPNS test expectations to match contract spec
thephez Aug 20, 2025
5d69995
fix(wasm-sdk): add missing index_values parameter to get_contested_re…
thephez Aug 20, 2025
7363e0d
fix(wasm-sdk): resolve multiple failing tests in document-queries.tes…
thephez Aug 20, 2025
848de70
fix(wasm-sdk): fix utilities-simple.test.mjs failing tests
thephez Aug 20, 2025
6ebfc09
test: re-enable disabled test
thephez Aug 20, 2025
a789b41
ci(wasm-sdk): streamline test workflow to use unified test runner
thephez Aug 20, 2025
57fa222
ci(wasm-sdk): optimize test workflow to eliminate duplicate builds
thephez Aug 20, 2025
3e72beb
fix(wasm-sdk): prevent uploading stale test reports in CI
thephez Aug 20, 2025
d7ac3cc
ci: temporarily allow all branches to run workflow for testing
thephez Aug 20, 2025
4ab2b5a
ci(wasm-sdk): fix checkout ref in test workflow
thephez Aug 20, 2025
c3a0d72
ci(wasm-sdk): consolidate build and test workflows into single pipeline
thephez Aug 20, 2025
31d2811
ci(wasm-sdk): optimize CI workflow with sparse checkout and consolida…
thephez Aug 20, 2025
09fa5d4
chore: add closing newline in gitignore
thephez Aug 20, 2025
9f52983
ci(wasm-sdk): add test results summary to GitHub job output
thephez Aug 20, 2025
d0c0035
test(wasm-sdk): add error handling for offline quorum prefetch
thephez Aug 21, 2025
a3e4447
test(wasm-sdk): add ASCII homograph conversion test for DPNS
thephez Aug 21, 2025
090e9af
refactor(wasm-sdk): add DASHPAY_CONTRACT constant and update tests
thephez Aug 21, 2025
17b0980
ci(wasm-sdk): add concurrency control to build workflow
thephez Aug 21, 2025
1aa3c33
style(ci): fix whitespace and formatting in wasm-sdk-build workflow
thephez Aug 21, 2025
76ed4a3
test(wasm-sdk): disable wait_for_state_transition_result test tempora…
thephez Aug 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 127 additions & 21 deletions .github/workflows/wasm-sdk-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build WASM SDK
name: Build and Test WASM SDK

on:
pull_request:
Expand Down Expand Up @@ -26,37 +26,42 @@ on:
- 'packages/rs-context-provider/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C lto=off"
CARGO_PROFILE_RELEASE_LTO: false
CI: true

jobs:
build-wasm-sdk:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install protoc

- name: Install system dependencies (protoc, clang, llvm)
run: |
# Install protoc
curl -Lo /tmp/protoc.zip \
"https://github.com/protocolbuffers/protobuf/releases/download/v27.3/protoc-27.3-linux-x86_64.zip"
unzip -o /tmp/protoc.zip -d ${HOME}/.local
echo "${HOME}/.local/bin" >> $GITHUB_PATH
export PATH="${PATH}:${HOME}/.local/bin"

- name: Install clang
run: |

# Install clang and llvm
sudo apt update -qq
sudo apt install -qq --yes clang llvm

- name: Cache cargo dependencies
uses: actions/cache@v4
with:
Expand All @@ -68,7 +73,7 @@ jobs:
key: ${{ runner.os }}-cargo-wasm-sdk-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-wasm-sdk-

- name: Install wasm-pack
run: |
if ! command -v wasm-pack &> /dev/null; then
Expand All @@ -77,15 +82,15 @@ jobs:
else
echo "wasm-pack already installed"
fi

- name: Install wasm-opt
run: |
if ! command -v wasm-opt &> /dev/null; then
echo "Installing wasm-opt from GitHub releases..."
# Get the latest release version
WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest | grep -oP '"tag_name": "\K[^"]+')
echo "Installing wasm-opt version: $WASM_OPT_VERSION"

# Detect architecture
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
Expand All @@ -96,31 +101,31 @@ jobs:
echo "Unsupported architecture: $ARCH"
exit 1
fi

echo "Detected architecture: $ARCH, using binaryen arch: $BINARYEN_ARCH"

# Download and extract binaryen
curl -L "https://github.com/WebAssembly/binaryen/releases/download/${WASM_OPT_VERSION}/binaryen-${WASM_OPT_VERSION}-${BINARYEN_ARCH}-linux.tar.gz" -o /tmp/binaryen.tar.gz
tar -xzf /tmp/binaryen.tar.gz -C /tmp

# Move wasm-opt to PATH
sudo mv /tmp/binaryen-${WASM_OPT_VERSION}/bin/wasm-opt /usr/local/bin/
sudo chmod +x /usr/local/bin/wasm-opt

# Clean up
rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}

echo "wasm-opt installed successfully"
else
echo "wasm-opt already installed"
fi

- name: Build WASM SDK
working-directory: packages/wasm-sdk
run: |
chmod +x build.sh
./build.sh

- name: Verify build output
working-directory: packages/wasm-sdk
run: |
Expand All @@ -133,10 +138,111 @@ jobs:
test -f pkg/wasm_sdk.d.ts
test -f pkg/package.json
echo "Build verification successful!"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-sdk-build
path: packages/wasm-sdk/pkg/
retention-days: 7
retention-days: 7

test-wasm-sdk:
runs-on: ubuntu-latest
needs: build-wasm-sdk

steps:
- name: Checkout test directory only
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/wasm-sdk/test
sparse-checkout-cone-mode: false

- name: Download WASM SDK build artifacts
uses: actions/download-artifact@v4
with:
name: wasm-sdk-build
path: packages/wasm-sdk/pkg/

- name: Verify WASM SDK artifacts
working-directory: packages/wasm-sdk
run: |
echo "Verifying downloaded WASM SDK artifacts..."
ls -lah pkg/

# Verify all required files exist
required_files=(
"pkg/wasm_sdk_bg.wasm"
"pkg/optimized.wasm"
"pkg/wasm_sdk.js"
"pkg/wasm_sdk.d.ts"
"pkg/package.json"
)

for file in "${required_files[@]}"; do
if [ ! -f "$file" ]; then
echo "❌ Missing required file: $file"
exit 1
else
echo "✅ Found: $file"
fi
done

echo "🎉 All WASM SDK artifacts verified successfully!"

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

- name: Install test dependencies
working-directory: packages/wasm-sdk/test
run: |
if [ -f package.json ]; then
npm install
fi

- name: Run comprehensive test suite
working-directory: packages/wasm-sdk
run: |
echo "Running WASM SDK comprehensive test suite..."
node test/run-all-tests.mjs | tee test-output.log

- name: Generate job summary
if: always()
working-directory: packages/wasm-sdk
run: |
echo "## 🧪 WASM SDK Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Extract test results from the test output
if [ -f test-output.log ]; then
# Extract overall summary
total_tests=$(grep -o "Total Tests: [0-9]*" test-output.log | grep -o "[0-9]*" || echo "0")
total_passed=$(grep -o "Passed: [0-9]*" test-output.log | grep -o "[0-9]*" || echo "0")
total_failed=$(grep -o "Failed: [0-9]*" test-output.log | grep -o "[0-9]*" || echo "0")
total_time=$(grep -o "Time: [0-9]*\.[0-9]*s" test-output.log | grep -o "[0-9]*\.[0-9]*" || echo "0.00")

# Display overall summary
echo "**$total_tests** tests • **$total_passed** passed • **$total_failed** failed • **${total_time}s**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ "$total_failed" != "0" ]; then
echo "❌ **Some tests failed** - Check the detailed test report for specifics" >> $GITHUB_STEP_SUMMARY
else
echo "✅ **All tests passed**" >> $GITHUB_STEP_SUMMARY
fi
else
echo "⚠️ No test output captured" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "📦 **Artifacts**: WASM SDK build files and detailed test report available for download" >> $GITHUB_STEP_SUMMARY

- name: Upload test report
if: always() && hashFiles('packages/wasm-sdk/test/test-report.html') != ''
uses: actions/upload-artifact@v4
with:
name: wasm-sdk-test-report
path: packages/wasm-sdk/test/test-report.html
retention-days: 7
Loading
Loading