From bbe4925ea758359f06677f1520a27fdeaf4c2556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <5175937+theofidry@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:03:32 +0100 Subject: [PATCH] ci: Add status jobs (#161) --- .github/workflows/phpstan.yml | 25 +++++++++++++++++++++++-- .github/workflows/tests.yaml | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index cff3d43..91650d0 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -1,4 +1,4 @@ -name: "Static analysis" +name: "AutoReview" on: push: @@ -10,7 +10,7 @@ on: - cron: '0 0 1 * *' jobs: - static-analysis: + phpstan: runs-on: "ubuntu-latest" name: "PHPStan on PHP ${{ matrix.php }}" strategy: @@ -35,3 +35,24 @@ jobs: - name: "Perform static analysis" run: "make phpstan" + + + # This is a "trick", a meta task which does not change, and we can use in + # the protected branch rules as opposed to the E2E tests one above which + # may change regularly. + # This allows us to mark only this job as required instead of each individual + # ever-changing E2E tests. + validate-tests: + name: "AutoReview Status" + runs-on: "ubuntu-latest" + needs: + - "phpstan" + if: "always()" + steps: + - name: "Successful run" + if: "${{ !(contains(needs.*.result, 'failure')) }}" + run: "exit 0" + + - name: "Failing run" + if: "${{ contains(needs.*.result, 'failure') }}" + run: "exit 1" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 96574a0..9575ac6 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -83,3 +83,25 @@ jobs: - name: "Run tests" run: "vendor/bin/phpunit --group e2e" + + + # This is a "trick", a meta task which does not change, and we can use in + # the protected branch rules as opposed to the E2E tests one above which + # may change regularly. + # This allows us to mark only this job as required instead of each individual + # ever-changing E2E tests. + validate-tests: + name: "Tests Status" + runs-on: "ubuntu-latest" + needs: + - "unit-tests" + - "e2e-tests" + if: "always()" + steps: + - name: "Successful run" + if: "${{ !(contains(needs.*.result, 'failure')) }}" + run: "exit 0" + + - name: "Failing run" + if: "${{ contains(needs.*.result, 'failure') }}" + run: "exit 1"