Merge pull request #210 from 10up/add/wp-php-badges #483
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 Tests | |
on: | |
push: | |
branches: | |
- develop | |
- trunk | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build: | |
uses: 10up/publisher-media-kit/.github/workflows/build-release-zip.yml@develop | |
cypress: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
core: | |
- {name: 'WP latest', version: 'latest'} | |
- {name: 'WP minimum', version: 'WordPress/WordPress#6.4'} | |
- {name: 'WP trunk', version: 'WordPress/WordPress#master'} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download build zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }} | |
path: ${{ github.event.repository.name }} | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: ${{ github.event.repository.name }} | |
- name: Setup node and npm cache | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: Install Node dependencies | |
run: npm ci --no-optional | |
- name: Set the core version and plugins config | |
run: ./tests/bin/set-wp-config.js --core=${{ matrix.core.version }} --plugins=./${{ github.event.repository.name }} | |
- name: Set up WP environment | |
run: npm run wp-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 | |
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@v4 | |
if: failure() | |
with: | |
name: cypress-artifact-publisher-media-kit | |
retention-days: 2 | |
path: | | |
${{ github.workspace }}/tests/cypress/screenshots/ | |
${{ github.workspace }}/tests/cypress/videos/ | |
${{ github.workspace }}/tests/cypress/logs/ |