Skip to content

Commit 0691145

Browse files
authored
GH Actions: various updates (#283)
* GH Actions: fix use of deprecated `set-output` GitHub has deprecated the use of `set-output` (and `set-state`) in favour of new environment files. This commit updates workflows to use the new methodology. Refs: * https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files * GH Actions: harden the workflow against PHPCS ruleset errors If there is a ruleset error, the `cs2pr` action doesn't receive an `xml` report and exits with a `0` error code, even though the PHPCS run failed (though not on CS errors, but on a ruleset error). This changes the GH Actions workflow to allow for that situation and still fail the build in that case. Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
1 parent 81f5f19 commit 0691145

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.github/workflows/csqa.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ jobs:
6464

6565
# Check the code-style consistency of the PHP files.
6666
- name: Check PHP code style
67-
continue-on-error: true
67+
id: phpcs
6868
run: composer lint -- --no-cache --report-full --report-checkstyle=./phpcs-report.xml
6969

7070
- name: Show PHPCS results in PR
71+
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
7172
run: cs2pr ./phpcs-report.xml
7273

7374
static-analysis:

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ jobs:
6565
# On stable PHPCS versions, allow for PHP deprecation notices.
6666
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
6767
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
68-
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, zend.assertions=1'
68+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
6969
else
70-
echo '::set-output name=PHP_INI::error_reporting=-1, display_errors=On, zend.assertions=1'
70+
echo 'PHP_INI=error_reporting=-1, display_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
7171
fi
7272
7373
- name: Install PHP
@@ -133,9 +133,9 @@ jobs:
133133
# On stable PHPCS versions, allow for PHP deprecation notices.
134134
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
135135
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
136-
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, zend.assertions=1'
136+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
137137
else
138-
echo '::set-output name=PHP_INI::error_reporting=-1, display_errors=On, zend.assertions=1'
138+
echo 'PHP_INI=error_reporting=-1, display_errors=On, zend.assertions=1' >> $GITHUB_OUTPUT
139139
fi
140140
141141
- name: Install PHP
@@ -156,7 +156,7 @@ jobs:
156156

157157
- name: Grab PHPUnit version
158158
id: phpunit_version
159-
run: echo ::set-output name=VERSION::$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')
159+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
160160

161161
- name: "DEBUG: Show grabbed version"
162162
run: echo ${{ steps.phpunit_version.outputs.VERSION }}

0 commit comments

Comments
 (0)