-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: switch to GitHub Actions #633
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,62 @@ | ||
name: BasicQA | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
# Prevent the "push" build from running when there are only irrelevant changes. | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
# Allow manually triggering the workflow. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
checkcs: | ||
name: 'Basic CS and QA checks' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
tools: cs2pr | ||
|
||
- name: 'Lint PHP against parse errors' | ||
run: ./bin/php-lint | ||
|
||
- name: Install xmllint | ||
run: sudo apt-get install --no-install-recommends -y libxml2-utils | ||
|
||
# Show XML violations inline in the file diff. | ||
# @link https://github.com/marketplace/actions/xmllint-problem-matcher | ||
- uses: korelstar/xmllint-problem-matcher@v1 | ||
|
||
# Validate the composer.json file. | ||
# @link https://getcomposer.org/doc/03-cli.md#validate | ||
- name: Validate Composer installation | ||
run: composer validate --no-check-all --strict | ||
|
||
- name: 'Composer: adjust dependencies' | ||
# Using PHPCS `master` as an early detection system for bugs upstream. | ||
run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"dev-master" | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies | ||
uses: "ramsey/composer-install@v1" | ||
|
||
- name: 'Validate XML against schema and check code style' | ||
run: ./bin/xml-lint | ||
|
||
# Check the code-style consistency of the PHP files. | ||
- name: Check PHP code style | ||
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 |
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,101 @@ | ||
name: Test | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
# Prevent the "push" build from running when there are only irrelevant changes. | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
# Allow manually triggering the workflow. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
# Keys: | ||
# - php: The PHP versions to test against. | ||
# - phpcs_version: The PHPCS versions to test against. | ||
# IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version. | ||
# - PHPCS will run without errors on PHP 5.4 - 7.4 on any supported version. | ||
# - PHP 8.0 needs PHPCS 3.5.7+ to run without errors. | ||
# - The `wpcs_version` key is added to allow additional test builds when multiple WPCS versions | ||
# would be supported. As, at this time, only the latest stable release of WPCS is supported, | ||
# no additional versions are included in the array. | ||
# - experimental: Whether the build is "allowed to fail". | ||
matrix: | ||
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] | ||
phpcs_version: ['3.5.5', 'dev-master'] | ||
wpcs_version: ['2.3.*'] | ||
experimental: [false] | ||
|
||
include: | ||
# Complete the matrix by adding PHP 8.0, but only test against compatible PHPCS versions. | ||
- php: '8.0' | ||
phpcs_version: 'dev-master' | ||
wpcs_version: '2.3.*' | ||
experimental: false | ||
- php: '8.0' | ||
# PHPCS 3.5.7 is the lowest version of PHPCS which supports PHP 8.0. | ||
phpcs_version: '3.5.7' | ||
wpcs_version: '2.3.*' | ||
experimental: false | ||
|
||
# Experimental builds. These are allowed to fail. | ||
#- php: '8.1' | ||
# phpcs_version: 'dev-master' | ||
# wpcs_version: '2.3.*' | ||
# experimental: true | ||
|
||
name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - WPCS ${{ matrix.wpcs_version }}" | ||
GaryJones marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
continue-on-error: ${{ matrix.experimental }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# On stable PHPCS versions, allow for PHP deprecation notices. | ||
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. | ||
- name: Setup ini config | ||
id: set_ini | ||
run: | | ||
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then | ||
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED' | ||
else | ||
echo '::set-output name=PHP_INI::error_reporting=E_ALL' | ||
fi | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
ini-values: ${{ steps.set_ini.outputs.PHP_INI }} | ||
coverage: none | ||
|
||
- name: 'Composer: set PHPCS and WPCS versions for tests' | ||
run: | | ||
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" | ||
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}" | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies - normal | ||
if: ${{ startsWith( matrix.php, '8' ) == false }} | ||
uses: "ramsey/composer-install@v1" | ||
|
||
# PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform | ||
# requirements to get PHPUnit 7.x to install on nightly. | ||
- name: Install Composer dependencies - with ignore platform | ||
if: ${{ startsWith( matrix.php, '8' ) }} | ||
uses: "ramsey/composer-install@v1" | ||
with: | ||
composer-options: --ignore-platform-reqs | ||
|
||
- name: Run the unit tests | ||
run: ./bin/unit-tests | ||
|
||
- name: Run the ruleset tests | ||
run: ./bin/ruleset-tests |
This file was deleted.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests have got a warning:
Presumably this won't matter as there is
shivammathur/setup-php@v2
being used for Basic and Test workflows already anyway?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That warning is not directly related to the setup-php action. It is related to the jobs all using
runs-on: ubuntu-latest
.For all intends and purposes, the ubuntu version shouldn't have any significant effect on the PHP environment (though, yes, that is providing the
setup-php
action will work on all), so I've been ignoring the warning.Using
ubuntu-latest
is a shorthand way to always use the latest instead of a "fixed" version.With Travis, there was a lot of differences between the images (
trusty
,xenial
,bionic
) and what they supported and it was more important to "fix" it to a specific version as it impacted which versions of PHP were available.I don't have the impression the difference is as big on GH Actions, nor that it will impact the workflows we use.
Where it would, I'm expecting the
setup-php
action to fill in the difference.Also see: https://github.com/shivammathur/setup-php/#cloud-osplatform-support
If and when GH actually switches over and the build would fail, we could always (temporarily) fix it to a specific
ubuntu
version until support for the next one has been repaired.More than anything, it's about us not having to keep track of the specifics of the images and not having to update the name of the images used every so often and trusting that the actions we use will handle it.
Does that explain it well enough ?