Skip to content
Open
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
8 changes: 5 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ Closes #

<!-- How did you verify this works? Check all that apply -->

- [ ] `cargo test --workspace`
- [ ] `cargo clippy --workspace --all-targets --all-features -- -D warnings`
- [ ] `cargo test --workspace --exclude trusted-server-cli`
- [ ] `cargo test --package trusted-server-cli --target "$(rustc -vV | sed -n 's/^host: //p')"`
- [ ] `cargo clippy --workspace --exclude trusted-server-cli --all-targets --all-features -- -D warnings`
- [ ] `cargo clippy --package trusted-server-cli --target "$(rustc -vV | sed -n 's/^host: //p')" --all-targets -- -D warnings`
- [ ] `cargo fmt --all -- --check`
- [ ] JS tests: `cd crates/js/lib && npx vitest run`
- [ ] JS format: `cd crates/js/lib && npm run format`
Expand All @@ -37,6 +39,6 @@ Closes #

- [ ] Changes follow [CLAUDE.md](/CLAUDE.md) conventions
- [ ] No `unwrap()` in production code — use `expect("should ...")`
- [ ] Uses `tracing` macros (not `println!`)
- [ ] Uses `log` macros (not `println!`)
- [ ] New code has tests
- [ ] No secrets or credentials committed
29 changes: 28 additions & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,34 @@ jobs:
uses: actions-rust-lang/rustfmt@v1

- name: Run cargo clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
run: cargo clippy --workspace --exclude trusted-server-cli --all-targets --all-features -- -D warnings

format-rust-cli-host:
name: cargo clippy (trusted-server-cli host)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Set up rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version-cli.outputs.rust-version }}
target: wasm32-wasip1
components: "clippy, rustfmt"
cache-shared-key: cargo-${{ runner.os }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick — Same cache-shared-key: cargo-${{ runner.os }} is reused across the wasm-target workspace lane and the host-target CLI lane (here, line 55, and test.yml lines 29 and 65). Concurrent jobs may contend on cache writes. Distinct keys per target (cargo-${{ runner.os }}-wasm vs -host) are safer.


- name: Retrieve Rust host target
id: rust-host-target
run: echo "host-target=$(rustc -vV | sed -n 's/^host: //p')" >> $GITHUB_OUTPUT
shell: bash

- name: Run trusted-server-cli clippy
run: cargo clippy --package trusted-server-cli --target "${{ steps.rust-host-target.outputs.host-target }}" --all-targets -- -D warnings

format-typescript:
runs-on: ubuntu-latest
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,33 @@ jobs:
run: cargo install --git https://github.com/fastly/Viceroy viceroy

- name: Run tests
run: cargo test --workspace
run: cargo test --workspace --exclude trusted-server-cli

test-cli-host:
name: cargo test (trusted-server-cli host)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

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

- name: Retrieve Rust host target
id: rust-host-target
run: echo "host-target=$(rustc -vV | sed -n 's/^host: //p')" >> $GITHUB_OUTPUT
shell: bash

- name: Run trusted-server-cli tests
run: cargo test --package trusted-server-cli --target "${{ steps.rust-host-target.outputs.host-target }}"

test-typescript:
name: vitest
Expand Down
28 changes: 18 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,20 @@ fastly compute publish
### Testing & Quality

```bash
# Run all Rust tests (uses viceroy)
cargo test --workspace
# Run wasm-target Rust tests for the existing runtime crates (uses viceroy)
cargo test --workspace --exclude trusted-server-cli

# Run host-target CLI tests
cargo test --package trusted-server-cli --target "$(rustc -vV | sed -n 's/^host: //p')"

# Format
cargo fmt --all -- --check

# Lint
cargo clippy --workspace --all-targets --all-features -- -D warnings
# Lint wasm-target runtime crates
cargo clippy --workspace --exclude trusted-server-cli --all-targets --all-features -- -D warnings

# Lint host-target CLI crate
cargo clippy --package trusted-server-cli --target "$(rustc -vV | sed -n 's/^host: //p')" --all-targets -- -D warnings

# Check compilation
cargo check
Expand Down Expand Up @@ -268,11 +274,13 @@ IntegrationRegistration::builder(ID)
Every PR must pass:

1. `cargo fmt --all -- --check`
2. `cargo clippy --workspace --all-targets --all-features -- -D warnings`
3. `cargo test --workspace`
4. JS build and test (`cd crates/js/lib && npx vitest run`)
5. JS format (`cd crates/js/lib && npm run format`)
6. Docs format (`cd docs && npm run format`)
2. `cargo clippy --workspace --exclude trusted-server-cli --all-targets --all-features -- -D warnings`
3. `cargo test --workspace --exclude trusted-server-cli`
4. `cargo clippy --package trusted-server-cli --target "$(rustc -vV | sed -n 's/^host: //p')" --all-targets -- -D warnings`
5. `cargo test --package trusted-server-cli --target "$(rustc -vV | sed -n 's/^host: //p')"`
6. JS build and test (`cd crates/js/lib && npx vitest run`)
7. JS format (`cd crates/js/lib && npm run format`)
8. Docs format (`cd docs && npm run format`)

---

Expand All @@ -282,7 +290,7 @@ Every PR must pass:
2. **Get approval** — for non-trivial changes, present a plan first.
3. **Implement incrementally** — small, testable changes. Every change should
impact as little code as possible.
4. **Test after every change** — `cargo test --workspace`.
4. **Test after every change** — run the relevant Rust lane(s): `cargo test --workspace --exclude trusted-server-cli` for the runtime crates and `cargo test --package trusted-server-cli --target "$(rustc -vV | sed -n 's/^host: //p')"` for the CLI.
5. **Explain as you go** — describe what you changed and why.
6. **If blocked** — explain what's blocking and why.

Expand Down
Loading
Loading