Add embedded Postgres and reserve package placeholders #134
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 | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "**.md" | |
| - ".gitignore" | |
| - "LICENSE*" | |
| - "docs/**" | |
| push: | |
| branches: [main, rewrite] | |
| paths-ignore: | |
| - "**.md" | |
| - ".gitignore" | |
| - "LICENSE*" | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: "0" | |
| # All ordinary builds use the committed .sqlx offline cache. | |
| SQLX_OFFLINE: "true" | |
| jobs: | |
| validate: | |
| name: Validate | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| - name: fmt | |
| run: cargo fmt --all --check | |
| - name: clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: build | |
| run: cargo build --all-features | |
| - name: binding types match the schema (codegen drift guard) | |
| run: cargo run --manifest-path tools/codegen/Cargo.toml -- --check | |
| - name: client libraries match the core API contract | |
| run: python3 tools/api-contract/check.py | |
| - name: skill names match the bindings (skill drift guard) | |
| run: python3 tools/skill-check/check.py | |
| - name: unit tests (no database) | |
| run: cargo test | |
| msrv: | |
| name: MSRV (1.94) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.94 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: msrv | |
| - run: cargo check --all-features | |
| embedded: | |
| name: Embedded Postgres smoke | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [validate] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: embedded | |
| # Downloads the pinned PG 17 binaries on a cache miss, then boots, migrates, | |
| # and re-boots a persistent embedded server. | |
| - run: cargo test --features embedded --test embedded | |
| guardrails: | |
| name: Guardrails | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| # Pinned: an unpinned cargo-deny once drifted to a release that rejected | |
| # deny.toml's `unmaintained = "workspace"` key. These versions are verified. | |
| tool: cargo-deny@0.19.5,cargo-audit@0.22.1 | |
| - name: cargo deny | |
| run: cargo deny check | |
| - name: cargo audit | |
| run: cargo audit --deny warnings | |
| sqlx-cache: | |
| name: SQLx cache integrity | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| services: | |
| postgres: | |
| image: postgres:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: forge | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/forge | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: "false" | |
| - name: Install sqlx-cli | |
| run: cargo install sqlx-cli --locked --version 0.8.6 --no-default-features --features rustls,postgres | |
| - name: Apply migrations | |
| run: | | |
| for f in src/migrations/v*.sql; do | |
| psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f "$f" | |
| done | |
| - name: Regenerate .sqlx cache | |
| run: SQLX_OFFLINE=false cargo sqlx prepare -- --all-targets --all-features | |
| - name: Verify the committed cache is up to date | |
| run: git diff --exit-code .sqlx/ | |
| integration: | |
| name: Integration (pg-tests, PG ${{ matrix.postgres }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| needs: [validate] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # 17 is the documented minimum server version; 18 is current. | |
| postgres: [17, 18] | |
| services: | |
| postgres: | |
| image: postgres:${{ matrix.postgres }} | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: forge | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| # Each test creates its own throwaway database off this maintenance URL. | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/forge | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: "false" | |
| - name: contract + concurrency + crash-recovery tests | |
| run: cargo test --features pg-tests -- --test-threads=4 | |
| conformance: | |
| name: Conformance (cross-language) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 35 | |
| needs: [validate] | |
| services: | |
| postgres: | |
| image: postgres:18 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: forge | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| # Each scenario creates its own throwaway database off this maintenance URL. | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/forge | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: "false" | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: astral-sh/setup-uv@v5 | |
| # Builds both bindings and runs the Rust, Node, and Python runners; each | |
| # exits non-zero iff its failure set differs from src/conformance/known_gaps.json. | |
| - name: run all conformance runners | |
| run: bash tools/conformance/run-all.sh | |
| # The native addon was just built by run-all.sh; exercise the pure-JS wrapper. | |
| - name: node wrapper unit tests | |
| run: npm test | |
| working-directory: bindings/node |