ci: rust-cache was caching nothing, it needs workspaces #67
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
| # Calls the canonical plugin-ci reusable workflow (GetBusbar/busbar/.github/workflows/plugin-ci.yml) | |
| # instead of hand-copying build/test/signoff steps here — see that file for what actually runs. | |
| # | |
| # busbar-store-valkey (the real logic crate) now lives IN THIS REPO (the store-valkey/ subdirectory, | |
| # a same-repo sibling of store-valkey-plugin/ — see this repo's root Cargo.toml), not in busbarAI, so | |
| # the `ci` job below has no extra sibling-TEST command to run: the reusable workflow's own | |
| # `cargo test` step (working-directory: plugin, i.e. this checkout's root) already exercises | |
| # busbar-store-valkey's own unit tests plus store-valkey-plugin's real dlopen ABI e2e test against the | |
| # `valkey` service container above, because `cargo test` on a virtual workspace with no | |
| # default-members runs every member by default. This crate's `busbar-api` dependency is STILL a | |
| # sibling path dependency into busbarAI though (INTERIM until busbarAI is public) — both jobs below | |
| # need their own busbarAI checkout for that reason. | |
| name: ci | |
| env: | |
| # Same BUSBAR_REF convention ci.yml/release.yml elsewhere establish for the sibling path | |
| # dependency (busbar-api) this crate needs — INTERIM until busbarAI is public. Update to `main` | |
| # once busbar 1.5.0 ships. Repointed from the stale `1.5.0-dev` (which predates this cycle's | |
| # generic-credentials redesign entirely) to `dev`, where that redesign actually landed. | |
| BUSBAR_REF: dev | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| jobs: | |
| ci: | |
| uses: GetBusbar/busbar/.github/workflows/plugin-ci.yml@dev | |
| with: | |
| plugin_crate: busbar-store-valkey-plugin | |
| plugin_kind: store | |
| plugin_alias: valkey | |
| service: valkey | |
| busbar_ref: dev | |
| # migrate()'s destructive-wipe test (store-valkey/src/tests.rs) SCAN+DELETEs the ENTIRE busbar:* | |
| # namespace on whatever live Valkey VALKEY_URL points at — it is #[ignore]'d and must run ALONE, | |
| # never concurrently with the `ci` job's own tests against the same shared service container (see | |
| # that test's own doc comment for the full rationale). It used to run via plugin-ci.yml's | |
| # `extra_sibling_test_command` against busbarAI's copy of this crate; now that busbar-store-valkey | |
| # lives in this repo instead, it runs here, in its own isolated job against its own dedicated | |
| # valkey/valkey:8 service container. | |
| migrate-destructive-wipe-test: | |
| name: migrate() destructive-wipe test (isolated, own valkey/valkey:8 container) | |
| runs-on: ubuntu-latest | |
| services: | |
| valkey: | |
| image: valkey/valkey:8 | |
| ports: | |
| - 6379:6379 | |
| # Runs INSIDE the container (it has its own valkey-cli — the runner does not); GitHub | |
| # Actions blocks the job's steps from starting until this reports healthy, so no separate | |
| # manual "wait for valkey" step is needed or correct here (mirrors plugin-ci.yml's own valkey | |
| # service block). | |
| options: >- | |
| --health-cmd "valkey-cli ping" --health-interval 5s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - name: Checkout store-valkey | |
| uses: actions/checkout@v7 | |
| with: | |
| path: store-valkey-repo | |
| - name: Checkout busbar (sibling path dependency) | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: GetBusbar/busbar | |
| ref: ${{ env.BUSBAR_REF }} | |
| path: busbarAI | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| # REQUIRED. Without `workspaces:` this action looks for ONE Cargo workspace at the | |
| # checkout root, and nothing is checked out there: every checkout above uses `path:`. | |
| # It logged "could not find Cargo.toml" and carried on WITHOUT failing, so this job | |
| # rebuilt everything from scratch on every run while the log said the cache step | |
| # succeeded. Each workspace this job actually builds must be named. | |
| workspaces: | | |
| store-valkey-repo/store-valkey | |
| busbarAI | |
| - name: cargo test -p busbar-store-valkey -- --ignored wipes_the_entire_namespace_destructively | |
| working-directory: store-valkey-repo/store-valkey | |
| env: | |
| VALKEY_URL: redis://localhost:6379/0 | |
| run: | | |
| set -euo pipefail | |
| # FLOOR ASSERTION on the number of tests that actually ran. `cargo test <filter>` is a | |
| # SUBSTRING match with no minimum: rename the test (dropping "the_" is enough) and the | |
| # filter matches ZERO tests, cargo prints "running 0 tests / test result: ok" and EXITS 0. | |
| # This whole job — and the dedicated valkey/valkey:8 service container it stands up — then | |
| # goes green having run nothing, and because the test is #[ignore]'d no other job covers | |
| # it either. Requiring "1 passed" is what makes the rename fail loudly instead. | |
| out="$(cargo test -- --ignored --test-threads=1 \ | |
| wipes_the_entire_namespace_destructively 2>&1 | tee /dev/stderr)" | |
| grep -qE 'test result: ok\. 1 passed' <<<"$out" || { | |
| echo "::error::the destructive-wipe test did not run (renamed, moved, or filtered out)." \ | |
| "The filter matched no tests and cargo exited 0. Re-point the filter at the test's" \ | |
| "current name — do NOT relax this assertion." >&2 | |
| exit 1 | |
| } |