Skip to content

Commit

Permalink
Merge pull request #70 from PHPCSStandards/feature/ghactions-various-…
Browse files Browse the repository at this point in the history
…improvements

GH Actions: various improvements & tweaks
  • Loading branch information
jrfnl authored Nov 10, 2023
2 parents 3bef736 + 3f42c8a commit dd98e20
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 21 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/label-merge-conflicts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
branches:
- master

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-prs:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/label-new-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: srvaroa/labeler@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: srvaroa/labeler@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
10 changes: 7 additions & 3 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ on:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
phpstan:
name: "PHP: 7.4 | PHPStan"
Expand All @@ -31,7 +35,7 @@ jobs:

# Install dependencies and handle caching in one go.
# Dependencies need to be installed to make sure the PHPUnit classes are recognized.
# @link https://github.com/marketplace/actions/install-composer-dependencies
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
with:
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ on:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -112,8 +116,21 @@ jobs:
coverage: none
tools: cs2pr

# This action also handles the caching of the dependencies.
- name: Set up node and enable caching of dependencies
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install external tools used in tests
run: >
npm install -g --fund false
csslint
eslint
jshint
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies - normal
if: ${{ matrix.php < '8.0' }}
uses: "ramsey/composer-install@v2"
Expand All @@ -126,7 +143,7 @@ jobs:
if: ${{ matrix.php >= '8.0' }}
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs
composer-options: --ignore-platform-req=php+
custom-cache-suffix: $(date -u "+%Y-%m")

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

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

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

- name: 'Composer: validate config'
if: ${{ matrix.custom_ini == false }}
run: composer validate --no-check-all --strict

- name: Download the PHPCS phar
uses: actions/download-artifact@v3
with:
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ on:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
checkxml:
name: Check XML files
Expand All @@ -25,16 +29,17 @@ jobs:
uses: actions/checkout@v3

- name: Install xmllint
run: |
sudo apt-get update
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y libxml2-utils
- name: Retrieve XML Schema
run: curl -O https://www.w3.org/2012/04/XMLSchema.xsd

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

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

0 comments on commit dd98e20

Please sign in to comment.