-
-
Notifications
You must be signed in to change notification settings - Fork 25
141 lines (120 loc) · 4.31 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#
# GitHub action executed when a PR is opened, asked for a review
# For debugging purposes, also when the assignment is modified.
#
# For now, runs only the UI tests.
#
# This action requires a secret called ARTIFACTS_PASS which is the key to upload on build-artifacts.
# This value can be found in the development keepass database.
#
name: Matomo for WordPress Tests
on: [push]
permissions:
actions: read
checks: none
contents: read
deployments: none
issues: read
packages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: none
concurrency:
group: php-${{ github.ref }}
cancel-in-progress: true
env:
MYSQL_DOCKER_IMG: 'bitnami/mariadb:latest'
DB_NAME: 'wp_matomo_tests'
PHP_VERSION: '8.0'
jobs:
unit_tests:
runs-on: 'ubuntu-20.04'
strategy:
fail-fast: false
matrix:
wp-versions: [ 'latest', 'trunk' ]
php-versions: [ '7.2', '7.3', '7.4', '8.0' ]
include:
- wp-versions: '5.2'
php-versions: '7.2'
permissions:
contents: read # <--- allows to read repo
steps:
- name: Checkout plugin project
uses: actions/checkout@v3
with:
persist-credentials: true
path: wp-content/plugins/matomo
- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- name: Start MariaDB service
shell: bash
run: |
docker run -d --name mariadb --tmpfs /var/lib/mariadb:rw --tmpfs /bitnami/mariadb/data:rw -v /bitnami/mariadb -p 3306:3306 -e ALLOW_EMPTY_PASSWORD=yes ${{ env.MYSQL_DOCKER_IMG }} > /dev/null
sleep 10
mysql -h127.0.0.1 -uroot -e "CREATE DATABASE ${{ env.DB_NAME }}";
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: curl, dom, exif, fileinfo, hash, imagick, json, mbstring, mysqli, openssl, pcre, sodium, xml, zip
ini-values: |
post_max_size=8M,
memory_limit=256M,
max_execution_time=30,
always_populate_raw_post_data=-1,
error_reporting=E_ALL,
log_errors=on,
display_errors=on,
allow_url_fopen=on,
zend.exception_ignore_args=Off
tools: composer:v2
coverage: none
- name: Check PHP Version
run: php -v
- name: Install dependencies
shell: bash
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && composer install
- name: Install test environment
shell: bash
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && ./bin/install-wp-tests.sh ${{ env.DB_NAME }} root '' 127.0.0.1 ${{ matrix.wp-versions }} true
- name: Run unit tests in non multisite context
shell: bash
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && ./vendor/bin/phpunit
- name: Run unit tests in multisite context
shell: bash
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && WP_MULTISITE=1 ./vendor/bin/phpunit
checkstyle:
runs-on: 'ubuntu-20.04'
steps:
- name: Checkout plugin project
uses: actions/checkout@v3
with:
persist-credentials: true
path: wp-content/plugins/matomo
- name: Setup PHP for checkstyle
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, exif, fileinfo, hash, imagick, json, mbstring, mysqli, openssl, pcre, sodium, xml, zip
ini-values: |
post_max_size=8M,
memory_limit=256M,
max_execution_time=30,
always_populate_raw_post_data=-1,
error_reporting=E_ALL,
log_errors=on,
display_errors=on,
allow_url_fopen=on,
zend.exception_ignore_args=Off
tools: composer:v2
coverage: none
- name: Check PHP Version
run: php -v
- name: Install dependencies
shell: bash
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && composer install
- name: Run checkstyle
shell: bash
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && ./vendor/bin/phpcs