Skip to content

Commit

Permalink
Do not force shim package (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored Jan 8, 2024
1 parent f595593 commit 13fba7e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ on:
push: ~
jobs:
verify:
name: PHP ${{ matrix.php-version }} ${{ matrix.description }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
php-version: [ '8.3' ]
composer_flags: [ '' ]
include:
- os: ubuntu-latest
description: 'with the lowest dependencies'
php-version: '7.4'
composer_flags: '--prefer-lowest'
- os: ubuntu-latest
Expand All @@ -22,22 +21,36 @@ jobs:
php-version: '8.1'
- os: ubuntu-latest
php-version: '8.2'
- os: ubuntu-latest
php-version: '8.3'
- os: macos-latest
description: 'on macOS'
php-version: '8.3'
- os: windows-latest
description: 'on Windows'
php-version: '8.3'
- os: ubuntu-latest
description: 'with shim package'
php-version: '8.3'
use-shim-package: true
- os: ubuntu-latest
php-version: '8.4'
composer_flags: '--ignore-platform-reqs'
runs-on: ${{ matrix.os }}
env:
PHP_CS_FIXER_IGNORE_ENV: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
extensions: none, curl, dom, json, mbstring, opcache, openssl, simplexml, tokenizer, xml, xmlwriter
coverage: none

- if: ${{ matrix.use-shim-package }}
run: sed -i 's#friendsofphp/php-cs-fixer#php-cs-fixer/shim#g' composer.json

- run: composer update --no-progress ${{ matrix.composer_flags }}

- run: composer verify
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": "^7.4 || ^8.0",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.18",
"php-cs-fixer/shim": "^3.42"
"friendsofphp/php-cs-fixer": "^3.42"
},
"require-dev": {
"phpunit/phpunit": "^9.5.19"
Expand Down
12 changes: 7 additions & 5 deletions dev/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

$phar = __DIR__ . '/../vendor/php-cs-fixer/shim/php-cs-fixer.phar';

$pharLoaded = Phar::loadPhar($phar, 'php-cs-fixer.phar');
if (!$pharLoaded) {
exit(sprintf('Phar "%s" not loaded!' . PHP_EOL, $phar));
}
if (file_exists($phar)) {
$pharLoaded = Phar::loadPhar($phar, 'php-cs-fixer.phar');
if (!$pharLoaded) {
exit(sprintf('Phar "%s" not loaded!' . PHP_EOL, $phar));
}

require_once 'phar://php-cs-fixer.phar/vendor/autoload.php';
require_once 'phar://php-cs-fixer.phar/vendor/autoload.php';
}

0 comments on commit 13fba7e

Please sign in to comment.