Repository navigation
docs(rewrite): the crate map, the deploying guide and the migration runbook (#1336) #3164
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Checks | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - rewrite/main | |
| concurrency: | |
| group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
| cancel-in-progress: true | |
| jobs: | |
| changes: | |
| name: Detect changed paths | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| src: ${{ steps.filter.outputs.src }} | |
| rust: ${{ steps.filter.outputs.rust }} | |
| steps: | |
| - uses: actions/checkout@v4.4.0 | |
| with: | |
| fetch-depth: 0 | |
| - id: filter | |
| uses: dorny/paths-filter@v3.0.4 | |
| with: | |
| filters: | | |
| src: | |
| - 'src/**' | |
| - 'test/**' | |
| - 'package.json' | |
| - 'pnpm-lock.yaml' | |
| - 'tsconfig*.json' | |
| - 'biome.json' | |
| - '.knip.json' | |
| - 'Dockerfile*' | |
| - 'docker-compose*.yml' | |
| - '.nvmrc' | |
| - 'resources/default-settings.yaml' | |
| - '.github/workflows/checks.yml' | |
| # A unit test reads these workflows, so a change to any of them | |
| # must run the suite that asserts on it. #965 changed release.yml | |
| # and skipped the very tests that change broke. | |
| - '.github/workflows/**' | |
| # test/unit/scripts/deploy-with-retry.spec.ts runs the deploy | |
| # script, so a change to it must run the suite that asserts on it. | |
| - '.github/scripts/**' | |
| rust: | |
| - 'crates/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'rust-toolchain.toml' | |
| - 'resources/default-settings.yaml' | |
| - 'scripts/rust.sh' | |
| - 'fuzz/**' | |
| - '.github/workflows/checks.yml' | |
| commit-lint: | |
| name: Lint commits | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4.3.0 | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - name: Install package dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run commitlint | |
| uses: wagoid/commitlint-github-action@v5.5.1 | |
| lint: | |
| name: Lint code | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.src == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| - uses: pnpm/action-setup@v4.3.0 | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - name: Install package dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Biome | |
| run: pnpm run lint | |
| - name: Run Knip | |
| run: pnpm run check:deps | |
| build-check: | |
| name: Build check | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.src == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| - uses: pnpm/action-setup@v4.3.0 | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - name: Install package dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run build check | |
| run: pnpm run build:check | |
| - name: Build artifacts | |
| run: pnpm run build | |
| - name: Verify built CLI entrypoint | |
| run: pnpm run verify:cli:build | |
| test-units-and-cover: | |
| name: Unit Tests And Coverage | |
| runs-on: ubuntu-latest | |
| needs: | |
| - changes | |
| - lint | |
| - build-check | |
| if: | | |
| needs.changes.outputs.src == 'true' && | |
| needs.lint.result == 'success' && | |
| needs.build-check.result == 'success' && | |
| github.head_ref != 'changeset-release/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| - uses: pnpm/action-setup@v4.3.0 | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - name: Install package dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run unit tests | |
| run: pnpm run test:unit | |
| - name: Run CLI test suite | |
| run: pnpm run test:cli | |
| - name: Run coverage for unit tests | |
| run: pnpm run cover:unit | |
| if: ${{ always() }} | |
| - uses: actions/upload-artifact@v4.6.2 | |
| name: Upload coverage report for unit tests | |
| if: ${{ always() }} | |
| with: | |
| name: unit-coverage-lcov | |
| path: .coverage/unit/lcov.info | |
| - name: Coveralls | |
| uses: coverallsapp/github-action@v2.3.6 | |
| if: ${{ always() }} | |
| with: | |
| path-to-lcov: ./.coverage/unit/lcov.info | |
| flag-name: Unit | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| parallel: true | |
| test-integrations-and-cover: | |
| name: Integration Tests and Coverage | |
| runs-on: ubuntu-latest | |
| needs: | |
| - changes | |
| - lint | |
| - build-check | |
| if: | | |
| needs.changes.outputs.src == 'true' && | |
| needs.lint.result == 'success' && | |
| needs.build-check.result == 'success' && | |
| github.head_ref != 'changeset-release/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| - uses: pnpm/action-setup@v4.3.0 | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Run integration tests | |
| run: pnpm run docker:test:integration | |
| - name: Generate Cucumber report annotations | |
| uses: deblockt/cucumber-report-annotations-action@v1.7 | |
| if: ${{ always() }} | |
| continue-on-error: true | |
| with: | |
| access-token: ${{ secrets.GITHUB_TOKEN }} | |
| path: .test-reports/integration/report.json | |
| - name: Run coverage for integration tests | |
| run: pnpm run docker:cover:integration | |
| - name: Coveralls | |
| uses: coverallsapp/github-action@v2.3.6 | |
| if: ${{ always() }} | |
| with: | |
| path-to-lcov: .coverage/integration/lcov.info | |
| flag-name: Integration | |
| parallel: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@v4.6.2 | |
| name: Upload coverage report for integration tests | |
| if: ${{ always() }} | |
| with: | |
| name: integration-coverage-lcov | |
| path: .coverage/integration/lcov.info | |
| post-tests: | |
| name: Post Tests | |
| runs-on: ubuntu-latest | |
| needs: | |
| - changes | |
| - test-units-and-cover | |
| - test-integrations-and-cover | |
| if: ${{ always() }} | |
| steps: | |
| - name: Coveralls Finished | |
| uses: coverallsapp/github-action@v2.3.6 | |
| if: | | |
| needs.test-units-and-cover.result != 'skipped' || | |
| needs.test-integrations-and-cover.result != 'skipped' | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| parallel-finished: true | |
| rust-checks: | |
| name: Rust Checks | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.rust == 'true' | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| # SHA-pinned (v4.4.0) with the workflow token not persisted into the clone — the | |
| # other two Rust actions are pinned the same way; the pre-existing Node jobs keep | |
| # their own checkout lines. | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| with: | |
| persist-credentials: false | |
| # rust-toolchain.toml is read automatically by the action's discovery (no toolchain-file | |
| # input exists; passing one only warns). Both actions are SHA-pinned per the house | |
| # convention the docker/* actions below already follow. | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1.17.0 | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2.9.2 | |
| - name: Check formatting | |
| run: cargo fmt --all --check | |
| - name: Clippy (all targets) | |
| run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| - name: Clippy (strict, lib+bins) | |
| run: >- | |
| cargo clippy --workspace --lib --bins --all-features -- | |
| -D warnings -D clippy::unwrap_used -D clippy::expect_used | |
| -D clippy::todo -D clippy::unimplemented -D clippy::panic | |
| - name: Tests | |
| run: cargo test --workspace --all-features | |
| # The database-backed storage targets create and migrate their own scratch databases; the | |
| # Cucumber half of the harness stays in scripts/storage-parity.sh. | |
| - name: Storage parity against Postgres | |
| env: | |
| PARITY_ADMIN_URL: postgres://postgres:postgres@localhost:5432/postgres | |
| run: cargo test -p nostream-storage --test migrations --test parity --test migration_pg --test clean_up -- --ignored --test-threads=1 | |
| # The daemon's own composition over Postgres (#1206): an event one nostreamd process | |
| # accepts is read back by a second, against a scratch database the target migrates. | |
| - name: Daemon store against Postgres | |
| env: | |
| PARITY_ADMIN_URL: postgres://postgres:postgres@localhost:5432/postgres | |
| run: cargo test -p nostreamd --all-features --test store_wiring -- --ignored --test-threads=1 | |
| # The benchmark rig's Postgres column: the same workload and the same `--verify` the LMDB | |
| # arm runs, against the scratch database it drops and recreates. The dev profile is | |
| # deliberate — this proves the path and the counts, and its timings are cited nowhere. | |
| - name: Benchmark harness against Postgres | |
| env: | |
| PARITY_ADMIN_URL: postgres://postgres:postgres@localhost:5432/postgres | |
| run: cargo run -p nostream-storage --example bench -- --backend postgres --events 2000 --seed 7 --verify --out /tmp/bench-postgres.json | |
| # `cargo test --workspace` builds an example target and never runs its tests, so the rig's | |
| # own tests need a command that does. They carry the rules `--verify` asserts. | |
| - name: Benchmark harness unit tests | |
| run: cargo test -p nostream-storage --all-features --example bench | |
| - name: Storage builds without the Postgres driver | |
| run: cargo check -p nostream-storage --no-default-features --all-targets | |
| - name: Release build | |
| run: cargo build --workspace --all-features --release | |
| # The fuzz crate is its own workspace, so none of the checks above see it — the job's own | |
| # `cargo fmt --all --check` skips `fuzz/`, and naming its manifest is what brings it under | |
| # the same pinned rustfmt. | |
| - name: Fuzz crate formatting | |
| run: cargo fmt --manifest-path fuzz/Cargo.toml --check | |
| # `cargo check` picks up `fuzz/rust-toolchain.toml` (nightly, which cargo-fuzz's | |
| # `-Zsanitizer` needs) and compiles only: no campaign runs here. A parser change that | |
| # breaks the crate fails this step instead of surfacing at the next campaign. | |
| - name: Fuzz crate compiles | |
| run: cd fuzz && cargo check | |
| kani-proofs: | |
| name: Kani proofs | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.rust == 'true' | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| with: | |
| persist-credentials: false | |
| # No toolchain action here on purpose: `kani-verifier` brings the nightly it | |
| # was built against, and `cargo kani setup` installs exactly that. The | |
| # repository's own pin is then irrelevant — which is also why the runner sets | |
| # RUSTUP_TOOLCHAIN=kani, or rustup would honour rust-toolchain.toml and run an | |
| # ordinary build with CBMC never starting. | |
| - name: Install Kani | |
| run: | | |
| cargo install --locked kani-verifier --version 0.68.0 | |
| cargo kani setup | |
| # `nostream-scan` has no dependencies, so this is seconds rather than a | |
| # workspace build: the proofs are about the scanner, not about the relay. | |
| - name: Prove the element scanner | |
| run: cargo kani -p nostream-scan | |
| windows-cli-check: | |
| name: Windows CLI Check | |
| runs-on: windows-latest | |
| needs: changes | |
| if: needs.changes.outputs.rust == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1.17.0 | |
| - name: Format, which covers the file Linux cannot reach | |
| run: cargo fmt --all --check | |
| - name: CLI builds on Windows | |
| run: cargo build -p nostream-cli --no-default-features | |
| - name: CLI refuses the migration on Windows | |
| run: cargo test -p nostream-cli --no-default-features --test migrate_cli_unsupported | |
| - name: CLI surface on Windows | |
| run: cargo test -p nostream-cli --no-default-features --test cli_surface_windows | |
| changeset-check: | |
| name: Changeset Required | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' && github.head_ref != 'changeset-release/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.4.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4.3.0 | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: pnpm | |
| - name: Install package dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Check for changeset | |
| run: pnpm exec changeset status --since origin/${{ github.base_ref }} | |
| lockfile: | |
| name: Actions lockfile | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| # Both steps call `gh`. The install clones over anonymous git, which | |
| # works but is rate-limited; the verify resolves tags, which is a API | |
| # call either way. One token for the job rather than one per step. | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - uses: actions/checkout@v4.4.0 | |
| - name: Install gh-actions-lock | |
| run: gh extension install github/gh-actions-lock --pin v0.4.1 | |
| - name: Verify the lockfile against the workflows | |
| run: gh actions-lock --verify |