Skip to content

Commit

Permalink
Try test
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevalk committed Dec 10, 2023
1 parent fefa574 commit b7a122d
Show file tree
Hide file tree
Showing 8 changed files with 2,692 additions and 211 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@main
- name: Create Release
id: create_release
uses: actions/create-release@v1
uses: avakar/tag-and-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Test

on:
# Run on pushes to select branches and on all pull requests.
push:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
integration:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- php_version: '8.1'
wp_version: '6.2'
multisite: false

- php_version: '8.1'
wp_version: 'latest'
multisite: false

- php_version: '8.1'
wp_version: 'latest'
multisite: true

- php_version: '8.2'
wp_version: 'latest'
multisite: true

name: "Integration Test: PHP ${{ matrix.php_version }} | WP ${{ matrix.wp_version }}${{ matrix.multisite == true && ' (+ ms)' || '' }}"

# Allow builds to fail on as-of-yet unreleased WordPress versions.
continue-on-error: ${{ matrix.wp_version == 'trunk' }}

services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: none

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: "Composer: remove the PHP platform requirement"
run: composer config --unset platform.php

- name: "Install Composer dependencies"
uses: ramsey/composer-install@v2
with:
# Force a `composer update` run.
dependency-versions: "highest"
# But make it selective.
composer-options: "yoast/wp-test-utils --with-dependencies"
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")

- name: Install WP
shell: bash
run: tests/bin/install-wp-tests.sh wordpress_tests root '' 127.0.0.1:3306 ${{ matrix.wp_version }}

- name: Run unit tests - single site
run: composer test

- name: Run unit tests - multisite
if: ${{ matrix.multisite == true }}
run: composer test
env:
WP_MULTISITE: 1
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"require-dev": {
"wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/phpcompatibility-wp": "*",
"php-parallel-lint/php-parallel-lint": "^1.3"
"php-parallel-lint/php-parallel-lint": "^1.3",
"yoast/wp-test-utils": "^1.2",
"yoast/phpunit-polyfills": "^1.1"
},
"scripts": {
"check-cs": [
Expand All @@ -31,7 +33,10 @@
],
"lint-blueprint": [
"@php -r \"exit( intval( is_null( json_decode( file_get_contents( './.wordpress.org/blueprints/blueprint.json' ) ) ) ) );\""
]
],
"test": [
"@php ./vendor/phpunit/phpunit/phpunit"
]
},
"config": {
"allow-plugins": {
Expand Down
Loading

0 comments on commit b7a122d

Please sign in to comment.