-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (67 loc) · 2.49 KB
/
unit-tests.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
name: Unit Tests
on:
push:
branches:
- main
pull_request:
jobs:
tests:
name: "WP: ${{ matrix.wp_version }} - PHP: ${{ matrix.php }} - (MU: ${{ matrix.multisite }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false # do not fail fast, let all the failing tests fail.
matrix:
php: [8.3]
es_version: [7.17.5]
multisite: [0, 1]
wp_version: ["latest"]
env:
WP_CORE_DIR: /tmp/wordpress/
WP_TESTS_DIR: /tmp/wordpress-tests-lib
WP_VERSION: ${{ matrix.wp_version }}
WP_MULTISITE: ${{ matrix.multisite }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Set up Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: ${{ matrix.es_version }}
security-enabled: false
- name: Check out code
uses: actions/checkout@v4
- 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: Set up WordPress and Plugin(s)
run: |
bash <(curl -s "https://raw.githubusercontent.com/alleyinteractive/mantle-ci/HEAD/install-wp-tests.sh") wordpress_unit_tests root '' 127.0.0.1 ${{ matrix.wp_version }} false true
rm -rf "${WP_CORE_DIR}wp-content/plugins"
mkdir -p "${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress"
rsync -a --exclude=.git . "${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress"
cd ${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress && composer install
- name: Run all tests
run: |
cd ${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress
composer phpunit