forked from orangehrm/orangehrm
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (148 loc) · 5.77 KB
/
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
name: Test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-20.04
services:
mysql:
image: mariadb:10.3
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/
steps:
- uses: actions/checkout@v3
- name: Validate composer.json and composer.lock
run: |
cd src
composer validate --strict
- name: Parse Git short hash
run: echo "git_short_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: Install dependencies
run: |
php7.4 -f /usr/bin/composer install -d src
php7.4 -f /usr/bin/composer install -d devTools/core
cd src/client
yarn install
- name: Install OrangeHRM
run: |
php7.4 installer/cli_install.php
mysqldump -V
php7.4 devTools/core/console.php i:create-test-db -p root --dump-options="--column-statistics=0"
- name: Configure LDAP server
if: "${{ github.event_name == 'push' }}"
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:latest
cat server-config.tpl.yaml > server-config.yaml
- name: Run Jest
run: |
cd src/client
yarn test:unit --coverage
- name: Run test
run: |
XDEBUG_MODE=coverage ./src/vendor/bin/phpunit --coverage-html coverage -d memory_limit=1G
tar cf - coverage/ | xz -z - > coverage.tar.xz
- name: Upload jest coverage
uses: actions/upload-artifact@v3
with:
name: jest-coverage
path: src/client/coverage
- name: Upload phpunit coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.tar.xz
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: logs
path: src/log
- name: Stop LDAP container
if: "${{ github.event_name == 'push' && always() }}"
run: docker stop openldap
composer_check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Validate composer.json and composer.lock
run: |
cd src
php8.0 -f /usr/bin/composer validate --strict
php8.1 -f /usr/bin/composer validate --strict
- name: Install depandancies on PHP 8.0
run: |
cd src
rm -rf vendor
php8.0 -f /usr/bin/composer install
php8.0 -f /usr/bin/composer dump-autoload -o
- name: Install depandancies on PHP 8.1
run: |
cd src
rm -rf vendor
php8.1 -f /usr/bin/composer install
php8.1 -f /usr/bin/composer dump-autoload -o
installation:
if: github.event_name == 'push'
runs-on: ubuntu-20.04
services:
mysql:
image: mariadb:10.7
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- 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 with empty database password
run: |
sed -i 's/useSameDbUserForOrangeHRM: y/useSameDbUserForOrangeHRM: n/g' installer/cli_install_config.yaml
sed -i 's/orangehrmDatabaseUser: ~/orangehrmDatabaseUser: orangehrm_1/g' installer/cli_install_config.yaml
php7.4 installer/cli_install.php
- name: Install OrangeHRM with database user
run: |
php devTools/core/console.php i:reset
git checkout installer/cli_install_config.yaml
sed -i 's/useSameDbUserForOrangeHRM: y/useSameDbUserForOrangeHRM: n/g' installer/cli_install_config.yaml
sed -i 's/orangehrmDatabaseUser: ~/orangehrmDatabaseUser: orangehrm_2/g' installer/cli_install_config.yaml
sed -i 's/orangehrmDatabasePassword: ~/orangehrmDatabasePassword: 0rang3h!m/g' installer/cli_install_config.yaml
sed -i 's/databaseName: orangehrm_mysql/databaseName: db/g' installer/cli_install_config.yaml
php7.4 installer/cli_install.php
- name: Install OrangeHRM with existing database
run: |
php devTools/core/console.php i:reset
git checkout installer/cli_install_config.yaml
sed -i 's/isExistingDatabase: n/isExistingDatabase: y/g' installer/cli_install_config.yaml
sed -i 's/privilegedDatabaseUser: root/privilegedDatabaseUser: orangehrm_2/g' installer/cli_install_config.yaml
sed -i 's/privilegedDatabasePassword: root/privilegedDatabasePassword: 0rang3h!m/g' installer/cli_install_config.yaml
sed -i 's/databaseName: orangehrm_mysql/databaseName: db/g' installer/cli_install_config.yaml
mysql -u root -proot -h 127.0.0.1 -e "CREATE DATABASE db;"
php7.4 installer/cli_install.php
- name: Check dev tool reinstall command
run: |
php devTools/core/console.php i:reinstall