Skip to content

Commit

Permalink
CI: automate --ignore-platform-req=PHP (#7467)
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Nov 25, 2023
1 parent 9fbe27e commit 9ae580f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .github/composite-actions/install-composer-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ runs:
run: |
echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
echo "COMPOSER_CACHE_PHP=$(php -r 'echo PHP_VERSION;')" >> $GITHUB_ENV
echo "PHP_VERSION_ID=$(php -r 'echo PHP_VERSION_ID;')" >> $GITHUB_ENV
- name: Cache Composer dependencies
uses: actions/cache@v3
Expand All @@ -43,6 +44,13 @@ runs:
Composer-${{ runner.os }}-${{ env.COMPOSER_CACHE_PHP }}-
Composer-${{ runner.os }}-
- name: Auto-add ignore-platform-req
uses: actions/github-script@v6
id: resolve-ignore-platform-req
with:
script: 'return ${{ env.PHP_VERSION_ID }} >= 80300 ? "--ignore-platform-req=php+" : ""'
result-encoding: string

- name: Install dependencies
uses: nick-invision/retry@v2
with:
Expand All @@ -51,7 +59,7 @@ runs:
retry_wait_seconds: 30
# `--no-scripts` to avoid side-effects (e.g. installing dev-tools for all jobs on CI level),
# all executed scripts should be explicit and run only when needed.
command: composer update --optimize-autoloader --no-interaction --no-progress --no-scripts ${{ inputs.flags }}
command: composer update --optimize-autoloader --no-interaction --no-progress --no-scripts ${{ inputs.flags }} ${{ steps.resolve-ignore-platform-req.outputs.result }}

- name: Show versions of packages
shell: bash
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,12 @@ jobs:
php-version: '8.3'
job-description: 'Fixer'
run-fixer: 'yes'
composer-flags: '--ignore-platform-req=PHP'
PHP_CS_FIXER_IGNORE_ENV: 1

- operating-system: 'ubuntu-22.04'
php-version: '8.3'
job-description: 'tests'
run-tests: 'yes'
composer-flags: '--ignore-platform-req=PHP'
PHP_CS_FIXER_IGNORE_ENV: 1

name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }}
Expand Down

0 comments on commit 9ae580f

Please sign in to comment.