-
Notifications
You must be signed in to change notification settings - Fork 19
80 lines (69 loc) · 2.53 KB
/
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
76
77
78
79
80
name: Testing
on: pull_request
jobs:
tests:
name: "WP: ${{ matrix.wp_version }} - PHP: ${{ matrix.php }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
wp_version: ['latest']
mysql: ['8.0']
include:
- php: '7.4'
wp_version: '6.1'
env:
WP_VERSION: ${{ matrix.wp_version }}
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: Check out source code
uses: actions/checkout@v4
- name: Check Gitignored files
run: if [[ ! -z $(git ls-files -i --exclude-standard) ]]; then exit 1; fi
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, imagick, mysql, zip
coverage: none
tools: composer:v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Setup MySQL Server
id: setup-mysql
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql }}
auto-start: true
distribution: 'mysql'
root-password: root
user: wp_cli_test
password: password1
default_authentication_plugin=mysql_native_password
- name: Configure DB environment
run: |
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
echo "MYSQL_TCP_PORT=3306" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
echo "WP_CLI_TEST_DBHOST=127.0.0.1:3306" >> $GITHUB_ENV
- name: Prepare tests
env:
WP_VERSION: ${{ matrix.wp_version }}
WP_CLI_TEST_DBTYPE: 'mysql'
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
run: composer prepare-tests
- name: Run Behat
env:
WP_VERSION: ${{ matrix.wp_version }}
WP_CLI_TEST_DBTYPE: 'mysql'
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
run: composer behat || composer behat-rerun