Repository navigation
Tags: seo, aeo, geo, ai, audit #9
Workflow file for this run
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: Tests | |
| # The only definition of the suite. Runs on every pull request and by hand (Actions > Tests > Run workflow), and | |
| # deploy.yml calls it on a published release so a deploy cannot start until the same suite is green on the release | |
| # commit. No push trigger: a pull request is already tested against the merge result, and a release runs the suite again. | |
| on: | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: tests-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: PHP syntax ${{ matrix.php }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| strategy: | |
| matrix: | |
| php: ['7.4', '8.1', '8.3'] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| - run: find . -name '*.php' -not -path './node_modules/*' -not -path './vendor/*' -not -path './packages/*' -print0 | xargs -0 -n1 php -l | |
| # No coding-standards job: the repository has no PHPCS setup (no phpcs.xml, no composer phpcs script) yet. | |
| phpunit: | |
| name: PHPUnit (PHP ${{ matrix.php }}, WP ${{ matrix.wp }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # The floor declared in monoranks.php (Requires PHP 7.4, Requires at least 6.0). | |
| - { php: '7.4', wp: '6.0' } | |
| - { php: '7.4', wp: 'latest' } | |
| # Matches .wp-env.json. | |
| - { php: '8.2', wp: 'latest' } | |
| - { php: '8.4', wp: 'latest' } | |
| services: | |
| mariadb: | |
| image: mariadb:lts | |
| env: | |
| MARIADB_ROOT_PASSWORD: root | |
| MARIADB_DATABASE: wordpress_test | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd "healthcheck.sh --connect --innodb_initialized" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mysqli, mbstring, intl | |
| tools: composer:v2, wp-cli | |
| coverage: none | |
| - uses: ramsey/composer-install@v4 | |
| - name: Unit tests | |
| run: vendor/bin/phpunit | |
| - name: Install WordPress ${{ matrix.wp }} | |
| run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 "$WP_VERSION" | |
| env: | |
| WP_VERSION: ${{ matrix.wp }} | |
| # --fail-on-skipped: without a WordPress the integration tests skip themselves, which must not pass here. | |
| - name: Integration tests against WordPress ${{ matrix.wp }} | |
| run: vendor/bin/phpunit -c phpunit-integration.xml.dist --exclude-group tsf --fail-on-skipped | |
| env: | |
| MONORANKS_WP_PATH: /tmp/wordpress | |
| # The SEO Framework is installed but not activated; MONORANKS_WP_PLUGINS loads it for this run only. | |
| - name: Integration tests with The SEO Framework | |
| run: | | |
| for i in 1 2 3; do wp plugin install autodescription --path=/tmp/wordpress --allow-root && break; sleep 10; done | |
| vendor/bin/phpunit -c phpunit-integration.xml.dist --group tsf --fail-on-skipped | |
| env: | |
| MONORANKS_WP_PATH: /tmp/wordpress | |
| MONORANKS_WP_PLUGINS: autodescription/autodescription.php | |
| app: | |
| name: Admin app builds and matches the committed bundle | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run typecheck | |
| - run: npm run build | |
| - name: build/ is committed and up to date (run npm run build and commit it) | |
| run: git diff --exit-code --stat build | |
| plugin-check: | |
| name: WordPress.org plugin check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| tools: composer:v2 | |
| coverage: none | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Build the plugin folder exactly as it ships | |
| run: bash bin/build-zip.sh | |
| - uses: wordpress/plugin-check-action@v1 | |
| with: | |
| build-dir: dist/monoranks | |
| version: | |
| name: Version consistency | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - run: | | |
| H=$(grep -oE 'Version:\s+[0-9.]+' monoranks.php | awk '{print $2}') | |
| C=$(grep -oE "MONORANKS_CONNECTOR_VERSION', '[0-9.]+'" monoranks.php | grep -oE '[0-9.]+' | tail -1) | |
| R=$(grep -oE 'Stable tag: [0-9.]+' readme.txt | awk '{print $3}') | |
| echo "header $H constant $C readme $R" | |
| test "$H" = "$C" -a "$H" = "$R" | |
| grep -q "^## \[$H\]" CHANGELOG.md || { echo "CHANGELOG.md has no entry for $H"; exit 1; } | |
| grep -q "^= $H =" readme.txt || { echo "readme.txt changelog has no entry for $H"; exit 1; } | |
| browser: | |
| name: Chromium on WordPress | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| coverage: none | |
| - run: composer install --no-interaction --prefer-dist | |
| - run: composer install --no-dev --optimize-autoloader --classmap-authoritative --no-interaction | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - run: npm install --no-audit --no-fund | |
| - run: npx playwright install --with-deps chromium | |
| - name: Start WordPress with the plugin | |
| run: npx wp-env start | |
| - name: Pretty permalinks (the REST routes live under /wp-json/) | |
| run: npx wp-env run cli wp rewrite structure '/%postname%/' --hard | |
| - run: npx playwright test | |
| - uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: playwright | |
| path: test-results | |
| retention-days: 7 |