-
Notifications
You must be signed in to change notification settings - Fork 2
214 lines (179 loc) · 8.13 KB
/
tests.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Tests
on:
push:
jobs:
# eventually we may want to skip the build process and just take a distributable file
# and copy over the tests/cypress folder from the EE source repo
build-for-testing:
name: Build EE for testing
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: 'cloud_files'
- name: Checkout ExpressionEngine
uses: actions/checkout@v3
with:
repository: ExpressionEngine/ExpressionEngine
ref: '7.x'
path: 'ee'
- name: Cache repository info
uses: actions/cache@v3
with:
path: ee/.git
key: cache-ee-git-${{ github.sha }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: dom, curl, sqlite, libxml, mbstring, zip, pcntl, pdo, mysql, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
ini-values: error_log=/home/runner/php_errors.log, memory_limit=128M
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '10'
- name: Install build tool dependencies
working-directory: ee/build-tools
run: npm install
- name: Get version
id: build_json
working-directory: ee/build-tools
run: |
content=`node -pe 'JSON.parse(process.argv[1]).tag' "$(cat build.json)"`
echo "::set-output name=BUILD_VERSION::$content"
- name: Run build process
working-directory: ee/build-tools
env:
RELEASE_KEY: ${{ secrets.RELEASE_KEY }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
APP_REPO_PATH: ${{ github.workspace }}/ee
run: gulp build-app --local --nogit --head --skip-lint --skip-pro --skip-redactorx --version=${{ steps.build_json.outputs.BUILD_VERSION }}
- name: Rename build directory
working-directory: ee/build-tools/builds
run: |
mv ExpressionEngine${{ steps.build_json.outputs.BUILD_VERSION }} ExpressionEngine
- name: Copy Addon files
run: |
cp -R cloud_files ee/build-tools/builds/ExpressionEngine/system/user/addons/
- name: Copy Addon test files
run: cp -R cloud_files/tests/cypress/cypress/integration/. ee/build-tools/builds/ExpressionEngine/tests/cypress/cypress/integration/
- name: Directory Listing
run: |
ls -la ee/build-tools/builds/ExpressionEngine/system/user/addons
ls -la ee/build-tools/builds/ExpressionEngine/tests/cypress/cypress/integration
- name: Cache built EE version
uses: actions/cache@v3
with:
path: ee/build-tools/builds/ExpressionEngine
key: cache-ee-build-${{ github.sha }}
- name: Directory Listing on Failure
if: failure()
run: |
ls -latr ee/build-tools/builds
ls -latr ee/build-tools/builds/ExpressionEngine
cypress:
needs: [build-for-testing]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: [7.4, 8.0, 8.1, 8.2]
os: [ubuntu-latest]
name: Cypress Tests, PHP${{ matrix.php }} - ${{ matrix.os }}
steps:
- name: Use cached EE build
uses: actions/cache@v3
with:
path: ee/build-tools/builds/ExpressionEngine
key: cache-ee-build-${{ github.sha }}
- name: Move files to webroot
run: |
ls -lar ee/build-tools/builds/ExpressionEngine/
cp -R ee/build-tools/builds/ExpressionEngine/. ./
- name: Restore cached git history
uses: actions/cache@v3
with:
path: ee/.git
key: cache-ee-git-${{ github.sha }}
- name: Directory Listing
run: |
ls -lar ./
ls -lar ./tests/cypress/cypress/integration
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, sqlite, libxml, mbstring, zip, pcntl, pdo, mysql, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
ini-values: error_log=/home/runner/php_errors.log, memory_limit=128M
- name: Copy config.php
run: |
rm -f system/user/config/config.php
cp -f tests/cypress/support/config/config.php system/user/config/config.php
- name: Copy .env.php
run: |
rm -f .env.php
cp -f tests/cypress/support/config/.env.php .env.php
- name: Remove installer
run: |
mv system/ee/installer system/ee/_installer
- name: Setup Permissions
run: |
sudo chmod 666 system/user/config/config.php
sudo chmod 777 system/user/config
sudo chmod -R 777 system/user/cache
sudo chmod -R 777 system/user/templates
sudo chmod -R 777 system/user/language
sudo chmod -R 777 tests/cypress/support/tmp
sudo chmod -R 777 tests/cypress/support/file-sync/uploads
sudo chmod -R 777 images
sudo chmod -R 777 themes/user
sudo chmod -R 777 tests/cypress/cypress/screenshots
- name: Configure MySQL
run: |
sudo systemctl start mysql
mysql -u root -proot -e 'CREATE DATABASE `ee-test`;'
mysql -u root -proot -e 'SET GLOBAL sql_mode="ONLY_FULL_GROUP_BY,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION";'
- name: Install Testing PHP dependencies
working-directory: tests/cypress
run: composer install
- name: Start PHP Server
run: php tests/serve.php &
- name: Run Cypress Tests
uses: cypress-io/github-action@v3
with:
spec: cypress/integration/addon_cloud_files/**
browser: chrome
headless: true
working-directory: tests/cypress
config-file: cypress.json
env:
CYPRESS_AWS_S3_KEY: ${{secrets.AWS_S3_KEY}}
CYPRESS_AWS_S3_SECRET: ${{secrets.AWS_S3_SECRET}}
CYPRESS_AWS_S3_REGION: ${{secrets.AWS_S3_REGION}}
CYPRESS_AWS_S3_BUCKET: ${{secrets.AWS_S3_BUCKET}}
CYPRESS_DO_SPACES_KEY: ${{secrets.DO_SPACES_KEY}}
CYPRESS_DO_SPACES_SECRET: ${{secrets.DO_SPACES_SECRET}}
CYPRESS_DO_SPACES_REGION: ${{secrets.DO_SPACES_REGION}}
CYPRESS_DO_SPACES_SPACE: ${{secrets.DO_SPACES_SPACE}}
CYPRESS_CF_R2_ACCOUNT_ID: ${{secrets.CF_R2_ACCOUNT_ID}}
CYPRESS_CF_R2_KEY: ${{secrets.CF_R2_KEY}}
CYPRESS_CF_R2_SECRET: ${{secrets.CF_R2_SECRET}}
CYPRESS_CF_R2_BUCKET: ${{secrets.CF_R2_BUCKET}}
CYPRESS_CF_R2_URL: ${{secrets.CF_R2_URL}}
CYPRESS_CF_TEST_FOLDER: ${{ matrix.php }}_${{ github.sha }}
CYPRESS_KEEP_DEBUG: ${{vars.KEEP_DEBUG != 'false'}}
- name: Archive screenshots
uses: actions/upload-artifact@v2
if: vars.KEEP_DEBUG != 'false' && failure()
with:
name: cypress-tests-PHP${{ matrix.php }}
path: tests/cypress/cypress/screenshots/
- name: Archive server errors
uses: actions/upload-artifact@v2
if: vars.KEEP_DEBUG != 'false' && failure()
with:
name: error.PHP${{ matrix.php }}.log
path: /home/runner/php_errors.log