forked from elementor/elementor
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (70 loc) · 2.59 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
name: PHPUnit
on: [push, pull_request]
jobs:
file-diff:
runs-on: ubuntu-20.04
name: File Diff
if: startsWith( github.repository, 'elementor/' )
outputs:
php_diff: ${{ steps.php_diff_files.outputs.diff }}
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Check PHP files diff
id: php_diff_files
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/*.php
composer.json
test:
runs-on: ubuntu-18.04 # It is ubuntu 18 because there are some issues with the mysql version and php 7.
needs: [ 'file-diff' ]
if: ${{ needs.file-diff.outputs.php_diff || github.ref == 'refs/heads/developer-edition' }}
strategy:
fail-fast: false
matrix:
wordpress_versions: ['latest', '5.8', '5.7']
php_versions: ['7.0', '7.1', '7.2', '7.3', '7.4']
name: PHPUnit - WordPress ${{ matrix.wordpress_versions }} - PHP version ${{ matrix.php_versions }}
env:
WP_TESTS_DIR: /tmp/wordpress-tests-lib
steps:
- name: Startup MySQL service
run: sudo /etc/init.d/mysql start
- name: Checkout source code
uses: actions/checkout@master
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
- name: Install Dependencies
run: |
bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress_versions }}
- name: Run Tests with Coverage (latest PHP & WP)
if: ${{ matrix.php_versions >= 7.4 && matrix.wordpress_versions == 'latest' }}
run: |
composer update --no-interaction
composer run coverage
- name: Run Tests without Coverage
if: ${{ ! ( matrix.php_versions >= 7.4 && matrix.wordpress_versions == 'latest' ) }}
run: | # remove unsupported packages PHP < 7.4
composer remove --dev thor-juhasz/phpunit-coverage-check --ignore-platform-reqs
composer update --no-interaction
composer run test
- name: Run Test - Multisite
run: |
WP_MULTISITE=1
composer update --no-interaction
composer run test
test-result:
needs: test
if: ${{ always() }} # Will be run even if 'test' matrix will be skipped
runs-on: ubuntu-20.04
name: PHPUnit - Test Results
steps:
- name: Test status
run: echo "Test status is - ${{ needs.test.result }}"
- name: Check test matrix status
if: ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}
run: exit 1