Skip to content
Draft
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
19 changes: 19 additions & 0 deletions .github/actions/setup-integration-test-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ inputs:
description: Build the framework Docker images used by integration tests.
required: false
default: "true"
build-cloudflare:
description: Build the Cloudflare Workers bundle (wasm32-unknown-unknown) for integration tests.
required: false
default: "false"

outputs:
node-version:
Expand Down Expand Up @@ -104,3 +108,18 @@ runs:
--build-arg NODE_VERSION=${{ steps.node-version.outputs.node-version }} \
-t test-nextjs:latest \
crates/integration-tests/fixtures/frameworks/nextjs/

- name: Add wasm32-unknown-unknown target for Cloudflare build
if: ${{ inputs.build-cloudflare == 'true' }}
shell: bash
run: rustup target add wasm32-unknown-unknown

- name: Build Cloudflare Workers bundle
if: ${{ inputs.build-cloudflare == 'true' }}
shell: bash
env:
TRUSTED_SERVER__PUBLISHER__ORIGIN_URL: http://127.0.0.1:${{ inputs.origin-port }}
TRUSTED_SERVER__PUBLISHER__PROXY_SECRET: integration-test-proxy-secret
TRUSTED_SERVER__SYNTHETIC__SECRET_KEY: integration-test-secret-key
TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK: "false"
run: bash crates/trusted-server-adapter-cloudflare/build.sh
26 changes: 23 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
WASM_ARTIFACT_PATH: /tmp/integration-test-artifacts/wasm/trusted-server-adapter-fastly.wasm
AXUM_ARTIFACT_PATH: /tmp/integration-test-artifacts/axum/trusted-server-axum
DOCKER_ARTIFACT_PATH: /tmp/integration-test-artifacts/docker/test-images.tar
CF_BUILD_ARTIFACT_PATH: /tmp/integration-test-artifacts/cloudflare/build

jobs:
prepare-artifacts:
Expand All @@ -30,12 +31,14 @@ jobs:
with:
origin-port: ${{ env.ORIGIN_PORT }}
install-viceroy: "false"
build-cloudflare: "true"

- name: Package integration test artifacts
run: |
mkdir -p "$(dirname "$WASM_ARTIFACT_PATH")" "$(dirname "$AXUM_ARTIFACT_PATH")" "$(dirname "$DOCKER_ARTIFACT_PATH")"
mkdir -p "$(dirname "$WASM_ARTIFACT_PATH")" "$(dirname "$AXUM_ARTIFACT_PATH")" "$(dirname "$DOCKER_ARTIFACT_PATH")" "$CF_BUILD_ARTIFACT_PATH"
cp target/wasm32-wasip1/release/trusted-server-adapter-fastly.wasm "$WASM_ARTIFACT_PATH"
cp target/debug/trusted-server-axum "$AXUM_ARTIFACT_PATH"
cp -r crates/trusted-server-adapter-cloudflare/build/. "$CF_BUILD_ARTIFACT_PATH/"
docker save \
--output "$DOCKER_ARTIFACT_PATH" \
test-wordpress:latest test-nextjs:latest
Expand All @@ -51,7 +54,7 @@ jobs:
name: integration tests
needs: prepare-artifacts
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 20
steps:
- uses: actions/checkout@v4

Expand All @@ -63,6 +66,7 @@ jobs:
check-dependency-versions: "false"
install-viceroy: "true"
build-wasm: "false"
build-axum: "false"
build-test-images: "false"

- name: Download integration test artifacts
Expand All @@ -74,18 +78,34 @@ jobs:
- name: Make binaries executable
run: chmod +x "$AXUM_ARTIFACT_PATH"

- name: Restore Cloudflare Workers bundle
run: |
mkdir -p crates/trusted-server-adapter-cloudflare/build
cp -r "$CF_BUILD_ARTIFACT_PATH/." crates/trusted-server-adapter-cloudflare/build/

- name: Load integration test Docker images
run: docker load --input "$DOCKER_ARTIFACT_PATH"

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ steps.shared-setup.outputs.node-version }}

- name: Install wrangler
run: npm install -g wrangler

- name: Run integration tests
run: >-
cargo test
--manifest-path crates/integration-tests/Cargo.toml
--target x86_64-unknown-linux-gnu
-- --include-ignored --skip test_wordpress_fastly --skip test_nextjs_fastly --test-threads=1
-- --include-ignored
--skip test_wordpress_fastly --skip test_nextjs_fastly
--test-threads=1
env:
WASM_BINARY_PATH: ${{ env.WASM_ARTIFACT_PATH }}
AXUM_BINARY_PATH: ${{ env.AXUM_ARTIFACT_PATH }}
CLOUDFLARE_WRANGLER_DIR: ${{ github.workspace }}/crates/trusted-server-adapter-cloudflare
INTEGRATION_ORIGIN_PORT: ${{ env.ORIGIN_PORT }}
RUST_LOG: info

Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,33 @@ jobs:
- name: Run Axum adapter tests
run: cargo test -p trusted-server-adapter-axum

test-cloudflare:
name: cargo check (cloudflare native + wasm32-unknown-unknown)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Retrieve Rust version
id: rust-version
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
shell: bash

- name: Set up Rust toolchain (native + wasm32-unknown-unknown)
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version.outputs.rust-version }}
target: wasm32-unknown-unknown
cache-shared-key: cargo-${{ runner.os }}

- name: Check Cloudflare adapter (native host)
run: cargo check -p trusted-server-adapter-cloudflare

- name: Check Cloudflare adapter (wasm32-unknown-unknown)
run: cargo check -p trusted-server-adapter-cloudflare --target wasm32-unknown-unknown --features cloudflare

- name: Run Cloudflare adapter tests (native host)
run: cargo test -p trusted-server-adapter-cloudflare

test-typescript:
name: vitest
runs-on: ubuntu-latest
Expand Down
12 changes: 11 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ real-time bidding integration, and publisher-side JavaScript injection.
crates/
trusted-server-core/ # Core library — shared logic, integrations, HTML processing
trusted-server-adapter-fastly/ # Fastly Compute entry point (wasm32-wasip1 binary)
trusted-server-adapter-axum/ # Axum dev server entry point (native binary, excluded from workspace)
trusted-server-adapter-axum/ # Axum dev server entry point (native binary)
trusted-server-adapter-cloudflare/ # Cloudflare Workers entry point (wasm32-unknown-unknown binary)
js/ # TypeScript/JS build — per-integration IIFE bundles
lib/ # TS source, Vitest tests, esbuild pipeline
```
Expand Down Expand Up @@ -56,6 +57,15 @@ cargo run -p trusted-server-adapter-axum

# Test Axum adapter only
cargo test -p trusted-server-adapter-axum

# Check Cloudflare adapter (native)
cargo check -p trusted-server-adapter-cloudflare

# Check Cloudflare adapter (WASM target)
cargo check -p trusted-server-adapter-cloudflare --target wasm32-unknown-unknown

# Test Cloudflare adapter
cargo test -p trusted-server-adapter-cloudflare
```

### Testing & Quality
Expand Down
Loading
Loading