-
Notifications
You must be signed in to change notification settings - Fork 1.7k
142 lines (114 loc) · 4.71 KB
/
php-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
name: PHP Codeception Tests
on:
push:
branches:
- master
- develop
- next
- statable
paths-ignore:
- '*.md'
pull_request:
branches:
- master
- develop
- next
- statable
paths-ignore:
- '*.md'
permissions:
contents: read
jobs:
tests:
name: PHP ${{ matrix.php-version }}-mysql-${{ matrix.mysql-version }}
env:
extensions: curl, intl, pdo, pdo_mysql, zip, exif, fileinfo, mbstring, gd, ldap
key: cache-v2
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
mysql-version:
- "5.7"
services:
mysql:
image: mysql:${{ matrix.mysql-version }}
env:
MYSQL_DATABASE: humhub_test
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Start Selenium
run: |
docker run --detach --net=host --shm-size="2g" selenium/standalone-chrome
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
# - name: Setup cache environment
# id: cache-env
# uses: shivammathur/cache-extensions@v1
# with:
# php-version: ${{ matrix.php-version }}
# extensions: ${{ env.extensions }}
# key: ${{ env.key }}
# - name: Cache extensions
# uses: actions/cache@v3
# with:
# path: ${{ steps.cache-env.outputs.dir }}
# key: ${{ steps.cache-env.outputs.key }}
# restore-keys: ${{ steps.cache-env.outputs.key }}
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
- name: Determine composer cache directory
if: matrix.os == 'ubuntu-latest'
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
# - name: Verify MySQL connection from host
# run: |
# sudo apt-get update && sudo apt-get install -y mysql-client-8.0 mysql-common
# mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot -e "SHOW DATABASES"
- name: Install npm dependencies
run: npm install
- name: Build production assets
run: grunt build-assets
- name: Run migrations
run: php protected/humhub/tests/codeception/bin/yii migrate/up --includeModuleMigrations=1 --interactive=0
- name: Run installer
run: php protected/humhub/tests/codeception/bin/yii installer/auto
- name: Rebuild search index
run: php protected/humhub/tests/codeception/bin/yii search/rebuild
- name: Run test server
run: php --server 127.0.0.1:8080 index-test.php &>/tmp/phpserver.log &
# - name: Setup chromedriver
# run: chromedriver --url-base=/wd/hub &
- name: Valdiate test server
run: sleep 5 && curl --fail --head http://127.0.0.1:8080/index-test.php
- name: Run test suite
run: grunt test -build -env=github
- name: Upload Codeception Output
if: failure()
uses: actions/upload-artifact@v3
with:
name: codeception-output
path: protected/humhub/tests/codeception/_output/*