Skip to content
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
55 changes: 55 additions & 0 deletions .github/workflows/create-plugin-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Create Plugin Zip

on:
workflow_dispatch:
workflow_call:
inputs:
ref:
description: 'The branch, tag or SHA to checkout'
required: false
type: string
default: ''
outputs:
artifact-name:
description: 'The name of the uploaded artifact'
value: ${{ jobs.generate-archive.outputs.artifact-name }}

jobs:
generate-archive:
runs-on: ubuntu-22.04
outputs:
artifact-name: notificationx
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- uses: actions/setup-node@v4
with:
node-version: '14'

- name: Running NPM Install
run: npm install

- name: Delete WordPress Compose node_modules
run: rm -rf ./node_modules/@wordpress/compose/node_modules

- name: Delete WordPress Scripts node_modules
run: rm -rf ./node_modules/@wordpress/scripts/node_modules

- name: Build assets
run: npm run build

- name: Package native build via Rsync
run: |
echo "📦 Packaging built NotificationX natively without 3rd party zip tools..."
mkdir -p build_output/notificationx
rsync -rc --exclude-from=".distignore" ./ build_output/notificationx/

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: notificationx
path: build_output/notificationx
retention-days: 1
22 changes: 0 additions & 22 deletions .github/workflows/dist-archive.yml

This file was deleted.

148 changes: 148 additions & 0 deletions .github/workflows/notificationx-compatibility-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: NotificationX Compatibility Test

on:
workflow_call:
inputs:
artifact-name:
required: true
type: string
description: 'The name of the build artifact'

jobs:
wordpress-test:
name: WP ${{ matrix.wordpress }} / PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- wordpress: '6.9.4'
php: '7.4'
- wordpress: '6.9.4'
php: '8.1'
- wordpress: '6.9.4'
php: '8.4'
- wordpress: '6.9.4'
php: '8.5'
- wordpress: '6.7'
php: '8.1'
- wordpress: '6.5'
php: '7.4'

services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: notificationx

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysqli, mbstring, xml, curl, zip, intl, gd
coverage: none
tools: composer, wp-cli

- name: Wait for MySQL to be ready
run: |
echo "⏳ Waiting for MySQL to be ready..."
for i in {1..30}; do
if mysqladmin ping -h"127.0.0.1" -P"3306" -u"root" -p"root" --silent; then
echo "✅ MySQL is ready!"
break
fi
echo "Waiting for MySQL... ($i/30)"
sleep 2
done

- name: Download WordPress ${{ matrix.wordpress }}
run: |
WP_VER=${{ matrix.wordpress }}
if [ "$WP_VER" == "master" ]; then WP_VER="nightly"; fi
wp core download --version=$WP_VER --path=/tmp/test-site

- name: Create WordPress configuration
run: |
wp config create \
--path=/tmp/test-site \
--dbname=wordpress_test \
--dbuser=root \
--dbpass=root \
--dbhost=127.0.0.1:3306 \
--skip-check

- name: Install WordPress
run: |
wp core install \
--path=/tmp/test-site \
--url=http://localhost \
--title="NotificationX CI Test" \
--admin_user=admin \
--admin_password=admin \
--admin_email=test@example.com \
--skip-email

# Enable debug mode
wp config set WP_DEBUG true --raw --path=/tmp/test-site
wp config set WP_DEBUG_LOG true --raw --path=/tmp/test-site
wp config set WP_DEBUG_DISPLAY false --raw --path=/tmp/test-site

- name: Copy plugin to WordPress
run: |
mkdir -p /tmp/test-site/wp-content/plugins/notificationx
cp -r notificationx/* /tmp/test-site/wp-content/plugins/notificationx/

- name: Activate NotificationX plugin
run: |
echo "🔌 Activating NotificationX plugin..."
wp plugin activate notificationx --path=/tmp/test-site

if [ $? -ne 0 ]; then
echo "❌ Plugin activation failed!"
exit 1
fi
echo "✅ Plugin activated successfully"

- name: Verify plugin is active
run: |
echo "🔍 Verifying plugin activation..."
wp plugin list --path=/tmp/test-site --status=active --format=csv | grep notificationx

if [ $? -ne 0 ]; then
echo "❌ Plugin is not in active plugins list!"
exit 1
fi
echo "✅ Plugin is active and verified"


- name: Final Status Report
if: always()
run: |
echo "📊 Final Status Report"
echo "======================"
echo "WordPress: $(wp core version --path=/tmp/test-site)"
echo "PHP: $(php -v | head -n 1)"
echo "Plugin Status:"
wp plugin list --path=/tmp/test-site --format=table --name=notificationx
echo "======================"

- name: Upload debug log on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: debug-log-wp${{ matrix.wordpress }}-php${{ matrix.php }}
path: /tmp/test-site/wp-content/debug.log
if-no-files-found: ignore
retention-days: 7
Loading
Loading