name: CI on: push: branches: [master, main] pull_request: env: CARGO_TERM_COLOR: always RUSTFLAGS: -Dwarnings jobs: fmt: name: Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt - run: cargo fmt --all --check clippy: name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: components: clippy - uses: Swatinem/rust-cache@v2 - run: cargo clippy --all-targets --all-features doc: name: Docs runs-on: ubuntu-latest env: RUSTDOCFLAGS: -Dwarnings steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - run: cargo doc --workspace --all-features --no-deps # `mdbook build` and not `mdbook test`: the rust samples in `doc/` are # fragments naming types the surrounding prose never defines. With # `create-missing` off in book.toml, a SUMMARY entry pointing at nothing # fails here. book: name: Book runs-on: ubuntu-latest env: MDBOOK: 0.5.4 MDBOOK_MERMAID: 0.17.1 steps: - uses: actions/checkout@v4 # Prebuilt, because building mdBook from source costs more than the rest # of this workflow and nothing here needs a toolchain. - name: Install mdBook run: | mkdir -p "$HOME/.local/bin" echo "$HOME/.local/bin" >> "$GITHUB_PATH" base=https://github.com/rust-lang/mdBook/releases/download curl -sSfL \ "$base/v$MDBOOK/mdbook-v$MDBOOK-x86_64-unknown-linux-gnu.tar.gz" \ | tar -xz -C "$HOME/.local/bin" base=https://github.com/badboy/mdbook-mermaid/releases/download curl -sSfL \ "$base/v$MDBOOK_MERMAID/mdbook-mermaid-v$MDBOOK_MERMAID-x86_64-unknown-linux-gnu.tar.gz" \ | tar -xz -C "$HOME/.local/bin" - run: mdbook build test: name: Test (SQLite, i64) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 # Default features: the SQLite backend with the i64 Cent backing. - run: cargo test --all test-i128: name: Test (i128 backing) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 # Swap the Cent backing to i128 across the whole chain. Dashboard has no # i128 feature, so exclude it from the feature-scoped run. - run: cargo test --workspace --exclude kuatia-dashboard --features i128 test-postgres: name: Test (PostgreSQL) runs-on: ubuntu-latest services: postgres: image: postgres:16 env: POSTGRES_USER: kuatia POSTGRES_PASSWORD: kuatia POSTGRES_DB: kuatia ports: - 5432:5432 options: >- --health-cmd "pg_isready -U kuatia" --health-interval 10s --health-timeout 5s --health-retries 5 env: DATABASE_URL: postgres://kuatia:kuatia@localhost:5432/kuatia steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 # Run only the SQL backend's conformance suite against real Postgres, so # the Postgres-only code paths (FOR UPDATE locks, ON CONFLICT) are covered. - run: cargo test -p kuatia-storage-sql --no-default-features --features test-postgres