Update plugin unit testing with more WordPress versions and Nightly WordPress builds #1345
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 | |
on: | |
pull_request: | |
paths-ignore: | |
- '**/*.md' | |
jobs: | |
e2e-test-next-getting-started-example: | |
name: (faustwp) Next Getting Started Example on Node ${{ matrix.node }} | |
runs-on: ubuntu-22.04 | |
env: | |
PR_REPO: ${{github.event.pull_request.head.repo.full_name}} | |
PR_BRANCH: ${{github.event.pull_request.head.ref}} | |
strategy: | |
matrix: | |
node: ['18', '20'] | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
# Get the PR branch so we can pull the correct Next.js example path | |
- name: echo current pr branch name | |
run: | | |
echo $PR_BRANCH | |
# Get the PR repo so we can pull the correct Next.js example path | |
- name: echo current pr repo | |
run: | | |
echo $PR_REPO | |
# Install the Faust.js Next getting started example via npx create next app | |
# and use the PR branch to pull the correct example URL | |
- name: npx create next app | |
run: | | |
npx create-next-app@13 \ | |
-e https://github.com/${PR_REPO}/tree/${PR_BRANCH} \ | |
--example-path examples/next/faustwp-getting-started \ | |
--use-npm \ | |
e2e-app | |
- name: install and build packages | |
working-directory: ./ | |
run: | | |
npm ci | |
npm run build | |
# To ensure PR changes are tested accurately, we replace the | |
# faust node_modules downloaded from NPM with the faust packages | |
# built in the previous step | |
# TODO: It would be nice to use symlink or npm link here, but upon | |
# writing this they do not function as expected on GH actions | |
- name: replace downloaded registry faust packages with local build | |
run: | | |
rm -rf e2e-app/node_modules/@faustwp/cli | |
rm -rf e2e-app/node_modules/@faustwp/core | |
cp -r packages/faustwp-cli e2e-app/node_modules/@faustwp/cli | |
cp -r packages/faustwp-core e2e-app/node_modules/@faustwp/core | |
chmod +x e2e-app/node_modules/.bin/faust | |
- name: copy env | |
working-directory: e2e-app | |
run: | | |
cp .env.local.sample .env.local | |
# Generate the schema to ensure no type collisions | |
- name: Generate Schema | |
working-directory: e2e-app | |
run: | | |
npm run generate | |
- name: Build | |
working-directory: e2e-app | |
run: | | |
npm run build |