feat: enable deploy job in release workflow #38
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: Playwright | |
| on: | |
| pull_request: | |
| types: [labeled, synchronize, opened, reopened] | |
| push: | |
| branches: | |
| - 'core' | |
| paths-ignore: | |
| - '**.md' | |
| - '**.txt' | |
| - '.gitignore' | |
| - 'docs/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| actions: read | |
| concurrency: | |
| group: playwright-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| build-plugin: | |
| if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests') | |
| name: Build plugin | |
| uses: ./.github/workflows/build.yml | |
| Playwright: | |
| name: Playwright test on PHP 8.1 | |
| runs-on: ubuntu-22.04 | |
| needs: [build-plugin] | |
| if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests') | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: 'npm' | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ needs.build-plugin.outputs.artifact_name }} | |
| path: ./build | |
| - name: Copy built plugin to source directory | |
| run: | | |
| rm -rf ./src | |
| cp -r ./build/code-snippets ./src | |
| - name: Install workflow dependencies (wp-env, playwright) | |
| run: npm run prepare-environment:ci | |
| - name: Start WordPress environment | |
| run: | | |
| npx wp-env start | |
| - name: Activate code-snippets plugin | |
| run: npx wp-env run cli wp plugin activate code-snippets | |
| - name: WordPress debug information | |
| run: | | |
| npx wp-env run cli wp core version | |
| npx wp-env run cli wp --info | |
| - name: Install playwright/test | |
| run: | | |
| npx playwright install chromium | |
| - name: Run Playwright tests | |
| run: npm run test:playwright | |
| - name: Stop WordPress environment | |
| if: always() | |
| run: npx wp-env stop | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-test-results | |
| path: test-results/ | |
| if-no-files-found: ignore | |
| retention-days: 2 | |
| test-result: | |
| needs: [Playwright] | |
| if: always() && (needs.Playwright.result != 'skipped') | |
| runs-on: ubuntu-22.04 | |
| name: Playwright - Test Results | |
| steps: | |
| - name: Test status | |
| run: echo "Test status is - ${{ needs.Playwright.result }}" | |
| - name: Check Playwright status | |
| if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }} | |
| run: exit 1 |