-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (120 loc) · 4.28 KB
/
main.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
name: integration-test
on:
push:
branches:
- '**'
pull_request:
branches:
- main
schedule:
- cron: '0 1 1 * *'
jobs:
full_ci:
name: ${{matrix.pkp-application}}(BRANCH=${{matrix.pkp-branch}} ;PHP=${{matrix.php-versions}}; DB=${{matrix.dbs}})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['8.1','8.2']
dbs: ['pgsql', 'mysql']
pkp-application: ['ojs']
pkp-branch: ['${{ github.head_ref || github.ref_name }}']
services:
mysql:
image: bitnami/mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: ojs-ci
MYSQL_PASSWORD: ojs-ci
MYSQL_DATABASE: ojs-ci
MYSQL_AUTHENTICATION_PLUGIN: caching_sha2_password
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
postgres:
image: postgres:latest
env:
POSTGRES_USER: ojs-ci
POSTGRES_PASSWORD: ojs-ci
POSTGRES_DB: ojs-ci
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=5
env:
CYPRESS_BASE_URL: http://127.0.0.1:8000
CYPRESS_DBTYPE: ${{matrix.dbs == 'pgsql' && 'PostgreSQL' || 'MySQLi'}}
CYPRESS_DBNAME: ojs-ci
CYPRESS_DBUSERNAME: ojs-ci
CYPRESS_DBPASSWORD: ojs-ci
CYPRESS_DBHOST: 127.0.0.1
CYPRESS_FILESDIR: files
DBTYPE: ${{matrix.dbs == 'pgsql' && 'PostgreSQL' || 'MySQLi'}}
DBUSERNAME: ojs-ci
DBPASSWORD: ojs-ci
DBNAME: ojs-ci
DBHOST: 127.0.0.1
FILESDIR: files
steps:
- name: Setup PHP, extensions and composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{matrix.php-versions}}
extensions: bcmath, bz2, common, cli, curl, fpm, gd, intl, mbstring, mysql,mysqlnd, mysqli, opcache, pdo_mysql, pgsql, json,soap, xml, zip
env:
update: true
- name: Install PKP Application
run: |
git clone -b ${{matrix.pkp-branch}} https://github.com/${{github.repository}} ~/${{matrix.pkp-application}}
cd ~/${{matrix.pkp-application}}
git submodule update --init --recursive
- name: Prepare Tests
run: |
cd ~/${{matrix.pkp-application}}
cp config.TEMPLATE.inc.php config.inc.php
sed -i -e "s/enable_cdn = On/enable_cdn = Off/" config.inc.php
mkdir --parents files
- name: Collect Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v1
- name: Install Composer Dependencies
run: |
cd ~/${{matrix.pkp-application}}
lib/pkp/tools/travis/install-composer-dependencies.sh
npm i g -npm && npm i @vue/cli-service && npm i cypress && npm install && npm run build
- name: Run Server
run: |
cd ~/${{matrix.pkp-application}}
php -S 127.0.0.1:8000 -t . >& access.log &
- name: Cypress application setup (${{matrix.dbs}})
run: |
cd ~/${{matrix.pkp-application}}
npx cypress run --spec "cypress/tests/data/10-ApplicationSetup"
- name: Cypress content setup (${{matrix.dbs}})
run: |
cd ~/${{matrix.pkp-application}}
npx cypress run --spec "cypress/tests/data/60-content"
- name: Grab a ready dataset
run: |
cd ~/${{matrix.pkp-application}}
git clone -b main https://github.com/pkp/datasets ~/datasets
- name: Cypress integration tests (${{matrix.dbs}})
run: |
cd ~/${{matrix.pkp-application}}
npx cypress run --spec "lib/pkp/cypress/tests/integration"
- name: Prepare tests
run: |
cd ~/${{matrix.pkp-application}}
./lib/pkp/tools/travis/prepare-tests.sh
- name: Set extra variables
run: |
cd ~/${{matrix.pkp-application}}
export DBTYPE_SYMBOLIC=${TEST}
export APP=${APPLICATION}
- name: Run unit tests
run: |
cd ~/${{matrix.pkp-application}}
./lib/pkp/tools/runAllTests.sh -CcPpdR
- name: Show failures log
if: ${{ failure() }}
run: |
cd ~/${{ matrix.pkp-application }}
cat access.log