From 4a955e504b61d3cb760ead40ebe7dadaeba5f574 Mon Sep 17 00:00:00 2001 From: Facundo Farall <37149322+ffarall@users.noreply.github.com> Date: Thu, 27 Mar 2025 16:28:37 -0300 Subject: [PATCH] ci: :construction_worker: 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. --- .github/workflows/rust-tests.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml index 43221392..9fe9fa9d 100644 --- a/.github/workflows/rust-tests.yml +++ b/.github/workflows/rust-tests.yml @@ -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