Enhancement: Run lint target using GitHub Actions#128
Enhancement: Run lint target using GitHub Actions#128ondrejmirtes merged 21 commits intophpstan:masterfrom
Conversation
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
If you prefer a different name for the workflow, let me know.
The name will be reflected on the badge.
For an example, see https://github.com/ergebnis/composer-normalize:
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
If you prefer not to quote strings in YAML files, let me know, then I will adjust.
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
This will run a build for a pull request (not two).
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
This will run a build for pushes into master (e.g., when a pull request is merged or a commit is pushed directly into master).
The Travis behavior can be reflected using
diff --git a/.github/continuous-integration.yml b/.github/continuous-integration.yml
index e0d82dec..743573a3 100644
--- a/.github/continuous-integration.yml
+++ b/.github/continuous-integration.yml
@@ -3,10 +3,8 @@
name: "Continuous Integration"
on:
- pull_request:
- push:
- branches:
- - "master"
+ - "pull_request"
+ - "push"
jobs:
lint:
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
Since I'm not sure whether we need any specific extensions not already installed, perhaps it's sufficient not to use shivammathur/setup-php yet.
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
See https://github.com/actions/checkout.
Note: There currently is no proper version resolving, so I believe it's best to reference tags.
Some action authors continually update the tag - for an example, see https://github.com/shivammathur/setup-php/releases.
For reference, see https://github.community/t5/GitHub-Actions/Version-numbering-for-Actions/m-p/32282#M1070.
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
We can remove this step if you prefer not to use caching.
.github/continuous-integration.yml
Outdated
There was a problem hiding this comment.
4cc2368 to
887626a
Compare
|
I've pushed some commits. I currently don't know anything about GitHub Actions, but some things seem weird to me:
Also, with this commit (887626a), the result will probably be different than I intend. I want each step to run independently of each other, in parallel. I suspect the structure would have to resemble something like this more (https://github.com/ergebnis/composer-normalize/blob/master/.github/workflows/continuous-integration.yml) to achieve that. But I'll wait for your answers to above items :) Next steps after we sort out the things above:
|
|
Yeah, and we should run the checks on all PHP versions from 7.1 to 7.4 :) |
Yes, I fixed it.
The problem here is that the GitHub Actions aren't triggered unless
That is, if you push into this branch - now that I have moved the workflow definition to the correct directory - we should be able to see that workflow triggered.
I have added it now. I had left it out intentionally because
It has been added now!
I have split out the single Let's see how it goes! 👍
Let's take a look as soon as the build has passed here, then we can either add https://github.com/staabm/annotate-pull-request-from-checkstyle or directly use /cc @staabm
Sounds good! |
There was a problem hiding this comment.
Question is: do we need run this
- against all PHP versions
- only the lowest supported one
?
I believe the latter suffices.
b126968 to
9b2b6b7
Compare
.github/workflows/build.yml
Outdated
There was a problem hiding this comment.
The name used here does not need to match the name of the workflow definition file.
However, I think it makes sense when they have at least a similar name.
915f3f5 to
cf29ebd
Compare
|
Awesome job so far, I like what I'm seeing :) I pushed some more commits into this branch and it doesn't look like Actions was triggered? I can push some minimal file to master so that we can get this running. BTW I thought that setup-php was required, otherwise I didn't see how GitHub can figure out that we want to use PHP. But I think it will still be useful for Windows build. One more question - some DRY in the definition file wouldn't hurt, do you think it's possible? |
cf29ebd to
6998ab5
Compare
|
This has been bugging me sometimes: Not sure why it's not happening in pull requests on Travis... |
|
I submitted the issue in Composer because I really don't know what to do about it: composer/composer#8579 |
fee27da to
ec62f69
Compare
|
not sure why the build errors. maybe it is worth disabling the actions cache for now - it might affect the build. |
|
The cache cannot be the reason for the failures since there's no job yet that succeded and populated the cache. |
.github/workflows/build.yml
Outdated
There was a problem hiding this comment.
Looks like this could be a potential workaround, @ondrejmirtes - I have moved it to the workflow level (so we don't have to repeat it).
It's currently not possible to use anchors - see https://github.community/t5/GitHub-Actions/Support-for-YAML-anchors/m-p/30336.
This reverts commit cd91cfd021e756b4609e4a82294508b2b9af4bee.
e700f0b to
10d041a
Compare
|
Thank you, @ondrejmirtes! |
|
Thank you, it's perfect! I enjoyed this collaboration. Would you have time to look at the Windows build? My idea is:
Then we could move onto phpstan/phpstan and convert all the current build checks to GitHub Actions as well. That will be easy. And then we could do the hard stuff with secrets at the end, but it's not pressing. We already have most of the benefits GitHub Actions offer which is great. What are the things with secrets:
|
|
Sure, let's continue working on this! 👍 |
|
Are we able to define dependencies between workflows? E.g. run whole |

This PR
linttarget using GitHub Actions