Files
qdrant/.github/workflows/rust.yml
qdrant-cloud-bot 9efc061764 ci: fix and consolidate Rust build caches (#9516)
* ci: fix rust-cache running before checkout in shard-snapshot job

The `test-shard-snapshot-api-s3-minio` job ran `Swatinem/rust-cache`
before `actions/checkout`, so there was no `Cargo.lock`/source present
when the cache action ran. As a result the action no-opped and the job
never actually restored or saved a Rust build cache. Move the cache
step to run after checkout.

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: remove dead rust-cache steps from docker-only jobs

These jobs only build Docker images via `docker buildx`/docker build
and never invoke cargo directly, so the `Swatinem/rust-cache` step
never populates or restores anything useful:

- integration-tests.yml: `test-consistency` (docker buildx + shell
  consistency checks only)
- docker-image.yml: `build` and `build-gpu` (docker buildx only)

Drop the unused cache steps.

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: drop rust-cache from coverage and release workflows

These workflows run on rare triggers (coverage: nightly schedule;
release-artifacts: on release publish), so by the time they run again
their cache is almost always already evicted from the 10 GB Actions
cache budget. They mostly just consume cache space that would otherwise
be useful to the frequently-run PR builds, so remove the rust-cache
steps entirely:

- coverage.yml: unit-coverage and integration-coverage
- release-artifacts.yml: build-windows-binaries

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: drop explicit clippy cache key in rust-lint

The lint job has no compatible cache peer to share with: clippy
produces clippy-driver metadata that cargo fingerprints separately
from normal build/test artifacts, and its `--all-features` invocation
pulls in the GPU dependency crates, so it matches neither the
rust-tests nor the gpu group. With nothing to share, the explicit
`key: clippy` is equivalent to the default per-job key, so drop it for
consistency with the rest of the workflows.

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: dedicated rust-cache keys with single writer per group

Give related jobs explicit cache keys and let only the broadest build
in each group save the cache (`save-if: "false"` on the others), so a
narrower build can't overwrite it with fewer compiled dependencies
first.

- `rust-tests` (rust.yml): explicit `shared-key: rust-tests`. It builds
  `--workspace --tests`, which pulls in dev-dependency features that the
  integration-tests builds (plain `cargo build`) do not, so it is kept
  as its own dependency cache rather than merged with integration-tests.
- `integration-tests`: writer = integration-tests; readers =
  integration-tests-consensus, test-shard-snapshot-api-s3-minio.
- `edge`: writer = edge-test (clippy + examples build); reader =
  edge-rust-check. Both build the amalgamated qdrant-edge `examples`
  package.

rust-gpu keeps its own default cache (the `gpu` feature adds the
ash/gpu-allocator/shaderc dependency crates).

Co-authored-by: Cursor <cursoragent@cursor.com>

* Reuse `integration-tests` build cache for `io-bridge-object-store-tests` workflow

* Cleanup Docker cache in GHA workflows

* ci: only save rust-cache on the integration branch

Under the 10 GB Actions cache budget there's no practical benefit to
saving feature-branch build caches: they'd be evicted before being
reused. Scope every rust-cache *writer* to save only on `dev` (the
branch PRs target and restore from) via `save-if`:

- rust.yml, rust-lint.yml, edge-test.yml, integration-tests.yml

Reader jobs already have `save-if: "false"` and are unchanged.

Also drop rust-cache from rust-gpu.yml entirely: it only runs on
`master` pushes (releases, a few times a month at most), so any cache
would always be evicted between runs.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>
2026-06-20 13:44:45 +02:00

117 lines
4.5 KiB
YAML

name: Rust tests
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ '**' ]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
rust-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Install minimal stable
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
# Only save the cache on dev; feature-branch caches would just get evicted under the 10 GB budget
save-if: ${{ github.ref == 'refs/heads/dev' }}
- name: Install Protoc
uses: ./.github/actions/setup-protoc
- name: Install mold
uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
- name: Enable mold on Linux
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
mkdir .cargo
echo "[target.x86_64-unknown-linux-gnu]" >> .cargo/config.toml
echo "linker = \"clang\"" >> .cargo/config.toml
echo "rustflags = [\"-C\", \"link-arg=-fuse-ld=/usr/local/bin/mold\"]" >> .cargo/config.toml
fi
shell: bash
- name: Install nextest
uses: taiki-e/install-action@3a0adc33ab45d7b9b9da91822dd2b3c0151704be # nextest
- name: Build
run: cargo build --workspace --tests --locked
- name: Run tests
# Profile "ci" is configured in .config/nextest.toml
run: cargo nextest run --workspace --profile ci --locked
- name: Upload test report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-${{ matrix.os }}.xml
path: target/nextest/ci/junit.xml
# After tests are run, this hacky script will process the JUnit output of nextest
# and will create a GH Issue if there is a test marked as flaky,
# Failure of updating an issue is ignored because it fails for external contributors.
process-results:
runs-on: ubuntu-latest
needs: rust-tests
permissions:
contents: read
issues: write
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Download test report
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: junit-${{ matrix.os }}.xml
- name: Process test report
id: process-test-report
run: |
pip install yq
xq '.. | select(type == "object") | select(has("flakyFailure"))' junit.xml > flaky_tests.json
echo has_flaky_tests=$(jq '. | has("flakyFailure")' flaky_tests.json) >> $GITHUB_OUTPUT
- name: Get flaky test details
id: get-flaky-tests
if: ${{ steps.process-test-report.outputs.has_flaky_tests == 'true' }}
run: |
echo "Flaky tests found"
echo test=$(jq '.["@name"]' flaky_tests.json -r ) >> $GITHUB_OUTPUT
delimiter="###r###"
echo "content<<$delimiter" >> $GITHUB_OUTPUT
echo "$(jq '[.flakyFailure] | flatten | .[0]["system-err"]' flaky_tests.json -r)" >> $GITHUB_OUTPUT
echo $delimiter >> $GITHUB_OUTPUT
- name: pull issue template
if: ${{ steps.process-test-report.outputs.has_flaky_tests == 'true' }}
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
sparse-checkout: |
.github/ISSUE_TEMPLATE/flaky_test.md
sparse-checkout-cone-mode: false
- name: Create issue for flaky tests
continue-on-error: true
id: create-issue
if: ${{ steps.process-test-report.outputs.has_flaky_tests == 'true' }}
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEST_NAME: ${{ steps.get-flaky-tests.outputs.test }}
SYSTEM_ERROR: ${{ steps.get-flaky-tests.outputs.content }}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
JOB_ID: ${{ github.job }}
SHA: ${{ github.sha }}
WORKFLOW: ${{ github.workflow }}
JOB: ${{ github.job }}
BRANCH: ${{ github.ref }}
OS: ${{ matrix.os }}
PR: "#${{ github.event.pull_request.number }}"
with:
filename: .github/ISSUE_TEMPLATE/flaky_test.md
update_existing: true