DEV: Ensure GitHub workflows cancel cleanly (#18314)

We added `always()` on some steps so that they run even if previous steps fail. That helps give us a picture of all failures in one run, rather than having to re-run the workflow after fixing the first failure.

However, when we explicitly cancel a job, we should skip running these steps. `!cancelled()` is a better substitute for `always()` in this case.
This commit is contained in:
David Taylor 2022-09-21 14:32:21 +01:00 committed by GitHub
parent b3831362a1
commit 42d226f727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 13 deletions

View File

@ -67,7 +67,7 @@ jobs:
${{ runner.os }}-yarn- ${{ runner.os }}-yarn-
- name: Check RubyGems Licenses - name: Check RubyGems Licenses
if: ${{ always() }} if: ${{ !cancelled() }}
run: | run: |
licensed cache licensed cache
licensed status licensed status
@ -76,14 +76,14 @@ jobs:
run: yarn install run: yarn install
- name: Check Yarn Licenses - name: Check Yarn Licenses
if: ${{ always() }} if: ${{ !cancelled() }}
run: | run: |
yarn global add licensee yarn global add licensee
yarn global upgrade licensee yarn global upgrade licensee
licensee --errors-only licensee --errors-only
- name: Check Ember CLI Workspace Licenses - name: Check Ember CLI Workspace Licenses
if: ${{ always() }} if: ${{ !cancelled() }}
working-directory: ./app/assets/javascripts working-directory: ./app/assets/javascripts
run: | run: |
licensee --errors-only licensee --errors-only

View File

@ -64,19 +64,19 @@ jobs:
run: yarn install run: yarn install
- name: Rubocop - name: Rubocop
if: ${{ always() }} if: ${{ !cancelled() }}
run: bundle exec rubocop --parallel . run: bundle exec rubocop --parallel .
- name: ESLint (core) - name: ESLint (core)
if: ${{ always() }} if: ${{ !cancelled() }}
run: yarn eslint app/assets/javascripts run: yarn eslint app/assets/javascripts
- name: ESLint (core plugins) - name: ESLint (core plugins)
if: ${{ always() }} if: ${{ !cancelled() }}
run: yarn eslint plugins run: yarn eslint plugins
- name: Prettier - name: Prettier
if: ${{ always() }} if: ${{ !cancelled() }}
run: | run: |
yarn prettier -v yarn prettier -v
yarn pprettier --list-different \ yarn pprettier --list-different \
@ -86,7 +86,7 @@ jobs:
"plugins/**/assets/javascripts/**/*.js" "plugins/**/assets/javascripts/**/*.js"
- name: Ember template lint - name: Ember template lint
if: ${{ always() }} if: ${{ !cancelled() }}
run: | run: |
yarn ember-template-lint \ yarn ember-template-lint \
--no-error-on-unmatched-pattern \ --no-error-on-unmatched-pattern \
@ -94,9 +94,9 @@ jobs:
"plugins/**/assets/javascripts/**/*.hbs" "plugins/**/assets/javascripts/**/*.hbs"
- name: English locale lint (core) - name: English locale lint (core)
if: ${{ always() }} if: ${{ !cancelled() }}
run: bundle exec ruby script/i18n_lint.rb "config/**/locales/{client,server}.en.yml" run: bundle exec ruby script/i18n_lint.rb "config/**/locales/{client,server}.en.yml"
- name: English locale lint (core plugins) - name: English locale lint (core plugins)
if: ${{ always() }} if: ${{ !cancelled() }}
run: bundle exec ruby script/i18n_lint.rb "plugins/**/locales/{client,server}.en.yml" run: bundle exec ruby script/i18n_lint.rb "plugins/**/locales/{client,server}.en.yml"

View File

@ -220,19 +220,19 @@ jobs:
sudo -E -u discourse -H yarn ember build --environment=test -o /tmp/emberbuild sudo -E -u discourse -H yarn ember build --environment=test -o /tmp/emberbuild
- name: Core QUnit 1 - name: Core QUnit 1
if: ${{ always() }} if: ${{ !cancelled() }}
working-directory: ./app/assets/javascripts/discourse working-directory: ./app/assets/javascripts/discourse
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=1 --launch "${{ matrix.browser }}" --random run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=1 --launch "${{ matrix.browser }}" --random
timeout-minutes: 15 timeout-minutes: 15
- name: Core QUnit 2 - name: Core QUnit 2
if: ${{ always() }} if: ${{ !cancelled() }}
working-directory: ./app/assets/javascripts/discourse working-directory: ./app/assets/javascripts/discourse
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=2 --launch "${{ matrix.browser }}" --random run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=2 --launch "${{ matrix.browser }}" --random
timeout-minutes: 15 timeout-minutes: 15
- name: Core QUnit 3 - name: Core QUnit 3
if: ${{ always() }} if: ${{ !cancelled() }}
working-directory: ./app/assets/javascripts/discourse working-directory: ./app/assets/javascripts/discourse
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=3 --launch "${{ matrix.browser }}" --random run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=3 --launch "${{ matrix.browser }}" --random
timeout-minutes: 15 timeout-minutes: 15