-
Notifications
You must be signed in to change notification settings - Fork 101
85 lines (73 loc) · 2.56 KB
/
phpunit.yml
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
name: PHPUnit
on:
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
continue-on-error: ${{ matrix.can_fail }}
strategy:
fail-fast: true
matrix:
php: [8.2, 7.4]
wp_version: ["latest"]
can_fail: [false]
multisite: [0,1]
name: WordPress ${{ matrix.wp_version }} @ PHP ${{ matrix.php }} (WP_MULTISITE=${{ matrix.multisite }})
env:
CACHEDIR: /tmp/test-cache
WP_CORE_DIR: /tmp/wordpress/
WP_TESTS_DIR: /tmp/wordpress-tests-lib
WP_VERSION: ${{ matrix.wp_version }}
WP_MULTISITE: ${{ matrix.multisite }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Set up Composer caching
uses: actions/cache@v2
env:
cache-name: cache-composer-dependencies
with:
path: |
${{ steps.composer-cache.outputs.dir }}
/tmp/test-cache
/tmp/wordpress
key: ${{ runner.os }}-composer-${{ matrix.php }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
tools: composer:v2
coverage: none
- name: Install Composer dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer install
new_command_on_retry: composer install --ignore-platform-reqs
- name: Install WordPress and copy project
shell: bash
run: |
bash <(curl -s "https://raw.githubusercontent.com/wp-cli/sample-plugin/master/bin/install-wp-tests.sh") wordpress_test root '' 127.0.0.1 latest
rm -rf "${WP_CORE_DIR}wp-content/plugins"
mkdir -p "${WP_CORE_DIR}wp-content/plugins/wordpress-fieldmanager"
rsync -a --exclude=.git . "${WP_CORE_DIR}wp-content/plugins/wordpress-fieldmanager"
- name: Run tests
shell: bash
run: |
cd ${WP_CORE_DIR}wp-content/plugins/wordpress-fieldmanager
composer run phpunit