Skip to content
Merged
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
18 changes: 7 additions & 11 deletions .github/workflows/conformance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ permissions:
contents: read

env:
# Keep the cross-run cache small; Cargo still reuses compiled dependencies.
# Cache reusable dependencies instead of incremental workspace builds.
CARGO_INCREMENTAL: "0"

jobs:
Expand All @@ -56,18 +56,14 @@ jobs:
go-version-file: go.work

- uses: dtolnay/rust-toolchain@stable
id: rust

- name: Cache Rust dependencies and build artifacts
uses: actions/cache@v6
# Prune build artifacts and keep shared caches in master's branch scope.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
rust/target
key: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('rust/**/Cargo.toml', 'rust/Cargo.lock') }}
restore-keys: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target

- uses: ./.github/actions/setup-js

Expand Down
113 changes: 70 additions & 43 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ permissions:
contents: read

env:
# Keep the cross-run cache small; Cargo still reuses compiled dependencies.
# Cache reusable dependencies instead of incremental workspace builds.
CARGO_INCREMENTAL: "0"

jobs:
Expand All @@ -38,28 +38,20 @@ jobs:

steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
id: rust
with:
components: clippy,rustfmt
- name: Cache Rust dependencies and build artifacts
uses: actions/cache@v6
# Prune workspace binaries, docs, and unused dependencies before saving.
# PRs restore master caches without saving duplicate branch snapshots.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
rust/target
key: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('rust/**/Cargo.toml', 'rust/Cargo.lock') }}
restore-keys: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
- uses: taiki-e/install-action@v2
with:
tool: cargo-deny@0.20.2
- uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks@0.51.0

- name: Lint, including Postgres-only and SQLite-only builds
run: make lint/rust
Expand All @@ -70,22 +62,66 @@ jobs:
- name: Dependency and license policy
run: make check/rust/dependencies

docsrs:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@nightly
# Key the nightly build cache with the compiler that actually builds it.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target/docsrs
- name: Documentation as docs.rs builds it
run: make doc/rust/docsrs

package:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
# Package verification intentionally compiles in a fresh temporary build
# directory; only registry downloads can be reused between runs.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
cache-targets: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
- name: Package archives
run: make check/rust/package

semver:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
- uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks@0.51.0
# Compare with the latest published Rust release tag, which the full
# checkout above includes. Before the first release there is no
# baseline and the step reports that instead of failing.
- name: Public API compatibility
run: make check/rust/semver

# docs.rs builds with a nightly toolchain and `--cfg docsrs`, which
# enables the crates' `doc_cfg` feature badges. Last, since installing
# nightly makes it the default toolchain for later steps.
- uses: dtolnay/rust-toolchain@nightly
- name: Documentation as docs.rs builds it
run: make doc/rust/docsrs

rust_versions:
runs-on: ubuntu-latest
timeout-minutes: 20
Expand All @@ -97,19 +133,14 @@ jobs:
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@master
id: rust
with:
toolchain: ${{ matrix.rust-version }}
- name: Cache Rust dependencies and build artifacts
uses: actions/cache@v6
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
rust/target
key: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('rust/**/Cargo.toml', 'rust/Cargo.lock') }}
restore-keys: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
workspaces: rust -> target
# Tests read fixtures generated from River's Go implementation.
- uses: actions/setup-go@v7
with:
Expand Down Expand Up @@ -145,17 +176,13 @@ jobs:
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
id: rust
- name: Cache Rust dependencies and build artifacts
uses: actions/cache@v6
# The database versions share build artifacts; one matrix job saves them.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
rust/target
key: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('rust/**/Cargo.toml', 'rust/Cargo.lock') }}
restore-keys: rust-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-${{ steps.rust.outputs.cachekey }}-
cache-bin: false
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.postgres-version == 18 }}
workspaces: rust -> target
# Tests read fixtures generated from River's Go implementation.
- uses: actions/setup-go@v7
with:
Expand Down
Loading