Skip to content

Commit

Permalink
Update GitHub Actions workflows
Browse files Browse the repository at this point in the history
Changed:
- Refactored GitHub Actions workflows to use shivammathur/setup-php for tools instead of the package's Composer development dependencies.
- Merged jobs in Lint workflow.
- Updated Lint workflow jobs to sue cs2pr.
  • Loading branch information
mcaskill committed Aug 15, 2024
1 parent aa96535 commit 9545800
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 47 deletions.
48 changes: 9 additions & 39 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ name: "Lint"
on:
workflow_dispatch:
push:
paths-ignore:
- 'docs/**'
tags-ignore:
- '**'
pull_request:
paths-ignore:
- 'docs/**'
tags-ignore:
- '**'

Expand Down Expand Up @@ -62,37 +58,7 @@ jobs:
matrix:
php-version:
- "7.2"
- "latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "intl"
ini-values: "memory_limit=-1, error_reporting=E_ALL, display_errors=On"
php-version: "${{ matrix.php-version }}"

- name: "Lint PHP files"
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"

phpstan:
name: "PHPStan"

runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}

strategy:
matrix:
include:
- php-version: "7.2"
experimental: false
- php-version: "8.2"
experimental: true
fail-fast: false
- "8.3"

steps:
- name: "Checkout"
Expand All @@ -103,8 +69,9 @@ jobs:
with:
coverage: "none"
extensions: "intl, zip"
ini-values: "memory_limit=-1"
ini-values: "memory_limit=-1, error_reporting=E_ALL, display_errors=On"
php-version: "${{ matrix.php-version }}"
tools: cs2pr, phpstan, phpunit-bridge

- name: Retrieve Composer cache directory
id: composer-cache
Expand All @@ -125,8 +92,11 @@ jobs:
if: "matrix.experimental == false"
run: "composer config platform --unset && composer install ${{ env.COMPOSER_FLAGS }}"

- name: "Initialize PHPUnit sources"
run: "vendor/bin/simple-phpunit --filter NO_TEST_JUST_AUTOLOAD_THANKS"
- name: Install PHPUnit
run: "simple-phpunit install"

- name: "Lint PHP files"
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"

- name: "Run PHPStan"
run: "composer lint:phpstan"
run: "phpstan analyse --error-format=checkstyle | cs2pr"
15 changes: 7 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ name: "Test"
on:
workflow_dispatch:
push:
paths-ignore:
- 'docs/**'
tags-ignore:
- '**'
pull_request:
paths-ignore:
- 'docs/**'
tags-ignore:
- '**'
schedule:
Expand Down Expand Up @@ -94,14 +90,17 @@ jobs:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Prepare git environment"
run: "git config --global user.name composer && git config --global user.email [email protected]"

- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "intl, zip"
ini-values: "memory_limit=-1, phar.readonly=0, error_reporting=E_ALL, display_errors=On"
php-version: "${{ matrix.php-version }}"
tools: "composer:${{ matrix.composer-version }}"
tools: composer:${{ matrix.composer-version }}, phpunit-bridge
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -136,8 +135,8 @@ jobs:
composer require ${{ env.COMPOSER_FLAGS }} --update-with-dependencies composer/composer="~${{ matrix.composer-version }}.0"
fi
- name: "Prepare git environment"
run: "git config --global user.name composer && git config --global user.email [email protected]"
- name: Install PHPUnit
run: "simple-phpunit install"

- name: "Run tests"
run: "vendor/bin/simple-phpunit --verbose"
run: "simple-phpunit --verbose"

0 comments on commit 9545800

Please sign in to comment.