GH Actions: update PHP version for PHAR boxing #241
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run unit and style tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
- master | |
# 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: | |
lint: | |
name: Run style linter | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
coverage: none | |
tools: cs2pr | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
- name: Run code sniffer | |
continue-on-error: true | |
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml | |
- name: Show PHPCS results in PR | |
run: cs2pr ./phpcs-report.xml | |
bundle: | |
name: Bundle binary | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
extensions: exif, phar, openssl, sodium | |
coverage: none | |
ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On, zend.assertions=1 | |
# Autoload files generated with Composer 2.3 are not compatible with PHP < 7.0. | |
tools: composer:2.2 | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
composer-options: "--no-dev" | |
# Note: do NOT turn on the requirement checker in the box config as it is no longer | |
# compatible with PHP < 7.2. | |
- name: Install Box | |
run: wget https://github.com/humbug/box/releases/latest/download/box.phar -O box.phar && chmod 0755 box.phar && pwd | |
- name: Validate configuration | |
run: php box.phar validate -i box.json | |
- name: Building binary... | |
run: php box.phar compile -v --config=box.json | |
- name: Show info about the build phar with humbug/box | |
run: php box.phar info -l parallel-lint.phar | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: parallel-lint-phar | |
path: ./parallel-lint.phar | |
test: | |
name: Run tests on PHP ${{ matrix.php }} | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.php == '8.2' }} | |
needs: | |
- bundle | |
strategy: | |
matrix: | |
php: | |
- '5.3' | |
- '5.4' | |
- '5.5' | |
- '5.6' | |
- '7.0' | |
- '7.1' | |
- '7.2' | |
- '7.3' | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
- '8.2' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: error_reporting=-1, display_errors=On, zend.assertions=1 | |
coverage: none | |
# Remove PHPCS as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3. | |
- name: 'Composer: remove PHPCS' | |
if: ${{ matrix.php < 5.4 }} | |
run: composer remove --dev squizlabs/php_codesniffer --no-update --no-interaction | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
- name: 'Integration test 1 - linting own code, no colors' | |
continue-on-error: true | |
run: ./parallel-lint --exclude vendor --exclude tests/examples --no-colors . | |
- name: 'Integration test 2 - linting own code' | |
run: ./parallel-lint --exclude vendor --exclude tests/examples . | |
- name: 'Run unit tests PHP <= 5.5' | |
if: ${{ matrix.php < 5.6 }} | |
run: composer testphp5 | |
- name: 'Run unit tests PHP >= 5.6' | |
if: ${{ matrix.php >= 5.6 }} | |
run: composer test | |
- uses: actions/download-artifact@v2 | |
with: | |
name: parallel-lint-phar | |
- name: Run linter against codebase using the phar | |
run: php ./parallel-lint.phar --exclude vendor --exclude tests/examples . |