forked from orangehrm/orangehrm
-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (156 loc) · 5.13 KB
/
scheduled_test.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
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
name: Scheduled Test
on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/scheduled_test.yml'
schedule:
- cron: "0 2 * * *"
jobs:
db_test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
database:
- "mysql:5.5"
- "mysql:5.6"
- "mysql:5.7"
- "mysql:8.0"
- "mariadb:5.5"
- "mariadb:10.0"
- "mariadb:10.1"
- "mariadb:10.2"
- "mariadb:10.3"
- "mariadb:10.4"
- "mariadb:10.5"
- "mariadb:10.6"
- "mariadb:10.7"
- "mariadb:10.8"
- "mariadb:10.9"
- "mariadb:10.10"
- "mariadb:10.11"
services:
mysql:
image: ${{ matrix.database }}
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
--name="database"
--tmpfs /var/lib/mysql/
env:
WORKFLOW_BRANCH: ${{ secrets.WORKFLOW_BRANCH }}
steps:
- uses: actions/checkout@v3
if: "${{ github.event_name != 'push' && env.WORKFLOW_BRANCH != '' }}"
with:
ref: ${{ secrets.WORKFLOW_BRANCH }}
- uses: actions/checkout@v3
if: "${{ github.event_name == 'push' || env.WORKFLOW_BRANCH == ''}}"
- name: Source info
run: |
git log -1
git remote -v
- name: Install dependencies
run: |
php7.4 -f /usr/bin/composer install -d src
php7.4 -f /usr/bin/composer install -d devTools/core
- name: Install OrangeHRM
run: |
php7.4 installer/cli_install.php
- name: Create Test DB
run: |
mysqldump -V
php7.4 devTools/core/console.php i:create-test-db -p root --dump-options="--column-statistics=0"
- name: Config sql_mode
if: ${{ matrix.database == 'mysql:5.7' || matrix.database == 'mysql:8.0' }}
run: docker exec database bash -c "mysql -uroot -proot -e \"SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));\""
- name: Configure LDAP server
run: |
cd src/plugins/orangehrmLDAPAuthenticationPlugin/test/config
docker run --detach --rm --name openldap \
--network ${{ job.container.network }} \
-p 389:1389 \
-e LDAP_ADMIN_USERNAME=admin \
-e LDAP_ADMIN_PASSWORD=admin \
-e LDAP_ROOT=dc=example,dc=org \
-e LDAP_CONFIG_ADMIN_ENABLED=yes \
-e LDAP_CONFIG_ADMIN_USERNAME=admin \
-e LDAP_CONFIG_ADMIN_PASSWORD=admin \
-e LDAP_SKIP_DEFAULT_TREE=yes \
-v $PWD/ldifs:/ldifs \
bitnami/openldap:2.6.4
cat server-config.tpl.yaml > server-config.yaml
- name: Run test
run: |
./src/vendor/bin/phpunit
- name: Stop LDAP container
if: ${{ always() }}
run: docker stop openldap
php_test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php: ["php7.4", "php8.0", "php8.1", "php8.2"]
services:
mysql:
image: "mariadb:10.0"
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
--tmpfs /var/lib/mysql/
env:
WORKFLOW_BRANCH: ${{ secrets.WORKFLOW_BRANCH }}
steps:
- uses: actions/checkout@v3
if: "${{ github.event_name != 'push' && env.WORKFLOW_BRANCH != '' }}"
with:
ref: ${{ secrets.WORKFLOW_BRANCH }}
- uses: actions/checkout@v3
if: "${{ github.event_name == 'push' || env.WORKFLOW_BRANCH == ''}}"
- name: Install dependencies
run: |
php7.4 -f /usr/bin/composer install -d src
php7.4 -f /usr/bin/composer install -d devTools/core
- name: Install OrangeHRM
run: |
${{ matrix.php }} installer/cli_install.php
mysqldump -V
${{ matrix.php }} devTools/core/console.php i:create-test-db -p root --dump-options="--column-statistics=0"
- name: Configure LDAP server
run: |
cd src/plugins/orangehrmLDAPAuthenticationPlugin/test/config
docker run --detach --rm --name openldap \
--network ${{ job.container.network }} \
-p 389:1389 \
-e LDAP_ADMIN_USERNAME=admin \
-e LDAP_ADMIN_PASSWORD=admin \
-e LDAP_ROOT=dc=example,dc=org \
-e LDAP_CONFIG_ADMIN_ENABLED=yes \
-e LDAP_CONFIG_ADMIN_USERNAME=admin \
-e LDAP_CONFIG_ADMIN_PASSWORD=admin \
-e LDAP_SKIP_DEFAULT_TREE=yes \
-v $PWD/ldifs:/ldifs \
bitnami/openldap:2.6.4
cat server-config.tpl.yaml > server-config.yaml
- name: Run test
run: |
${{ matrix.php }} ./src/vendor/bin/phpunit
- name: Stop LDAP container
if: ${{ always() }}
run: docker stop openldap