-
Notifications
You must be signed in to change notification settings - Fork 1
183 lines (170 loc) · 5.94 KB
/
unit-tests.yaml
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: unit tests
on:
workflow_call:
jobs:
module-test:
runs-on: ubuntu-latest
container:
image: "ghcr.io/it-at-m/eappointment-php-base:${{ matrix.php_version }}-dev"
steps:
- name: Checkout GitHub Action
uses: actions/checkout@main
- name: Install Composer Dependencies
run: |
cd "${{ matrix.module }}"
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Unit Tests
run: |
cd "${{ matrix.module }}"
./vendor/bin/phpunit
strategy:
fail-fast: false
matrix:
include:
- module: zmsadmin
php_version: "8.0"
- module: zmscalldisplay
php_version: "8.0"
- module: zmscitizenapi
php_version: "8.0"
- module: zmsdldb
php_version: "8.0"
- module: zmsentities
php_version: "8.0"
- module: zmsmessaging
php_version: "8.0"
- module: zmsslim
php_version: "8.0"
- module: zmsstatistic
php_version: "8.0"
- module: zmsticketprinter
php_version: "8.0"
zmsapi-test:
runs-on: ubuntu-latest
container:
image: "ghcr.io/it-at-m/eappointment-php-base:8.0-dev"
services:
mariadb:
image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: zmsapi
MYSQL_DATABASE: zmsbo
MYSQL_CHARACTER_SET: utf8mb4
MYSQL_COLLATION: utf8mb4_unicode_ci
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 10s
--health-retries 5
steps:
- name: Checkout GitHub Action
uses: actions/checkout@main
- name: Install python3
run: |
apt update
apt install -y python3 python3-click python3-git
- name: Referencing local Modules and Libraries
run: python3 ./cli modules reference-libraries --no-symlink
- name: Install Composer Dependencies
run: |
modules=('zmsapi' 'zmsdb')
for module in "${modules[@]}"; do
echo "Installing Composer dependencies for $module"
(cd "$module" && composer install --no-progress --prefer-dist --optimize-autoloader)
done
shell: bash
- name: Import Test Data and Run Unit Tests
env:
MYSQL_PORT: "tcp://mariadb:3306"
MYSQL_DATABASE: zmsbo
MYSQL_ROOT_PASSWORD: zmsapi
run: |
cd zmsapi
echo "Setup fixtures..."
rm -rf data
ln -s vendor/eappointment/zmsdb/tests/Zmsdb/fixtures data
echo "Importing test data..."
vendor/bin/importTestData --commit
php -dzend_extension=xdebug.so -dmemory_limit=-1 vendor/bin/phpunit \
-v --colors=never --coverage-text --coverage-html public/_tests/coverage/ --log-junit \
public/_tests/junit.xml
zmsdb-test:
runs-on: ubuntu-latest
container:
image: "ghcr.io/it-at-m/eappointment-php-base:8.0-dev"
services:
mariadb:
image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: zmsdb
MYSQL_DATABASE: zmsbo
MYSQL_CHARACTER_SET: utf8mb4
MYSQL_COLLATION: utf8mb4_unicode_ci
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 10s
--health-retries 5
steps:
- name: Checkout GitHub Action
uses: actions/checkout@main
- name: Install python3
run: |
apt update
apt install -y python3 python3-click python3-git
- name: Referencing local Modules and Libraries
run: python3 ./cli modules reference-libraries --no-symlink
- name: Install Composer Dependencies
run: |
modules=('zmsdb')
for module in "${modules[@]}"; do
echo "Installing Composer dependencies for $module"
(cd "$module" && composer install --no-progress --prefer-dist --optimize-autoloader)
done
shell: bash
- name: Import Test Data and Run Unit Tests
env:
MYSQL_PORT: "tcp://mariadb:3306"
MYSQL_DATABASE: zmsbo
MYSQL_ROOT_PASSWORD: zmsdb
run: |
cd zmsdb
bin/importTestData --commit
php -dzend_extension=xdebug.so -dmemory_limit=-1 vendor/bin/phpunit \
-v --colors=never --coverage-text --coverage-html public/_tests/coverage/ --log-junit \
public/_tests/junit.xml
zmsclient-test:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Action
uses: actions/checkout@main
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.0"
extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql
coverage: xdebug
- name: Install Composer Dependencies
run: |
modules=('zmsclient')
for module in "${modules[@]}"; do
echo "Installing Composer dependencies for $module"
(cd "$module" && composer install --no-progress --prefer-dist --optimize-autoloader)
done
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Run Unit Tests
run: |
/bin/bash -c "cd ./zmsclient && docker-compose up -d && docker-compose exec -T test ./vendor/bin/phpunit"