Skip to content

fix(indexer): repair capture — cold-start cursor + ingest scope #413

fix(indexer): repair capture — cold-start cursor + ingest scope

fix(indexer): repair capture — cold-start cursor + ingest scope #413

Workflow file for this run

name: PR Tests
# Runs on every PR and on push to dev. Four parallel jobs — wall-clock
# is the slowest one (usually `tests`). A new push to the same ref
# cancels the previous run.
on:
pull_request:
push:
branches: [dev]
concurrency:
group: pr-tests-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
# `CARGO_*_DEBUG=0` strips debuginfo so test binaries stay within runner
# memory — the full debug profile on nightly + tvm-sdk has hit rust-lld
# Bus errors. `CARGO_INCREMENTAL=0` — incremental compile only bloats
# the cache in CI without payoff (every runner is fresh).
env:
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
jobs:
fmt-clippy:
name: fmt + clippy
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
# nightly is required because `rustfmt.toml` sets
# `unstable_features = true`.
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
# `shared-key` drops the job name from the cache key → all 3 jobs
# in this workflow read/write the same cache. Parallel jobs in the
# same run still build independently (cache save happens at end of
# job, not during). The win is on subsequent runs: after the first
# green PR, all 3 jobs hit cache. Cold ~12-15 min (tvm-sdk),
# warm ~30-60 s per job.
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: pr-tests
cache-on-failure: true
- name: cargo fmt --all --check
run: cargo fmt --all --check
# `--no-deps` skips crates.io deps (we don't control their
# warnings); `--all-targets` covers tests + examples + bins.
#
# `double_must_use` is allowed because it fires on code no one here
# writes: `#[async_trait]` expands each trait method to a `#[must_use]`
# function returning `Pin<Box<dyn Future>>`, which is itself already
# `must_use`, and clippy reports the redundancy against the macro's
# output. Clippy normally suppresses lints originating in an external
# macro; this one slips through, so the only place to silence it is
# here — the offending attribute exists solely in the expansion, and
# there is no source line to annotate. Every `#[async_trait]` trait in
# the workspace trips it, so `-D warnings` fails the whole job.
#
# Drop this flag once the upstream lint stops firing on macro
# expansions: remove it, run the command below, and if it is clean the
# workaround has outlived its cause.
- name: cargo clippy
run: cargo clippy --workspace --all-targets --no-deps -- -D warnings -A clippy::double_must_use
tests:
name: tests (Postgres + nextest)
runs-on: ubuntu-latest
timeout-minutes: 30
env:
# Tests read TEST_DATABASE_URL from env, see README.md#test-postgres.
# Locally the port is 55432 (via docker-compose.test.yml); in CI
# it's 5432 (the conventional default — runner has nothing else
# bound to it).
TEST_DATABASE_URL: postgres://dodex:dodex@localhost:5432/dodex_test
services:
# Matches docker-compose.test.yml on image / creds / settings;
# only the port differs (5432 in CI vs 55432 locally). The schema
# is created in tests via `sqlx::migrate!`, so the container only
# needs to bring up an empty database.
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: dodex
POSTGRES_PASSWORD: dodex
POSTGRES_DB: dodex_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U dodex -d dodex_test"
--health-interval 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: pr-tests
cache-on-failure: true
# Pre-built binary, ~10 s install. The `cargo install
# cargo-nextest` alternative compiles for ~3 min from scratch.
- name: Install nextest
uses: taiki-e/install-action@nextest
# nextest runs integration test binaries in parallel (cargo test
# runs them sequentially). With 25+ integration crates this is a
# noticeable runtime win. `#[ignore]`-marked shellnet e2e_* tests
# are skipped by default (`--run-ignored=all` includes them).
- name: cargo nextest run
run: cargo nextest run --workspace --no-fail-fast
# nextest does not run doctests — separate step.
- name: cargo test --doc
run: cargo test --workspace --doc
openapi-drift:
name: openapi drift guard
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: pr-tests
cache-on-failure: true
- name: Regenerate openapi.yaml from Rust source
run: cargo run --quiet -p dodex-api --bin gen-openapi -- --out /tmp/openapi.yaml
- name: Diff against committed docs/openapi.yaml
run: |
if ! diff -u docs/openapi.yaml /tmp/openapi.yaml; then
echo
echo "docs/openapi.yaml is out of sync with services/api."
echo "Run: cargo run -p dodex-api --bin gen-openapi"
echo "and commit the result."
exit 1
fi
sdk-harness-tests:
name: sdk harness unit tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with: { shared-key: sdk-tests, cache-on-failure: true }
- uses: taiki-e/install-action@nextest
# sdk/ is its own workspace and sits outside `cargo nextest run
# --workspace` above, so it gets its own run. No filter: everything in
# there that needs a chain is `#[ignore]`d, so a plain run is exactly the
# hermetic set — and a new hermetic test is picked up by having been
# written, rather than by happening to match one of a list of name
# patterns.
#
# The count guard stays. Without it this step would pass just as happily
# having run nothing at all, which is what an over-eager `#[ignore]` or a
# broken test binary would look like.
- name: nextest (sdk harness units)
run: |
N=$(cargo nextest list --manifest-path sdk/Cargo.toml | grep -c '::')
test "$N" -ge 60
cargo nextest run --manifest-path sdk/Cargo.toml --no-fail-fast
# Gated e2e: only after fmt/clippy, tests and openapi-drift are green.
# Delegates to the reusable e2e-shellnet workflow (real shellnet,
# single-threaded). It self-provisions a fresh seed note per run
# (mint_pn_pool) and drains it in teardown — no secret needed.
e2e:
name: e2e (shellnet)
needs: [fmt-clippy, tests, openapi-drift]
uses: ./.github/workflows/e2e-shellnet.yml
secrets: inherit