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: move format, lint and test jobs to GitHub Actions #1814
Conversation
e4baa59
to
2bd9fb1
Compare
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.
This looks awesome to me! I left a few small comments and questions.
I’m not exactly sure how to on Actions for the repo or what is needed to make this run. It’s already turned on for the org 🤔
Then I guess it should work once we merge it 🤔 I think we can merge it and test out, I can't find precise docs on this. We can always revert if it doesn't work for some reason 😄 |
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 don't have much experience with Actions, but I'm a fan of the idea
@paulmelnikow Shall we get it merged? |
be0e181
to
1635b06
Compare
It seems like perhaps there isn't a way to run this on the nock repo until this gets merged so I'd like to go ahead and do that. One concern I have is if tests are no longer run in Travis, the semantic-release pipeline will not be dependent on tests. Do you think you could update the Travis config to run tests on master before releasing it? I think @gr2m has done a lot of work on getting semantic-release to run in Actions so I think it'll be possible to do that, though that isn't blocking and this has been open a long time. |
Actually I think that is a good think. We have enforced the pull request workflow, nobody should push to master directly. With that, we don't need to run tests on master, because nothing can be merged without the green check from the tests. Once merged, semantic-release should just do its thing. It's super simple to run semantic-release from Actions, too. I do it all the time. Here is an example setup of mine
For the release flow, we need to create add the We can do a follow up PR after we merge this to move the relaese to Actions, too. |
@@ -25,24 +23,9 @@ jobs: | |||
node_js: lts/* | |||
script: | |||
- git checkout $TRAVIS_BRANCH | |||
- npm run prettier | |||
- npm run format:fix | |||
# commit changes and push back to branch on GitHub. If there are no changes then exit without error | |||
- 'git commit -a -m "style: prettier" && git push "https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG" ${TRAVIS_BRANCH} || true' |
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.
We can move that to an action, too. I wrote about it here: https://dev.to/gr2m/automate-updates-of-prettier-standard-and-other-javascript-linting-tools-using-github-actions-nko
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.
Sure, we can. Although I'd prefer to do it in a separate PR instead of making this one even larger. Is it ok with you? Seems like it doesn't have to be merged at the same time.
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.
Absolutely, I'd suggest the same. Sorry, I should have said so
@paulmelnikow I understand that since "branch up to date" requirement is enabled, you're ok with merging it as-is? I think it's good to have this setting enabled, so the master branch is always healthy. |
Yup, it looks good to me! @gr2m does this look good to you? |
moved to #1870 to see how the jobs run |
@merlinnot any reason why you put all the jobs in a single workflow? I would prefer to split them up into multiple |
Yes, there are actually some reasons to do so. For Greenkeeper itself I see two
|
I agree with this. |
I would create separate actions that run That will have the benefit that the PRs will fix themselves, we won't need to run the commands and push back the changes manually |
For the updates to be pushed back to the branch it doesn't really matter if it's a single file or multiple files, right? While I personally don't mind doing or not doing it (both have pros and cons), I committed to implementing it somewhere above, it's just that I'd like to do it in a separate PR, so that it doesn't grow too much. Small steps. Is that ok with you, or do you feel the need to have this feature in this particular PR? |
Oh, and you can see this particular branch being built here: merlinnot#1 |
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.
All sounds good to me. Great work @merlinnot 💐
🎉 This PR is included in version 11.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This does the following:
Some trickery is used to cache ESLint results. npm cache is mostly straightforward, with a one workaround for Windows. Both explained in comments.
I renamed
prettier
step toformat
. Why? Because it's easier to understand for contributors. There are multiple formatters available, not everyone knows what Prettier is (I personally love it and use all the time, but we should be inclusive). Name "format" is more understandable. Same forlint:fix
andformat:fix
-> no surprises, self-explanatory. Hope you'll like the change.You can see it in action here, I made a PR on my branch: https://github.com/merlinnot/nock/pull/1/checks
GitHub Actions go GA in five days. To start running it today, you need to enable it for the repo here: https://github.com/features/actions (open for everyone).
For the last two steps I'll create separate PRs.
Resolves #1792