Skip to content

Commit dd98e20

Browse files
authored
Merge pull request #70 from PHPCSStandards/feature/ghactions-various-improvements
GH Actions: various improvements & tweaks
2 parents 3bef736 + 3f42c8a commit dd98e20

File tree

5 files changed

+49
-21
lines changed

5 files changed

+49
-21
lines changed

.github/workflows/label-merge-conflicts.yml

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches:
66
- master
77

8+
# Cancels all previous workflow runs for the same branch that have not yet completed.
9+
concurrency:
10+
# The concurrency group contains the workflow name and the branch name.
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
814
jobs:
915
check-prs:
1016
runs-on: ubuntu-latest

.github/workflows/label-new-prs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: srvaroa/labeler@master
16-
env:
17-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
15+
- uses: srvaroa/labeler@master
16+
env:
17+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/phpstan.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ on:
77
paths-ignore:
88
- '**.md'
99
pull_request:
10-
paths-ignore:
11-
- '**.md'
1210
# Allow manually triggering the workflow.
1311
workflow_dispatch:
1412

13+
# Cancels all previous workflow runs for the same branch that have not yet completed.
14+
concurrency:
15+
# The concurrency group contains the workflow name and the branch name.
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1519
jobs:
1620
phpstan:
1721
name: "PHP: 7.4 | PHPStan"
@@ -31,7 +35,7 @@ jobs:
3135

3236
# Install dependencies and handle caching in one go.
3337
# Dependencies need to be installed to make sure the PHPUnit classes are recognized.
34-
# @link https://github.com/marketplace/actions/install-composer-dependencies
38+
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
3539
- name: Install Composer dependencies
3640
uses: "ramsey/composer-install@v2"
3741
with:

.github/workflows/test.yml

+23-10
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ on:
77
paths-ignore:
88
- '**.md'
99
pull_request:
10-
paths-ignore:
11-
- '**.md'
1210
# Allow manually triggering the workflow.
1311
workflow_dispatch:
1412

13+
# Cancels all previous workflow runs for the same branch that have not yet completed.
14+
concurrency:
15+
# The concurrency group contains the workflow name and the branch name.
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1519
jobs:
1620
build:
1721
runs-on: ubuntu-latest
@@ -112,8 +116,21 @@ jobs:
112116
coverage: none
113117
tools: cs2pr
114118

119+
# This action also handles the caching of the dependencies.
120+
- name: Set up node and enable caching of dependencies
121+
uses: actions/setup-node@v3
122+
with:
123+
node-version: '20'
124+
125+
- name: Install external tools used in tests
126+
run: >
127+
npm install -g --fund false
128+
csslint
129+
eslint
130+
jshint
131+
115132
# Install dependencies and handle caching in one go.
116-
# @link https://github.com/marketplace/actions/install-composer-dependencies
133+
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
117134
- name: Install Composer dependencies - normal
118135
if: ${{ matrix.php < '8.0' }}
119136
uses: "ramsey/composer-install@v2"
@@ -126,7 +143,7 @@ jobs:
126143
if: ${{ matrix.php >= '8.0' }}
127144
uses: "ramsey/composer-install@v2"
128145
with:
129-
composer-options: --ignore-platform-reqs
146+
composer-options: --ignore-platform-req=php+
130147
custom-cache-suffix: $(date -u "+%Y-%m")
131148

132149
# Note: The code style check is run multiple times against every PHP version
@@ -151,17 +168,13 @@ jobs:
151168

152169
- name: 'PHPCS: check code style to show results in PR'
153170
if: ${{ matrix.custom_ini == false && matrix.php == '7.4' }}
154-
continue-on-error: true
171+
id: phpcs
155172
run: php bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml
156173

157174
- name: Show PHPCS results in PR
158-
if: ${{ matrix.custom_ini == false && matrix.php == '7.4' }}
175+
if: ${{ always() && steps.phpcs.outcome == 'failure' && matrix.php == '7.4' }}
159176
run: cs2pr ./phpcs-report.xml
160177

161-
- name: 'Composer: validate config'
162-
if: ${{ matrix.custom_ini == false }}
163-
run: composer validate --no-check-all --strict
164-
165178
- name: Download the PHPCS phar
166179
uses: actions/download-artifact@v3
167180
with:

.github/workflows/validate.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ on:
77
paths-ignore:
88
- '**.md'
99
pull_request:
10-
paths-ignore:
11-
- '**.md'
1210
# Allow manually triggering the workflow.
1311
workflow_dispatch:
1412

13+
# Cancels all previous workflow runs for the same branch that have not yet completed.
14+
concurrency:
15+
# The concurrency group contains the workflow name and the branch name.
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1519
jobs:
1620
checkxml:
1721
name: Check XML files
@@ -25,16 +29,17 @@ jobs:
2529
uses: actions/checkout@v3
2630

2731
- name: Install xmllint
28-
run: |
29-
sudo apt-get update
32+
run: |
33+
sudo apt-get update
3034
sudo apt-get install --no-install-recommends -y libxml2-utils
3135
3236
- name: Retrieve XML Schema
3337
run: curl -O https://www.w3.org/2012/04/XMLSchema.xsd
3438

3539
# Show XML violations inline in the file diff.
3640
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
37-
- uses: korelstar/xmllint-problem-matcher@v1
41+
- name: Enable showing XML issues inline
42+
uses: korelstar/xmllint-problem-matcher@v1
3843

3944
# Validate the XML ruleset files.
4045
# @link http://xmlsoft.org/xmllint.html

0 commit comments

Comments
 (0)