Skip to content
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

Switch to GitHub Actions #143

Merged
merged 19 commits into from Sep 15, 2021
Merged

Switch to GitHub Actions #143

merged 19 commits into from Sep 15, 2021

Conversation

desrosj
Copy link
Contributor

@desrosj desrosj commented Feb 19, 2021

This PR adds an example workflow for implementing the test runner using GitHub Actions.

@desrosj desrosj self-assigned this Feb 19, 2021
.travis.yml Outdated Show resolved Hide resolved
the hoster should be able to choose between different ways to run the `phpunit-test-runner`
@pfefferle pfefferle self-assigned this May 19, 2021
Otherwise the reporting will be skipped if phpunit runs into errors.
@pfefferle pfefferle marked this pull request as ready for review May 21, 2021 08:34
@pfefferle pfefferle requested a review from getsource May 21, 2021 08:34
@pfefferle
Copy link
Member

@desrosj can you have a look at the latest changes?

Copy link
Contributor Author

@desrosj desrosj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for running with this, @pfefferle! I haven't looked into the reason why the workflow run is failing, but left some general feedback for the workflows themselves.

.github/workflows/tests.yml Show resolved Hide resolved
steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.8.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 3rd party actions, using version numbers and ranges is OK, but there are some tradeoffs. The Security hardening page in the GHA docs details these.

In Gutenberg and WordPress Core, we have adopted the pattern of using the full length commit SHA followed by an inline # v0.8.0 comment.

@pfefferle
Copy link
Member

@desrosj the test fails, because it is not configured properly. This repo should only be a whitepaper/example for hosters, how they can run the unit-tests with different action or CI/CD services.

@desrosj
Copy link
Contributor Author

desrosj commented Aug 18, 2021

@pfefferle I've made a handful of updates to polish the workflow. I think it's in a great state. I do think there is one thing we need to discuss before merging.

Since the workflow is an example for how hosts can run the tests using GHA, I think it should be disabled by default. I've added a condition in the workflow to never run, and documented that the implementer should remove that if GHA is preferred.

@pfefferle
Copy link
Member

@desrosj I have problems with the caching of actions/setup-node:

Found in cache @ /opt/hostedtoolcache/node/14.17.6/x64
/opt/hostedtoolcache/node/14.17.6/x64/bin/npm config get cache
/home/runner/.npm
Error: Dependencies lock file is not found in /home/runner/work/***/***. Supported file patterns: package-lock.json,yarn.lock

@pfefferle
Copy link
Member

Since the workflow is an example for how hosts can run the tests using GHA, I think it should be disabled by default. I've added a condition in the workflow to never run, and documented that the implementer should remove that if GHA is preferred.

I like the idea! 👍

@desrosj
Copy link
Contributor Author

desrosj commented Sep 13, 2021

@desrosj I have problems with the caching of actions/setup-node:

Found in cache @ /opt/hostedtoolcache/node/14.17.6/x64
/opt/hostedtoolcache/node/14.17.6/x64/bin/npm config get cache
/home/runner/.npm
Error: Dependencies lock file is not found in /home/runner/work/***/***. Supported file patterns: package-lock.json,yarn.lock

Ah, yes a lock file must be present for the NPM caching to configure correctly. But I'm not sure this can be configured because the npm install step happens in the middle of prepare.php. For now, I'm thinking we just remove the caching aspect.

This is difficult to set up because a `package-lock.json` file is required in order to create a cache key. In this context, the lock file should be the one from WordPress Core. But since WordPress is not checked out until the `prepare.php` step, caching cannot be configured before hand.
@desrosj
Copy link
Contributor Author

desrosj commented Sep 13, 2021

Updated! I think this one is looking pretty good!

@pfefferle
Copy link
Member

works like a charm 👍

Copy link
Member

@pfefferle pfefferle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pfefferle pfefferle merged commit 9957fe4 into master Sep 15, 2021
@pfefferle
Copy link
Member

Thanks a lot @desrosj !

@pfefferle pfefferle deleted the switch-to-github-actions branch September 15, 2021 09:31
@getsource
Copy link
Member

Thanks so much @pfefferle and @desrosj !! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants