forked from INTER-Mediator/INTER-Mediator
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (97 loc) · 4.11 KB
/
e2e-test-firefox.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
name: e2e-test-firefox
on:
push:
branches:
- "*"
pull_request:
branches: [ master ]
jobs:
run:
runs-on: ${{ matrix.operating-system }}
# continue-on-error: true
strategy:
matrix:
operating-system: [ubuntu-latest]
# operating-system: [ubuntu-latest, macos-latest, windows-latest]
php-versions: ['8.2']
name: End-to-End Test for Firefox on ${{ matrix.operating-system }} with PHP ${{ matrix.php-versions }}
services:
mysql: # https://qiita.com/sayama0402/items/e863ffb597ce87bf2e2f
image: mysql:5.7
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: EeLeBui7%Eesa4oto
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: EeLeBui7%Eesa4oto
POSTGRES_DB: test_db
# volumes:
# - /home/runner/work/INTER-Mediator/INTER-Mediator/dist-docs/sample_schema_pgsql.sql:/docker-entrypoint-initdb.d/sample_schema_pgsql.sql
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
# - name: Validate composer.json and composer.lock
# run: composer validate --strict
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: intl #optional
ini-values: "post_max_size=256M" #optional
- name: Print Env Varialbles
run: printenv
- name: PHP Module Checking
run: php -m
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Update dependencies
run: composer update
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Setup MySQL
run: |
mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto < ./dist-docs/sample_schema_mysql.sql
mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto -e "CREATE USER IF NOT EXISTS 'web'@'%' IDENTIFIED BY 'password';"
mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto -e "GRANT SELECT, INSERT, DELETE, UPDATE ON TABLE test_db.* TO 'web'@'%';"
mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto -e "GRANT SHOW VIEW ON TABLE test_db.* TO 'web'@'%';"
- name: Setup PostgreSQL
run: psql --quiet postgresql://postgres:EeLeBui7%[email protected]:5432/test_db < ./dist-docs/sample_schema_pgsql.sql
# - name: Check MySQL
# run: mysql -h 127.0.0.1 --port 3306 -u web --password=password -e "select * from person;" test_db
- name: Setup SQLite
run: |
touch sample.sq3
sqlite3 sample.sq3 < ./dist-docs/sample_schema_sqlite.sql
chmod 777 sample.sq3
# chown www-data sample.sq3
- name: Modify params.php file
run: |
echo "" >> params.php
echo "\$defaultTimezone = 'UCT';" >> params.php
echo "\$followingTimezones = true;" >> params.php
echo "" >> params.php
# E2E test with WebdriverIO
- name: Setup Firefox
uses: browser-actions/setup-firefox@v1
- name: Setup WebdriverIO
run: cd spec/run;npm update
- name: Boot the web server with php server mode
run: |
GHPORTNUM=`expr 9000 + \`echo -n ${{ matrix.php-versions }} | sed -e "s/\.//g"\``
mv "spec/run/wdio-firefox.conf.js" "spec/run/wdio-firefox.conf.js.bak"
cat "spec/run/wdio-firefox.conf.js.bak" | sed -e "s/9000/`echo -n ${GHPORTNUM}`/" > "spec/run/wdio-firefox.conf.js"
php -S "localhost:${GHPORTNUM}" &
- name: Starting End-to-End Tests with Firefox
run: cd spec/run;npx wdio wdio-firefox.conf.js