-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Improve Travis CI build times #13103
Changes from all commits
0b2f880
976e8c2
c37ba28
95f9981
1bb8a1c
94ffdce
af4100d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||
dist: trusty | ||||
|
||||
language: php | ||||
language: generic | ||||
|
||||
services: | ||||
- docker | ||||
|
@@ -13,56 +13,83 @@ notifications: | |||
cache: | ||||
directories: | ||||
- $HOME/.composer/cache | ||||
- $HOME/.phpbrew | ||||
- $HOME/.jest-cache | ||||
- $HOME/.npm | ||||
|
||||
before_install: | ||||
- nvm install && nvm use | ||||
- npm install npm -g | ||||
- $HOME/.nvm/.cache | ||||
- $HOME/.phpbrew | ||||
|
||||
branches: | ||||
only: | ||||
- master | ||||
|
||||
before_install: | ||||
- nvm install | ||||
|
||||
jobs: | ||||
include: | ||||
- stage: test | ||||
- name: JS unit tests | ||||
env: WP_VERSION=latest | ||||
before_install: | ||||
- nvm install --latest-npm | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, why is it needed here? Does it override There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes defining |
||||
install: | ||||
- npm ci | ||||
script: | ||||
- npm install || exit 1 | ||||
- npm run ci || exit 1 | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this command not useful anymore? should we remove it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's no longer used once removed from here Line 155 in 7ea5021
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, and stting a I suspect we have only 2 cores as we use Travis-CI.org rather than Travis-CI.com, some benchmark testing in a follow-up PR would be worthwhile to measure this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we have only 2 cores on our environment. I experimented with this yesterday and Will look into removing or changing |
||||
- npm run lint | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noting that those 3 commands were executed concurrently before. I didn't benchmark it but given that we use all 2 cores with unit tests it might have no impact at all :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is intentional. I checked and it's faster to run these commands sequentially. I also like that it reports lint errors back to the developer really quickly 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding
It used to be in WP, but was removed due to a Travis CI bug with the feature: |
||||
- npm run check-local-changes | ||||
- npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" | ||||
|
||||
- stage: test | ||||
- name: PHP unit tests (Docker) | ||||
env: WP_VERSION=latest DOCKER=true | ||||
script: | ||||
- ./bin/run-wp-unit-tests.sh | ||||
|
||||
- stage: test | ||||
- name: PHP unit tests (PHP 5.6) | ||||
language: php | ||||
php: 5.6 | ||||
env: WP_VERSION=latest | ||||
script: | ||||
- ./bin/run-wp-unit-tests.sh | ||||
if: branch = master and type != "pull_request" | ||||
|
||||
- stage: test | ||||
php: 7.1 | ||||
- name: PHP unit tests (PHP 5.3) | ||||
env: WP_VERSION=latest SWITCH_TO_PHP=5.3 | ||||
script: | ||||
- ./bin/run-wp-unit-tests.sh | ||||
if: branch = master and type != "pull_request" | ||||
|
||||
- stage: test | ||||
php: 7.1 | ||||
- name: PHP unit tests (PHP 5.2) | ||||
env: WP_VERSION=latest SWITCH_TO_PHP=5.2 | ||||
script: | ||||
- ./bin/run-wp-unit-tests.sh | ||||
|
||||
- stage: test | ||||
- name: E2E tests (Admin with plugins) (1/2) | ||||
env: WP_VERSION=latest POPULAR_PLUGINS=true | ||||
install: | ||||
- ./bin/setup-local-env.sh | ||||
script: | ||||
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests | ||||
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests ) | ||||
|
||||
- name: E2E tests (Admin with plugins) (2/2) | ||||
env: WP_VERSION=latest POPULAR_PLUGINS=true | ||||
install: | ||||
- ./bin/setup-local-env.sh | ||||
script: | ||||
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this logic to running only the subset of test files is something that could be included in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We aren't able to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's correct. Also I was thinking about changing the way the script |
||||
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests ) | ||||
|
||||
- name: E2E tests (Author without plugins) (1/2) | ||||
env: WP_VERSION=latest E2E_ROLE=author | ||||
install: | ||||
- ./bin/setup-local-env.sh | ||||
script: | ||||
- ./bin/run-e2e-tests.sh || exit 1 | ||||
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests | ||||
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests ) | ||||
|
||||
- stage: test | ||||
- name: E2E tests (Author without plugins) (2/2) | ||||
env: WP_VERSION=latest E2E_ROLE=author | ||||
install: | ||||
- ./bin/setup-local-env.sh | ||||
script: | ||||
- ./bin/run-e2e-tests.sh || exit 1 | ||||
- $( npm bin )/jest --config test/e2e/jest.config.json --listTests > ~/.jest-e2e-tests | ||||
- npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 1' < ~/.jest-e2e-tests ) |
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 believe this is for older versions of Composer, see WPCS#1435 for reference, so maybe:
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've confirmed that this is correct by running
composer config cache-dir
in the CI environment and getting/home/travis/.composer/cache
.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.
Right, all 7 CI jobs in this PR use
Composer version 1.5.2
, the latest is 1.8.0.When I run
$ echo $(composer config cache-dir)
on one of my CI jobs, it's usingComposer version 1.8.0
and the cache directory is/home/travis/.cache/composer
Bumping the environemnt from Trusty to Xenial might be worth exploring here in a follow up PR