From f19903dceef7085106ceb3a79a66cbce46bc3325 Mon Sep 17 00:00:00 2001 From: Bruno Schmitt <7152025+boschmitt@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:32:30 +0100 Subject: [PATCH] [ci] Create a job for status check purposes. (#17) Signed-off-by: boschmitt <7152025+boschmitt@users.noreply.github.com> --- .github/workflows/pr_workflow.yaml | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/pr_workflow.yaml b/.github/workflows/pr_workflow.yaml index f6e3ddb..19b713d 100644 --- a/.github/workflows/pr_workflow.yaml +++ b/.github/workflows/pr_workflow.yaml @@ -148,3 +148,38 @@ jobs: (needs.check-changes.outputs.build-solvers == 'true' || needs.check-changes.outputs.build-cudaq == 'true') uses: ./.github/workflows/lib_solvers.yaml + # This job is used for branch protection checks. + verify: + name: Verify PR + if: ${{ always() }} + needs: + - build-cudaq + - build-all + - build-qec + - build-solvers + runs-on: ubuntu-latest + steps: + - name: Check results + run: | + status="success" + + check_result() { + name=$1 + result=$2 + + # NOTE: "skipped" is considered success. + if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then + echo "$name job failed" + + status="failed" + fi + } + + check_result "build-cudaq" "${{needs.build-cudaq.result}}" + check_result "build-all" "${{needs.build-all.result}}" + check_result "build-qec" "${{needs.build-qec.result}}" + check_result "build-solvers" "${{needs.build-solvers.result}}" + + if [[ "$status" != "success" ]]; then + exit 1 + fi