Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugin unit testing with more WordPress versions and Nightly WordPress builds #1887

Merged
merged 26 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e-next-example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: E2E Test
name: E2E Test Packages (Legacy)

on:
pull_request:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-next-faustwp-example.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: E2E Test
name: E2E Test Packages

on:
pull_request:
paths-ignore:
- '**/*.md'

jobs:
e2e-test-next-getting-started-example:
e2e-test-faustwp-getting-started-example:
name: (faustwp) Next Getting Started Example on Node ${{ matrix.node }}
runs-on: ubuntu-22.04
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-nightly-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: E2E Nightly Test
name: E2E Test Packages (Nightly)

on:
workflow_run:
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/e2e-test-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: E2E Test Plugin
name: E2E Test Plugin (Legacy)

on:
pull_request:
paths-ignore:
- '**/*.md'

jobs:
e2e_test_plugin:
e2e_test_plugin_legacy:
timeout-minutes: 10
runs-on: ubuntu-22.04
steps:
Expand All @@ -20,12 +20,6 @@ jobs:
run: |
npm ci
npm run build
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: pcov
ini-values: pcov.directory=includes
- name: Setup Frontend
run: |
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8080 FAUSTWP_SECRET_KEY=00000000-0000-4000-8000-000000000001 npm run dev:next:getting-started &
Expand All @@ -34,7 +28,10 @@ jobs:
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
- name: Setup Containers
working-directory: plugins/faustwp
run: docker-compose up -d
run: |
docker-compose build \
--build-arg WP_VERSION=6.4
docker-compose up -d
- name: Sleep 15 seconds
run: sleep 15
- name: Maybe upgrade WP DB
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/test-plugin.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '**/*.md'

jobs:
test_packages:
unit-test_packages:
name: "Test packages on Node.js ${{ matrix.node }} ${{ matrix.os }}"
strategy:
matrix:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/unit-test-plugin-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Unit Test Plugin / WordPress Nightly

on:
pull_request:
paths-ignore:
- '**/*.md'

jobs:
unit_test_plugin:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create Docker Containers
working-directory: ./plugins/faustwp
run: |
docker-compose build \
--build-arg WP_VERSION=6.5
docker-compose up -d

- name: Wait for db
run: |
while ! mysqladmin ping --host=127.0.0.1 --port=33066 --password=$MYSQL_ROOT_PASSWORD --silent; do
sleep 1
done

- name: Setup testing framework
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 $(docker-compose ps -q wordpress) init-testing-environment.sh

- name: Ensure Correct WordPress version
working-directory: ./plugins/faustwp
run: |
docker exec -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) wp core version --allow-root
docker exec -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) wp core upgrade --version=nightly --force --allow-root
docker exec -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) wp core version --allow-root

- name: Install and activate WP GraphQL
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) wp plugin install wp-graphql --activate --allow-root

- name: Install Dependencies
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) composer install

- name: Run unit tests
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) composer test
48 changes: 48 additions & 0 deletions .github/workflows/unit-test-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Unit Test Plugin

on:
pull_request:
paths-ignore:
- '**/*.md'

jobs:
unit_test_plugin:
name: WordPress ${{ matrix.wordpress }}
runs-on: ubuntu-22.04
strategy:
matrix:
wordpress: [ '6.5', '6.4', '6.3', '6.2', '6.1' ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create Docker Containers
env:
WP_VERSION: ${{ matrix.wordpress }}
working-directory: ./plugins/faustwp
run: |
docker-compose build \
--build-arg WP_VERSION=${{ matrix.wordpress }}
docker-compose up -d

- name: Wait for db
run: |
while ! mysqladmin ping --host=127.0.0.1 --port=33066 --password=$MYSQL_ROOT_PASSWORD --silent; do
sleep 1
done

- name: Setup testing framework
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 $(docker-compose ps -q wordpress) init-testing-environment.sh

- name: Install and activate WP GraphQL
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) wp plugin install wp-graphql --activate --allow-root

- name: Install Dependencies
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) composer install

- name: Run unit tests
working-directory: ./plugins/faustwp
run: docker exec -e COVERAGE=1 -w /var/www/html/wp-content/plugins/faustwp $(docker-compose ps -q wordpress) composer test
7 changes: 2 additions & 5 deletions plugins/faustwp/.docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ARG WP_VERSION=6.4

FROM wordpress:${WP_VERSION}

# Needed to specify the build args again after the FROM command.
ARG WP_VERSION

FROM wordpress:${WP_VERSION}-php8.2

# Save the build args for use by the runtime environment
ENV WP_VERSION=${WP_VERSION}

Expand Down
1 change: 1 addition & 0 deletions plugins/faustwp/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
links:
- db
environment:
WP_VERSION: ${WP_VERSION:-6.5}
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
Expand Down
Loading