ci: 👷 Add CI job to check rust tests results if they run (#16)

This PR adds a new job at the end of the `DataHave Operator Rust Tests`
(`rust-tests.yml`) that checks:
- If the tests were skipped (no changes in the `operator/` directory),
it succeeds.
- If the tests run and succeeded, it succeeds.
- If the tests run and failed, it fails.

This is useful to set this job as required in our merging ruleset, and
account for cases where the tests are skipped.
This commit is contained in:
Facundo Farall 2025-03-27 16:28:37 -03:00 committed by GitHub
parent d8d792874c
commit 4a955e504b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -107,3 +107,25 @@ jobs:
~/.cargo/bin/cargo-nextest nextest run \
--archive-file ../nextest-archive.tar.zst \
--partition count:${{ matrix.partition }}/2
tests-result-checker:
name: Check tests were successful
needs: [setup, all-rust-tests]
if: always()
runs-on: ubuntu-latest
steps:
- name: Validate test results
run: |
echo "node_changed: ${{ needs.setup.outputs.node_changed }}"
echo "matrix result: ${{ needs.all-rust-tests.result }}"
if [ "${{ needs.setup.outputs.node_changed }}" == "true" ]; then
if [ "${{ needs.all-rust-tests.result }}" != "success" ]; then
echo "Rust tests failed or were cancelled"
exit 1
else
echo "Rust tests passed"
fi
else
echo "No relevant changes — skipping rust tests"
fi