Skip to content

Commit

Permalink
GHA: Move from always() to !cancelled()
Browse files Browse the repository at this point in the history
And add extra step to mark cancelled jobs as failed.
  • Loading branch information
stronk7 committed Dec 19, 2023
1 parent 9e3dcb0 commit 66cf4ff
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,25 @@ jobs:
composer install
- name: Run phplint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: |
./vendor/bin/phplint
- name: PHP Copy/Paste Detector
if: ${{ always() }}
if: ${{ !cancelled() }}
run: ./vendor/bin/phpcpd --exclude moodle/Tests moodle

- name: Run phpunit
if: ${{ always() }}
if: ${{ !cancelled() }}
run: |
./vendor/bin/phpunit --coverage-text
- name: Test coverage
if: ${{ !cancelled() }}
run: ./vendor/bin/phpunit-coverage-check -t 80 clover.xml

- name: Integration tests
if: ${{ always() }}
if: ${{ !cancelled() }}
run: |
# There is one failure (exit with error)
vendor/bin/phpcs --standard=moodle moodle/Tests/fixtures/integration_test_ci.php | tee output.txt || [[ $? = 1 ]]
Expand All @@ -62,6 +63,11 @@ jobs:
# So, there isn't any failure any more (exit without error)
vendor/bin/phpcs --standard=moodle moodle/Tests/fixtures/integration_test_ci.php | tee output.txt && [[ $? = 0 ]]
- name: Mark cancelled jobs as failed
if: ${{ cancelled() }}
run: exit 1

coverage:
if: github.repository == 'moodlehq/moodle-cs'
name: Code coverage (codecov)
Expand All @@ -84,12 +90,17 @@ jobs:
composer install
- name: Run phpunit
if: ${{ always() }}
if: ${{ !cancelled() }}
run: |
./vendor/bin/phpunit --coverage-clover clover.xml
- name: Upload coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v3
with:
files: clover.xml
verbose: true

- name: Mark cancelled jobs as failed
if: ${{ cancelled() }}
run: exit 1

0 comments on commit 66cf4ff

Please sign in to comment.