Skip to content

Commit

Permalink
ci examples: use !cancelled() instead of always()
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchamp committed Oct 11, 2023
1 parent c071c96 commit f667ed8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/CodeCoverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Some examples follow:
<!-- {% raw %} -->
```yaml
- name: PHPUnit tests
if: ${{ always() }}
if: ${{ !cancelled() }}
run: |
moodle-plugin-ci phpunit --coverage-clover
moodle-plugin-ci coveralls-upload
Expand Down
26 changes: 15 additions & 11 deletions docs/GHAFileExplained.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,49 +135,53 @@ jobs:
# can be re-ordered or removed to your liking. And of course, you can
# add any of your own custom steps.
- name: PHP Lint
if: ${{ always() }} # prevents CI run stopping if step failed.
if: ${{ !cancelled() }} # prevents CI run stopping if step failed.
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
continue-on-error: true
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpcs --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpdoc --max-warnings 0

- name: Validating
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpunit

- name: Behat features
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci behat --profile chrome

- name: Mark cancelled jobs as failed.
if: ${{ cancelled() }}
run: exit 1
```
<!-- {% endraw %} -->
26 changes: 15 additions & 11 deletions gha.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,47 +66,51 @@ jobs:
MOODLE_BRANCH: ${{ matrix.moodle-branch }}

- name: PHP Lint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpcs --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpdoc --max-warnings 0

- name: Validating
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpunit --fail-on-warning

- name: Behat features
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci behat --profile chrome

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

0 comments on commit f667ed8

Please sign in to comment.