diff --git a/.travis.yml b/.travis.yml index 877794f883a38..6fcc4d931c194 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 + install: + - npm ci script: - - npm install || exit 1 - - npm run ci || exit 1 + - npm run lint + - 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 + - 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 ) diff --git a/package.json b/package.json index 95ce65ad2682f..50048e3bc45e7 100644 --- a/package.json +++ b/package.json @@ -152,7 +152,6 @@ "check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2\" \"wp-scripts check-licenses --dev\"", "precheck-local-changes": "npm run docs:build", "check-local-changes": "( git diff -U0 | xargs -0 node bin/process-git-diff ) || ( echo \"There are local uncommitted changes after one or both of 'npm install' or 'npm run docs:build'!\" && exit 1 );", - "ci": "concurrently \"npm run lint\" \"npm run test-unit:ci\" \"npm run check-local-changes\"", "predev": "npm run check-engines", "dev": "npm run build:packages && concurrently \"cross-env webpack --watch\" \"npm run dev:packages\"", "dev:packages": "node ./bin/packages/watch.js", @@ -183,7 +182,6 @@ "test-unit": "wp-scripts test-unit-js --config test/unit/jest.config.json", "test-unit:update": "npm run test-unit -- --updateSnapshot", "test-unit:watch": "npm run test-unit -- --watch", - "test-unit:ci": "npm run test-unit -- --ci --runInBand", "test-unit-php": "docker-compose run --rm wordpress_phpunit phpunit", "test-unit-php-multisite": "docker-compose run -e WP_MULTISITE=1 --rm wordpress_phpunit phpunit" },