-
Notifications
You must be signed in to change notification settings - Fork 21
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
Migrate Travis CI tasks to GitHub Actions #1040
Conversation
WDYT of using the node version from |
Currently, there should be only one place that uses a hardcode node version: google-listings-and-ads/.github/workflows/bundle-size.yml Lines 20 to 24 in 56ee88b
The reason is that I recalled several discussions about the node version used for building a bundle, and from slack I found that node
If that's not an issue anymore, then we could remove the |
I'd rather make sure it's set to the exact same version as https://github.com/woocommerce/google-listings-and-ads/blob/develop/.nvmrc, which is the version that was used on Travis before, but more importantly, that's the version we use locally to build (if we use NVM). Which has the benefit of keeping all the parties at the same version, and a single point to set it up. If the issue with building with lts would pop up, we should rather fix the issue, not downgrade, not to makes lag too far behind. |
I recently learned (naturally from reading the code, not from the docs 😬), that Edit: but adding E2E tests to CI could be a separate PR. |
.github/workflows/js-unit-tests.yml
Outdated
- name: Get npm cache directory | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
|
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 wonder If we could somehow DRY it, as this bit repeats in many other workflows.
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.
Doing a search about this led me to this issue as well as Composite Actions. I didn't delve deeply enough to see how that might play out with our actions.
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.
Adjusted by 148dd5f, b86b5fe, and e7467f7. And it needs some workarounds due to lack of if
syntax in composite actions. (ref: actions/runner#834)
@@ -23,7 +23,8 @@ | |||
"dealerdirect/phpcodesniffer-composer-installer": "^v0.7", | |||
"phpunit/phpunit": "^7.5", | |||
"wp-cli/i18n-command": "^2.2", | |||
"wp-coding-standards/wpcs": "^2.3" | |||
"wp-coding-standards/wpcs": "^2.3", | |||
"yoast/phpunit-polyfills": "^1.0" |
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.
❓
Is this a dependency needed for GH Actions, or something that was missing before?
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's the problem stuck me for the longest before. I got error when running composer test-unit
on my local and GHA. Not sure why it can run successfully on Travis CI.
> ./vendor/bin/phpunit
Error: The PHPUnit Polyfills library is a requirement for running the WP test suite.
If you are trying to run plugin/theme integration tests, make sure the PHPUnit Polyfills library (https://github.com/Yoast/PHPUnit-Polyfills) is available and either load the autoload file of this library in your own test bootstrap before calling the WP Core test bootstrap file; or set the absolute path to the PHPUnit Polyfills library in a "WP_TESTS_PHPUNIT_POLYFILLS_PATH" constant to allow the WP Core bootstrap to load the Polyfills.
If you are trying to run the WP Core tests, make sure to set the "WP_RUN_CORE_TESTS" constant to 1 and run `composer install` before running the tests.
Once the dependencies are installed, you can run the tests using the Composer-installed version of PHPUnit or using a PHPUnit phar file, but the dependencies do need to be installed whichever way the tests are run.
Script ./vendor/bin/phpunit handling the test-unit event returned with error code 1
Finally, I ended up this problem by adding the yoast/phpunit-polyfills
dependency.
Tested build bundle with LTS version and it works well. I removed the specified node version And since the built-in node version of |
I forgot to update the status badges within README before. Added by 9137422. |
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.
LGTM :)
Changes proposed in this Pull Request:
Somehow seems all repos under Woo were stopped CI tasks on Travis CI. This PR migrates CI tasks to GitHub Actions:
Additional notes
Since the
WC_VERSION
in install-wp-tests.sh doesn't take from a command param, theWC_VERSION
of matrix values in .travis.yml have never been used when running PHP unit tests on Travis CI. Therefore, I didn't migrate the matrix of specifiedWC_VERSION
such asWC_VERSION=5.2
.google-listings-and-ads/bin/install-wp-tests.sh
Line 23 in 56ee88b
google-listings-and-ads/.travis.yml
Lines 32 to 37 in 56ee88b
Screenshots:
Detailed test instructions:
Go to the Checks tab for details
Changelog entry