Abstract Sync page logic into a provider pattern #3216
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E Test | |
env: | |
COMPOSER_VERSION: "2" | |
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache" | |
NODE_VERSION: "18" | |
NODE_CACHE: "${{ github.workspace }}/node_modules_cache" | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: | |
- develop | |
- trunk | |
pull_request: | |
branches: | |
- develop | |
- '[0-9].[0-9x]*' # Version branches: 4.x.x, 4.1.x, 5.x | |
jobs: | |
cypress_local: | |
name: Cypress - Local | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
testGroup: ['@slow', '-@slow'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepare npm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.NODE_CACHE }} | |
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.NODE_VERSION }}- | |
- name: Prepare composer cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.COMPOSER_CACHE }} | |
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
composer-${{ env.COMPOSER_VERSION }}- | |
- name: Set PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
tools: cs2pr | |
coverage: none | |
- name: composer install | |
run: composer install | |
- name: "Install node v${{ env.NODE_VERSION }}" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
run: npm ci --include=dev | |
- name: Set up WP environment with Elasticsearch | |
run: npm run env:start | |
- name: Build asset | |
run: npm run build | |
- name: Set up database | |
run: npm run cypress:setup | |
- name: Test | |
run: npm run cypress:run -- --env grepTags=${{ matrix.testGroup }} | |
- name: Make artifacts available | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-artifact | |
retention-days: 2 | |
path: | | |
${{ github.workspace }}/tests/cypress/screenshots/ | |
${{ github.workspace }}/tests/cypress/videos/ | |
${{ github.workspace }}/tests/cypress/logs/ | |
- name: Stop Elasticsearch | |
if: always() | |
run: cd bin/es-docker/ && docker-compose down | |
- name: Test plugin uninstall | |
if: always() | |
run: | | |
PLUGIN_NAME=$(basename "$PWD") | |
! ./bin/wp-env-cli tests-wordpress "wp --allow-root plugin deactivate ${PLUGIN_NAME} --network" | |
! ./bin/wp-env-cli tests-wordpress "wp --allow-root plugin deactivate ${PLUGIN_NAME}" | |
./bin/wp-env-cli tests-wordpress "cp -r wp-content/plugins/${PLUGIN_NAME} wp-content/plugins/ep-delete" | |
./bin/wp-env-cli tests-wordpress "wp --allow-root plugin uninstall ep-delete" | |
cypress_epio: | |
name: Cypress - EP.io | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
testGroup: ['@slow', '-@slow'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepare npm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.NODE_CACHE }} | |
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.NODE_VERSION }}- | |
- name: Prepare composer cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.COMPOSER_CACHE }} | |
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
composer-${{ env.COMPOSER_VERSION }}- | |
- name: Set PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
tools: cs2pr | |
coverage: none | |
- name: composer install | |
run: composer install | |
- name: "Install node v${{ env.NODE_VERSION }}" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
run: npm ci --include=dev | |
- name: Set up WP environment | |
run: | | |
npm run env start | |
npm run env:install-tests-cli | |
- name: Build asset | |
run: npm run build | |
- name: Set up database | |
run: npm run cypress:setup -- --ep-host=${{ secrets.EPIO_HOST }} --es-shield='${{ secrets.EPIO_SHIELD }}' --ep-index-prefix=${{ secrets.EPIO_INDEX_PREFIX }} | |
- name: Test | |
run: npm run cypress:run -- --env grepTags=${{ matrix.testGroup }} | |
- name: Make artifacts available | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-artifact-epio | |
retention-days: 2 | |
path: | | |
${{ github.workspace }}/tests/cypress/screenshots/ | |
${{ github.workspace }}/tests/cypress/videos/ | |
${{ github.workspace }}/tests/cypress/logs/ | |
- name: Delete Elasticsearch indices | |
if: always() | |
run: | | |
PLUGIN_NAME=$(basename "$PWD") | |
./bin/wp-env-cli tests-wordpress "wp --allow-root plugin activate ${PLUGIN_NAME} --network" | |
./bin/wp-env-cli tests-wordpress "wp --allow-root elasticpress-tests delete-all-indices" | |
- name: Test plugin uninstall | |
if: always() | |
run: | | |
PLUGIN_NAME=$(basename "$PWD") | |
! ./bin/wp-env-cli tests-wordpress "wp --allow-root plugin deactivate ${PLUGIN_NAME} --network" | |
! ./bin/wp-env-cli tests-wordpress "wp --allow-root plugin deactivate ${PLUGIN_NAME}" | |
./bin/wp-env-cli tests-wordpress "cp -r wp-content/plugins/${PLUGIN_NAME} wp-content/plugins/ep-delete" | |
./bin/wp-env-cli tests-wordpress "wp --allow-root plugin uninstall ep-delete" |