-
Notifications
You must be signed in to change notification settings - Fork 32
100 lines (83 loc) · 3.34 KB
/
integration-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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Integration Tests
on:
# Run on all pushes and on all pull requests.
# Prevent the "push" build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
pull_request:
workflow_call:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04
env:
WP_VERSION: ${{ matrix.wp }}
strategy:
# Note: Different PHP versions use different PHPUnit versions.
# Keys:
# - coverage: Whether to run the tests with code coverage.
# - experimental: Whether the build is "allowed to fail".
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.3']
wp: ['latest']
coverage: [none]
experimental: [false]
include:
- php: '8.2'
coverage: pcov # Warning: PCOV might not work for PHP 8.4 or newer according to https://thephp.cc/articles/pcov-or-xdebug.
extensions: pcov
ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
experimental: false
- php: '8.4'
wp: 'trunk'
coverage: none
experimental: true
fail-fast: false
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: ${{ matrix.ini-values }}
coverage: ${{ matrix.coverage }}
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Composer dependencies
if: ${{ matrix.php < 8.2 }}
uses: ramsey/composer-install@v3
- name: Install Composer dependencies for PHP >= 8.2
if: ${{ matrix.php >= 8.2 }}
uses: ramsey/composer-install@v3
with:
composer-options: --ignore-platform-reqs
- name: Start MySQL Service
run: sudo systemctl start mysql.service
- name: Setting mysql_native_password for PHP <= 7.3
if: ${{ matrix.php <= 7.3 }}
run: mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
- name: Prepare environment for integration tests
run: composer prepare-ci --no-interaction
- name: Run integration tests
if: ${{ !matrix.experimental && matrix.coverage == 'none' }}
run: composer testwp --no-interaction
- name: Run integration tests (multisite)
if: ${{ !matrix.experimental && matrix.coverage == 'none' }}
run: composer testwp-ms --no-interaction
- name: Run integration tests (experimental)
if: ${{ matrix.experimental }}
run: composer testwp-experimental --no-interaction
- name: Run integration tests (multisite with code coverage)
if: ${{ matrix.coverage == 'pcov' }}
run: composer coveragewp-ci --no-interaction