-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (52 loc) · 1.79 KB
/
phpunit.yml
File metadata and controls
56 lines (52 loc) · 1.79 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
on:
push:
branches:
- main
name: PHPUnit
jobs:
build-test:
runs-on: ubuntu-20.04
env:
WP_MULTISITE: ${{ matrix.multisite }}
strategy:
matrix:
include:
- php: 7.4
wordpress: trunk
multisite: 0
- php: 8.0
wordpress: trunk
multisite: 0
name: PHP ${{ matrix.php }} tests in WP ${{ matrix.wordpress }}
steps:
- uses: actions/checkout@v3.5.0
# get the PHP version
- uses: shivammathur/setup-php@2.24.0
with:
php-version: ${{ matrix.php }}
tools: phpunit-polyfills
- name: Installing WordPress
run: |
export WP_DEVELOP_DIR=/tmp/wordpress/
git clone --depth=1 --branch="${{ matrix.wordpress }}" git://develop.git.wordpress.org/ /tmp/wordpress
cd ..
cp -r "${GITHUB_REPOSITORY#*/}" "/tmp/wordpress/src/wp-content/plugins/cool-kids-network"
cd /tmp/wordpress/
pwd
cp wp-tests-config-sample.php wp-tests-config.php
sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
sed -i "s/yourusernamehere/root/" wp-tests-config.php
sed -i "s/yourpasswordhere/root/" wp-tests-config.php
- name: Creating database
run: |
sudo /etc/init.d/mysql start
mysql -u root -proot -e "CREATE DATABASE wordpress_tests;"
- name: PhpUnit tests
run: |
cd "/tmp/wordpress/src/wp-content/plugins/cool-kids-network"
composer install && composer dumpautoload -o
phpunit --coverage-clover=coverage.xml
- name: Send code coverage report to Codecov.io
uses: codecov/codecov-action@v2
with:
files: /tmp/wordpress/src/wp-content/plugins/cool-kids-network/coverage.xml