-
Notifications
You must be signed in to change notification settings - Fork 19
129 lines (109 loc) · 4.16 KB
/
Copy pathphpunit.yml
File metadata and controls
129 lines (109 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Test
on:
# Run on direct pushes to integration branches and on all pull requests.
push:
branches:
- develop
- main
- master
- trunk
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
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
strategy:
fail-fast: false
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
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Composer to use PAT
run: composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
# 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)-3)) days" "+%F")
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache WordPress test library
if: matrix.wp_version != 'latest'
uses: actions/cache@v4
with:
path: |
/tmp/wordpress-tests-lib
/tmp/wordpress
key: ${{ runner.os }}-wordpress-${{ matrix.wp_version }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-wordpress-${{ matrix.wp_version }}-
# Some images won't have svn available. Install it if that's the case.
- name: Install SVN
run: |
if ! command -v svn &> /dev/null; then
echo "Installing SVN..."
sudo apt-get update --allow-releaseinfo-change || { echo "Failed to update package lists"; exit 1; }
sudo apt-get install -y subversion || { echo "Failed to install SVN"; exit 1; }
else
echo "SVN is already installed"
fi
- 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