From 234fb558534e14ea04f3b476f7605a70e1263377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Tue, 5 Nov 2024 10:01:01 +0100 Subject: [PATCH] ci: Add status jobs --- .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 554d818..3d7b292 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 4d8c0cc..035970f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -81,3 +81,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"