-
Notifications
You must be signed in to change notification settings - Fork 78
233 lines (206 loc) · 7.6 KB
/
autobuild.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
name: Auto test, build and publish
on:
push:
pull_request:
jobs:
runtests:
name: Preside Test Suite
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[twgit] Init') && github.ref != 'refs/heads/stable'"
env:
DB_USER: root
DB_PASSWORD: root
strategy:
fail-fast: false
matrix:
include:
- cfengine: "[email protected]"
jdkVersion: "11"
experimental: false
- cfengine: "lucee@^6.1.1-SNAPSHOT"
jdkVersion: "21"
experimental: true
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Database and Fixtures
run: |
sudo systemctl start mysql.service
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE presidetestsuite;'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.jdkVersion }}
- name: Setup CommandBox CLI
uses: Ortus-Solutions/[email protected]
- name: Install dependencies
run: |
box install --force --verbose
- name: Setup .env For Runner
run: |
touch ${GITHUB_WORKSPACE}/tests/.env
printf "PRESIDETEST_DB_HOST=127.0.0.1\n" >> .env
printf "PRESIDETEST_DB_NAME=presidetestsuite\n" >> .env
printf "PRESIDETEST_DB_PORT=3306\n" >> .env
printf "PRESIDETEST_DB_USER=${{ env.DB_USER }}\n" >> .env
printf "PRESIDETEST_DB_PASSWORD=${{ env.DB_PASSWORD }}\n" >> .env
- name: Start ${{ matrix.cfengine }} Server
run: |
# Startup the Server
box server start directory="${GITHUB_WORKSPACE}/tests" serverConfigFile="${GITHUB_WORKSPACE}/tests/server.json" cfengine="${{ matrix.cfengine }}" --noSaveSettings --debug
# Test site build up
curl http://127.0.0.1:9999
- name: Run tests
run: |
cd tests/
mkdir -p results
exitcode=0
box testbox run --verbose outputFile=results/test-results outputFormats=json,antjunit
- name: Upload Test Results Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: preside-test-results-${{ matrix.cfengine }}-jdk${{ matrix.jdkVersion }}
path: |
tests/results/*
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: tests/results/*.xml
runcypresstests:
name: Run Cypress Test suites
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[twgit] Init') && github.ref != 'refs/heads/stable'"
env:
DB_USER: root
DB_PASSWORD: root
DB_NAME: endtoenddb
strategy:
fail-fast: false
matrix:
include:
- cfengine: "[email protected]"
jdkVersion: "11"
experimental: false
- cfengine: "lucee@^6.1.1-SNAPSHOT"
jdkVersion: "21"
experimental: true
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
uses: pixl8/github-action-box-install@v2
with:
verbose: true
force: true
- name: Build static assets with grunt
shell: bash
run: |
cd ./system/assets &&
npm install &&
grunt all &&
rm -rf node_modules
- name: Setup Database and Fixtures
run: |
sudo systemctl start mysql.service
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE ${{ env.DB_NAME }};'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.jdkVersion }}
- name: Setup CommandBox CLI
uses: Ortus-Solutions/[email protected]
- name: Start ${{ matrix.cfengine }} Server
run: |
cd tests/e2e/apps/fullcmsapp/
cp .cfconfig.gh.json .cfconfig.json
box install commandbox-cfconfig
box server start serverConfigFile="server.json" cfengine="${{ matrix.cfengine }}" --noSaveSettings
http_response=$(curl --max-time 120 -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9998)
if [ $http_response != "200" ]; then
exit 1
fi
- name: Run Cypress Test
uses: cypress-io/github-action@v6
with:
browser: chrome
working-directory: tests/e2e/tests
publish:
name: Publish to Forgebox
needs:
- runtests
- runcypresstests
runs-on: ubuntu-latest
if: "success() && github.event_name != 'pull_request' && ( startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release-' ) )"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
uses: pixl8/github-action-box-install@v2
with:
verbose: true
force: true
- name: Build static assets with grunt
shell: bash
run: |
cd ./system/assets &&
npm install &&
grunt all &&
rm -rf node_modules
- name: Generate release version number
id: versiongen
uses: pixl8/github-action-twgit-release-version-generator@v3
with:
build_number_start: 8000
- name: Set release variables
shell: bash
env:
RELEASE_VERSION: ${{ steps.versiongen.outputs.semver_release_string }}
IS_SNAPSHOT: ${{ steps.versiongen.outputs.semver_is_snapshot }}
run: |
ZIP_FILE_NAME=Preside-${RELEASE_VERSION/+/-}.zip
if [[ "${IS_SNAPSHOT}" == "false" ]] ; then
RELEASE_CATEGORY=stable
else
RELEASE_CATEGORY="bleeding-edge"
RELEASE_VERSION="${{ steps.versiongen.outputs.semver_release_number }}-snapshot"
fi
echo "RELEASE_CATEGORY=$RELEASE_CATEGORY" >> $GITHUB_ENV
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV
echo "DOWNLOAD_LOCATION=https://downloads.preside.org/$RELEASE_CATEGORY/$ZIP_FILE_NAME" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Prepare files for release
shell: bash
run: |
echo '{ "version":"$RELEASE_VERSION" }' > version.json &&
echo 'Built on: $( date )' > "Preside-$RELEASE_VERSION-$RELEASE_CATEGORY.txt" &&
mv box.json.published box.json
- name: Inject version numbers
uses: dominicwatson/github-action-envsubst@v1
with:
files: box.json version.json system/config/Config.cfc
- name: Zip up
shell: bash
run: zip -rq $ZIP_FILE_NAME * --exclude jmimemagic.log --exclude=".*" --exclude="*.sh" --exclude="zanata.xml" --exclude="\tests/*" --exclude="\system/externals/lucee-spreadsheet/javaloader/*"
- name: Push to S3
run: aws s3 cp --acl=public-read $ZIP_FILE_NAME s3://downloads.preside.org/${RELEASE_CATEGORY}/${ZIP_FILE_NAME}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'eu-west-2'
- name: Publish to forgebox
uses: pixl8/github-action-box-publish@v5
with:
forgebox_user: pixl8
forgebox_pass: ${{ secrets.FORGEBOX_PASS }}
ignore_timeouts: "true"