-
-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Move from TravisCI to GitHub Actions #1965
Conversation
I've started to work on something similar for wptt sniffs. Still need to tackle the tests. I've decided to split tests and sniff part into separate workflows: WPTT/WPThemeReview#261 The tricky part that is missing in GH actions is that there are still no allowed failures. Not sure how that will impact the tests. |
@dingo-d From what I've seen, there is (well, in a way), just not in the scripting part. With Travis you had one status per complete run reporting and that status is added to required statusses to pass before a PR can be merged, which is why "allowed failures" is important. With GH actions - you get individual reports in a PR on all the different build steps and instead, for those "builds" which are allowed to fail, you don't add a checkmark next to them in the "required statusses" for PRs to be merged. Does that make sense ? or am I overlooking something ? @desrosj One thing I don't know: while the PR has not been merged yet - how can we see what the current status would be and whether it works ? |
I use https://github.com/nektos/act/ top locally test the actions. Works ok with this instruction. The actions need to be in the @jrfnl regarding the allowed failures, there is a continue-on-error, but I don't think that's the same. At least not from what I've read on the support question. |
Sorry, I ran out of time to finish this week. This is definitely near the top of my list though. The directory is indeed a typo. I'll get it all wrapped up early next week, and we can get everything moved over! |
I'm making some progress on WPThemeReview implementation: https://github.com/WPTT/WPThemeReview/pull/261/checks There are a couple of things I need to do:
EDIT:Managed to get 5.4 and 5.5 working and fixed the sniff stage 🎉 I'm not 100% sure I correctly matched the exclusions (would appreciate another set of eyes). The tests are failing on PHP 8 and 8.1 as expected and on 7.4 with PHPCS dev-master and WPCS dev-develop, but I need to figure out how to make this excluded (allowed failures). Feel free to check the code and reuse things if that will speed things up 🙂 |
- Update each file with full inline documentation. - Update each file to use consistent naming and approaches across workflow files. - Remove travis.yml file.
Alright, I think this is good for a review! I updated the PR description with more details to call out. One thing that I did not include here is an update to the README file with new badges. Those can be grabbed from the workflow pages. I am happy to do that in a follow up PR, or I can include them here. |
Wow, amazing job! I'll definitely use some of this in WPThemeReview 😄 I've left one question regarding matrix usage. The only thing that I'm worried about is that we get a failed test (which is allowed to fail), but we don't really have any easy way to distinguish allowed vs not allowed failures. I hope GH fixes this quickly. |
Hmm, we could add a prefix to the job names that are allowed to fail. Maybe something like changing |
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.
Hi @desrosj Thanks for taking on this task! Awesome job with a complex script.
I've left some suggestions and questions inline.
Additionally:
- The
.gitattributes
file needs to be updated (removing.travis.yml
) - The CI badges in the readme need to be updated. As there are now several workflows, this may need a think through of how we want to present the status.
- A search should be done of the repo to see if there are other references to Travis (possibly in the
contributing
docs?) and if found, these should be removed/texts rewritten.
Other than that (not your concern):
- The required statuses for the branch protection will need to be updated for this to be mergable.
This should only be done once the job names have been finalized. - All open PRs will need to be rebased once this PRs has been merged.
.github/workflows/quicktest.yml
Outdated
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get Composer cache directory |
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.
You may want to have a look at https://github.com/marketplace/actions/install-composer-dependencies which is an action which handles running the composer caching + install. May simplify the script a little more.
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.
I think I have configured this properly and it seems to work, however it's not clear if there are any potential conflicts with running requiring a specific version of PHPCS in the step before and then the action running composer install
after.
The `korelstar/xmllint-problem-matcher` tool will allow to display the results from an xmllint action directly in the PR. Ref: https://github.com/staabm/annotate-pull-request-from-checkstyle
This was already implemented based on feedback for the QuickTest workflow, but not for the other workflows/jobs.
FYI: I did another review and found a number of things which would still need to be updated. As this PR is a blocker for all other PR/progress in this repo, leaving it open any longer is not desirable. I'll be adding a number of additional commits to this PR based on our discussion to touch up and finalize this PR. @dingo-d @GaryJones Please squash all commits on merge of this PR so as to keep the repo history semi-clean. |
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.
With the additional changes now pushed after the call/discussion with @desrosj, IMO this PR is ready to be merged.
* `Install PHPCS` -> `Set PHPCS version` In that particular step, we're not actually _installing_ PHPCS (`--no-update`), just updating the version being required. * `Check that all sniffs have unit tests` => `Check sniff feature completeness` The script run in this step checks feature completeness for PHPCS sniffs. The fact that the documentation check is currently disabled is irrelevant (and runs the risk of when it _does_ get enabled for the step name to become incorrect). * `Check the ... ruleset` => `Test the ... ruleset` This is a _test_ where we are testing that no unexpected errors/warnings are being thrown. Also fixes a typo.
Remove some documentation which isn't relevant (anymore) or which was in the wrong place. Add some documentation where necessary.
The name of the workflow is used in the badges displayed in the Readme. The name as was would make for an awkwardly long badge name.
PHPCS doesn't have named branches for the various releases. It has tags and the `master` branch, so `phpcs_version` is more descriptive.
6870f14
to
d53784e
Compare
@dingo-d @GaryJones I've just updated the protected branches. The status checks from Travis have been removed and the new ones from the GH Actions workflows have been added. |
... as the `ignore_warnings_on_exit` does not seem to get respected when this is split into two commands.
e42613b
to
a3b86fc
Compare
... as the cs2pr combined with the `--runtime-set ignore_warnings_on_exit 1` appears to be buggy. To be revisited 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.
Co-authored-by: Denis Žoljom <dingo-d@users.noreply.github.com>
Co-authored-by: Denis Žoljom <dingo-d@users.noreply.github.com>
Co-authored-by: Denis Žoljom <dingo-d@users.noreply.github.com>
Thanks @dingo-d! Addressed those, I think we're good to go now! |
* upstream/develop: (106 commits) PHP/NoSilencedErrors: add `imagecreatefromwebp` PHP/NoSilencedErrors: add libxml_disable_entity_loader() GH Actions: turn display_errors on Bug report template: various improvements QA: import all used classes QA: use fully qualified global constant references QA: remove unnecessary assignment CS: get rid of "commented out code" warnings OneObjectStructurePerFile: move from `Extra` to `Core` GH Actions: don't use cs2pr in quicktest GH Actions: report CS violations in the PR GH Actions: get the tests running on PHP 8.1 (nightly) PHP 8.1 compatibility: fix deprecation notice [2] PHP 8.1 compatibility: fix deprecation notice [1] GH Actions: don't test against PHPCS 4.x (yet) Security/EscapeOutput: bug fix - allow for basename() being fully qualified 3.0: Move "is unit test" utility functions to dedicated trait (WordPress#1960) Move from TravisCI to GitHub Actions (WordPress#1965) Travis: add build against PHP 8.0 PHP/RestrictedPHPFunctions: update error message ...
With recent changes to the TravisCI's service, the organization is moving over to GitHub Actions. This PR will convert all of the builds in Travis to jobs in workflows within GitHub Actions.
This converts the TravisCI configuration into 4 workflow files representing the 4 different stages of testing within Travis.
I've done my best to replicate the testing stages with all of their needed parts with a few exceptions.
There is a
workflow_run
event type that is supposed to allow you to configure a workflow to run based on the results of other workflows. I could not get that to work in my testing. The value of that would be setting the quick tests and unit tests to only run when the sniffs and ruleset checks complete successfully.While it would be nice to set up this dependency, I think we could merge regardless in the interest of getting tests running again.
I also noticed that the
nightly
build was running with PHPCS 3.5.0, resulting in a failure. I updated this to use 3.5.7 instead.