Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
90 changes: 64 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,30 @@ jobs:
- uses: dtolnay/rust-toolchain@5b842231ba77f5c045dba54ac5560fed2db780e2 # nightly
with:
toolchain: nightly
components: rustfmt

- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22

- name: Install workspace deps
run: npm ci --ignore-scripts

# codegen.sh emits the gitignored generated TS first and only then
# installs/builds the npm workspace, so package `prepare` (tsc -b)
# scripts see the generated modules. Installing the workspace before
# codegen fails: npm runs the truapi-host-wasm prepare build against
# sources whose ./generated imports don't exist yet.
- name: Run codegen
run: ./scripts/codegen.sh

- name: Check committed Rust codegen output is current
run: git diff --exit-code -- rust/crates/truapi-server/src/generated

- name: Wire-table parity (Rust vs generated TS)
run: cargo test -p truapi-server --test wire_table_ts_parity
env:
TRUAPI_REQUIRE_GENERATED_TS: 1

- name: Upload codegen output
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
Expand All @@ -101,6 +112,7 @@ jobs:
js/packages/truapi/src/explorer/codegen
js/packages/truapi/src/explorer/versions.ts
js/packages/truapi-host/src/generated
js/packages/truapi-host-wasm/src/generated
playground/test/generated

ts-client:
Expand Down Expand Up @@ -219,60 +231,86 @@ jobs:
run: npm run build

e2e:
name: E2E (playground inside dotli)
# Temporarily disabled while the dotli playground smoke test is stabilized.
if: false
name: E2E (dotli playground diagnosis)
runs-on: ubuntu-latest
needs: playground
timeout-minutes: 30
timeout-minutes: 35
env:
TRUAPI_REQUIRE_GENERATED: 1
SIGNER_BOT_SVC_TOKEN: ${{ secrets.SIGNER_BOT_SVC_TOKEN }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
persist-credentials: false

- name: Check dotli submodule access
id: dotli-access
env:
DOTLI_CHECKOUT_TOKEN: ${{ secrets.DOTLI_CHECKOUT_TOKEN }}
run: |
if [ -n "$DOTLI_CHECKOUT_TOKEN" ]; then
git config --global url."https://x-access-token:${DOTLI_CHECKOUT_TOKEN}@github.com/".insteadOf "https://github.com/"
fi
if git ls-remote https://github.com/paritytech/dotli.git >/dev/null 2>&1; then
echo "available=true" >> "$GITHUB_OUTPUT"
git submodule update --init --recursive hosts/dotli
else
echo "::warning::dotli submodule is not accessible to this workflow; skipping dotli e2e."
echo "available=false" >> "$GITHUB_OUTPUT"
fi

- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
if: steps.dotli-access.outputs.available == 'true'
with:
node-version: 22

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
if: steps.dotli-access.outputs.available == 'true'
with:
bun-version: latest

- uses: dtolnay/rust-toolchain@5b842231ba77f5c045dba54ac5560fed2db780e2 # stable
if: steps.dotli-access.outputs.available == 'true'
with:
toolchain: stable

- name: Download codegen output
if: steps.dotli-access.outputs.available == 'true'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: codegen-output

- name: Build @parity/truapi
run: |
npm ci --ignore-scripts
npm run build --prefix js/packages/truapi
- name: Install wasm-pack
if: steps.dotli-access.outputs.available == 'true'
run: cargo install wasm-pack --version 0.14.0 --locked

- name: Install dotli deps
if: steps.dotli-access.outputs.available == 'true'
working-directory: hosts/dotli
run: bun install --frozen-lockfile

- name: Install playground deps
working-directory: playground
run: yarn install --frozen-lockfile

- name: Install Playwright browsers
working-directory: playground
run: npx playwright install --with-deps chromium
if: steps.dotli-access.outputs.available == 'true'
working-directory: hosts/dotli/apps/host
run: bunx playwright install --with-deps chromium

- name: Run Playwright e2e
working-directory: playground
run: yarn e2e

- name: Upload Playwright report
if: failure()
- name: Run dotli diagnosis e2e
if: steps.dotli-access.outputs.available == 'true'
run: |
if [ -n "$SIGNER_BOT_SVC_TOKEN" ]; then
make e2e-dotli
else
echo "::warning::SIGNER_BOT_SVC_TOKEN is unavailable; running QR smoke mode only."
E2E_DOTLI_SMOKE=1 make e2e-dotli
fi

- name: Upload dotli e2e results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report
path: playground/playwright-report
name: dotli-e2e-results
path: hosts/dotli/test-results/e2e-dotli
if-no-files-found: ignore
retention-days: 14

ci-status:
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/host-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: host-packages
on:
push:
branches: [main]
paths:
- 'js/packages/truapi-host-wasm/**'
- 'rust/crates/truapi-server/**'
- 'rust/crates/truapi-platform/**'
- 'rust/crates/truapi-codegen/**'
- 'rust/crates/truapi-macros/**'
- 'rust/crates/truapi/**'
pull_request:
paths:
- 'js/packages/truapi-host-wasm/**'
- 'rust/crates/truapi-server/**'
- 'rust/crates/truapi-platform/**'
- 'rust/crates/truapi-codegen/**'
- 'rust/crates/truapi-macros/**'
- 'rust/crates/truapi/**'

jobs:
wasm-bundle-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: actions/setup-node@v4
with: { node-version: 22 }
- name: Install wasm-pack
run: cargo install wasm-pack
# Builds the bundle from the current truapi-server source and runs the
# truapi-host-wasm node smoke test against those freshly-built artifacts.
# The dist/wasm/ artifacts are gitignored; every consumer (local dev via
# `make wasm`, CI here) builds them from the Rust source.
- name: Build WASM
run: make wasm
- name: Sanity-check artifact presence
run: |
test -s js/packages/truapi-host-wasm/dist/wasm/web/truapi_server_bg.wasm
test -s js/packages/truapi-host-wasm/dist/wasm/web/truapi_server.js
test -s js/packages/truapi-host-wasm/dist/wasm/node/truapi_server_bg.wasm
test -s js/packages/truapi-host-wasm/dist/wasm/node/truapi_server.js
- name: Build @parity/truapi-host (dep)
run: cd js/packages/truapi-host && npm install --no-fund --no-audit && npm run build
- name: Build @parity/truapi client (dep)
run: cd js/packages/truapi && npm install --no-fund --no-audit && npm run build
- name: Test @parity/truapi-host-wasm against the rebuilt bundle
run: cd js/packages/truapi-host-wasm && npm install --no-fund --no-audit && npm test
host-packages-js-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: actions/setup-node@v4
with: { node-version: 22 }
- name: Install wasm-pack
run: cargo install wasm-pack
# The truapi-host-wasm tests load dist/wasm/{web,node}, which is
# gitignored, so build it from the Rust source first.
- name: Build WASM
run: make wasm
- name: Build @parity/truapi-host (dep)
run: cd js/packages/truapi-host && npm install --no-fund --no-audit && npm run build
- name: Build @parity/truapi client (dep)
run: cd js/packages/truapi && npm install --no-fund --no-audit && npm run build
- name: Test @parity/truapi-host-wasm
run: cd js/packages/truapi-host-wasm && npm install --no-fund --no-audit && npm test
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ lerna-debug.log*
node_modules
target

# Gradle (Android workspace at repo root)
/.gradle/
/build/
/android/*/build/
local.properties

# Environment / secrets (never commit real env files; keep example templates)
.env
.env.*
Expand Down Expand Up @@ -39,3 +45,16 @@ playground/public/static.files

# Auto-generated by truapi-codegen (typecheck fixtures for rustdoc ts blocks)
playground/test/generated/

# Auto-generated FFI / WASM binding outputs
android/truapi-host/src/main/kotlin/generated/
ios/truapi-host/Sources/TrUAPIHost/truapi_server.swift
ios/truapi-host/Sources/truapi_serverFFI/
rust/crates/truapi-server/pkg/
js/packages/truapi/src/generated/
js/packages/truapi/dist/generated/
js/packages/truapi-host/src/generated/
js/packages/truapi-host/dist/generated/
js/packages/truapi-host-wasm/src/generated/
js/packages/truapi-host-wasm/dist/generated/
js/packages/truapi-host-wasm/dist/wasm/
Loading
Loading