Create pr-preview.yml for Playground previews on PRs
#2198
This file contains hidden or 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 Tests | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - trunk | |
| pull_request: | |
| branches: | |
| - develop | |
| jobs: | |
| cypress: | |
| name: ${{ matrix.core.name }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| core: | |
| - {name: 'WP latest', version: 'latest'} | |
| - {name: 'WP minimum', version: 'WordPress/WordPress#6.8'} | |
| - {name: 'WP trunk', version: 'WordPress/WordPress#master'} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Composer (optional) | |
| run: composer update -W | |
| continue-on-error: true | |
| - name: Build (optional) | |
| run: npm run build | |
| continue-on-error: true | |
| - name: Set the core version | |
| run: ./tests/bin/set-core-version.js ${{ matrix.core.version }} | |
| - name: Set up WP environment | |
| run: npm run env:start | |
| - name: Test | |
| run: npm run cypress:run | |
| - name: Update summary | |
| run: | | |
| npx mochawesome-merge ./tests/cypress/reports/*.json -o tests/cypress/reports/mochawesome.json | |
| rm -rf ./tests/cypress/reports/mochawesome-*.json | |
| npx mochawesome-json-to-md -p ./tests/cypress/reports/mochawesome.json -o ./tests/cypress/reports/mochawesome.md -t ./tests/cypress/template.md | |
| npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/ | |
| cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | |
| if: failure() | |
| with: | |
| name: cypress-artifact-classifai-wp-${{ matrix.core.name }} | |
| retention-days: 7 | |
| path: | | |
| ${{ github.workspace }}/tests/cypress/screenshots/ | |
| ${{ github.workspace }}/tests/cypress/videos/ | |
| ${{ github.workspace }}/tests/cypress/logs/ | |
| ${{ github.workspace }}/tests/cypress/reports/ |