-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from PHPCSStandards/feature/ghactions-test-wo…
…rkflow-improvements GH Actions: test workflow improvements
- Loading branch information
Showing
3 changed files
with
121 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build PHARs | ||
|
||
on: | ||
# Run on pushes to master and on all pull requests. | ||
# Prevent the build from running when there are only irrelevant changes. | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
# 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 | ||
|
||
strategy: | ||
matrix: | ||
# Deliberately missing PHP 8.0 as that PHAR is build and used in the test workflow. | ||
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.1', '8.2', '8.3', '8.4'] | ||
|
||
name: "Build Phar on PHP: ${{ matrix.php }}" | ||
|
||
continue-on-error: ${{ matrix.php == '8.4' }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none | ||
ini-values: phar.readonly=Off, error_reporting=-1, display_errors=On | ||
|
||
- name: Build the phars | ||
run: php scripts/build-phar.php | ||
|
||
# Both the below only check a file which is rarely changed and therefore unlikely to have issues. | ||
# This test is about testing that the phars are functional, *not* about whether the code style complies. | ||
- name: 'PHPCS: check code style using the Phar file to test the Phar is functional' | ||
run: php phpcs.phar ./scripts | ||
|
||
- name: 'PHPCBF: fix code style using the Phar file to test the Phar is functional' | ||
run: php phpcbf.phar ./scripts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Quicktest | ||
|
||
on: | ||
# Run on pushes to all branches except for `master`. | ||
push: | ||
branches-ignore: | ||
- master | ||
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: | ||
#### QUICK TEST #### | ||
# This is a much quicker test run which only runs the unit tests against the low/medium/high | ||
# supported PHP versions and skips the PHAR test and the tests for external JS/CSS tooling. | ||
# These are basically the same builds as in the Test->Coverage workflow, but then without doing | ||
# the code-coverage. | ||
quicktest: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: ['5.4', '7.2', 'latest'] | ||
|
||
name: "QuickTest: PHP ${{ matrix.php }}" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
ini-values: 'error_reporting=-1, display_errors=On' | ||
coverage: none | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer | ||
- name: Install Composer dependencies | ||
uses: "ramsey/composer-install@v2" | ||
with: | ||
# Bust the cache at least once a month - output format: YYYY-MM. | ||
custom-cache-suffix: $(date -u "+%Y-%m") | ||
|
||
- name: 'PHPCS: set the path to PHP' | ||
run: php bin/phpcs --config-set php_path php | ||
|
||
- name: 'PHPUnit: run the tests' | ||
run: vendor/bin/phpunit tests/AllTests.php | ||
|
||
# Note: The code style check is run as an integration test. | ||
- name: 'PHPCS: check code style without cache, no parallel' | ||
run: php bin/phpcs --no-cache --parallel=1 |
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