-
-
Notifications
You must be signed in to change notification settings - Fork 183
240 lines (229 loc) · 8.59 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
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
234
235
236
237
238
239
240
name: Build 6.0
on:
workflow_call:
inputs:
LUCEE_TEST_JAVA_VERSION:
required: true
type: string
LUCEE_BUILD_JAVA_VERSION:
required: true
type: string
default: '8'
push:
branches:
- '**' # thus ignoring tagging
pull_request:
workflow_dispatch:
#concurrency:
# group: ${{ github.head_ref }}
# cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
DO_DEPLOY: "${{ github.event_name == 'push' && github.ref == 'refs/heads/6.0' }}"
LUCEE_BUILD_JAVA_VERSION: 8
LUCEE_TEST_JAVA_VERSION: ''
services:
ldap:
# image: kwart/ldap-server
image: rroemhild/test-openldap
ports:
- 10389:10389
- 10636:10636
sql-server:
# Docker Hub image
image: mcr.microsoft.com/mssql/server:2019-latest
env:
MSSQL_PID: Express
ACCEPT_EULA: Y
SA_PASSWORD: Lucee!1433 # password must be complex or the service won't start
ports:
- 1433:1433
options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
greenmail:
image: greenmail/standalone:1.6.9
ports:
- 3025:3025 #SMTP
- 3110:3110 #POP3
- 3143:3143 #IMAP
- 3465:3465 #SMTPS
- 3993:3993 #IMAPS
- 3995:3995 #POP3S
- 8080:8080 #API
steps:
# when workflow is run via a workflow_call, these vars are found under input, which doesn't exist otherwise
# so lets copy them over to the normal env vars
- name: Configure Build Java Version
if: ${{ inputs.LUCEE_BUILD_JAVA_VERSION != '' }}
run: echo "LUCEE_BUILD_JAVA_VERSION=${{ inputs.LUCEE_BUILD_JAVA_VERSION }}" >> $GITHUB_ENV
- name: Configure Test Java Version
if: ${{ inputs.LUCEE_TEST_JAVA_VERSION != '' }}
run: echo "LUCEE_TEST_JAVA_VERSION=${{ inputs.LUCEE_TEST_JAVA_VERSION }}" >> $GITHUB_ENV
- uses: szenius/[email protected]
with:
timezoneLinux: "UTC"
- uses: actions/[email protected]
- name: Set up Test Java Version ${{ env.LUCEE_TEST_JAVA_VERSION }}
uses: actions/setup-java@v3
if: ${{ env.LUCEE_TEST_JAVA_VERSION != '' }}
with:
java-version: ${{ env.LUCEE_TEST_JAVA_VERSION }}
distribution: 'temurin'
- name: Stash Test Java Version Home
if: ${{ env.LUCEE_TEST_JAVA_VERSION != '' }}
run: echo "LUCEE_TEST_JAVA_EXEC=${{ env.JAVA_HOME }}/bin/java" >> $GITHUB_ENV
- name: Set up build JDK '${{ env.LUCEE_BUILD_JAVA_VERSION }}'
uses: actions/setup-java@v3
if: ${{ env.LUCEE_TEST_JAVA_VERSION != env.LUCEE_BUILD_JAVA_VERSION }}
with:
java-version: '${{ env.LUCEE_BUILD_JAVA_VERSION }}'
distribution: 'temurin'
- name: Disable DEPLOY if not building with Java 8 (Lucee default)
if: ${{ env.LUCEE_BUILD_JAVA_VERSION != '8' }}
run: echo "DO_DEPLOY=false" >> $GITHUB_ENV
- name: Cache Lucee extensions
uses: actions/cache@v3
with:
path: ~/work/Lucee/Lucee/cache/
key: lucee-extensions
restore-keys: lucee-extensions
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: |
~/.m2/repository/*
!~/.m2/repository/org/lucee/lucee/
key: ${{ runner.os }}-maven-${{ hashFiles('loader/pom.xml','core/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up MySQL (local)
run: |
sudo systemctl start mysql
mysql -e 'CREATE DATABASE lucee' -uroot -proot
mysql -e 'CREATE USER "lucee"@"localhost" IDENTIFIED WITH mysql_native_password BY "lucee";' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON lucee.* TO "lucee"@"localhost"' -uroot -proot
- name: Set up Postgres (local)
run: |
sudo /etc/init.d/postgresql start
sudo -u postgres psql -c 'create database lucee;'
sudo -u postgres psql -c "create user lucee with encrypted password 'lucee'";
sudo -u postgres psql -c 'grant all privileges on database lucee to lucee;'
- name: Start MongoDB (docker)
uses: supercharge/[email protected]
with:
mongodb-version: 4.4
mongodb-port: 27017
- name: Setup Memcached (docker)
uses: niden/actions-memcached@v7
- name: Build Lucee with Maven
env:
MYSQL_SERVER: localhost
MYSQL_USERNAME: lucee
MYSQL_PASSWORD: lucee
MYSQL_PORT: 3306
MYSQL_DATABASE: lucee
POSTGRES_SERVER: localhost
POSTGRES_USERNAME: lucee
POSTGRES_PASSWORD: lucee
POSTGRES_PORT: 5432
POSTGRES_DATABASE: lucee
MONGODB_SERVER: localhost
MONGODB_PORT: 27017
MONGODB_DB: lucee
MONGODB_DATABASE: lucee
MSSQL_SERVER: localhost
MSSQL_USERNAME: sa
MSSQL_PASSWORD: Lucee!1433
MSSQL_PORT: 1433
MSSQL_DATABASE: master
MEMCACHED_PORT: 11211
MEMCACHED_SERVER: localhost
REDIS_PORT: 6379
REDIS_SERVER: localhost
SMTP_PORT_INSECURE: 3025
SMTP_PORT_SECURE: 3465
SMTP_SERVER: localhost
SMTP_USERNAME: lucee
SMTP_PASSWORD: doesntmatter
IMAP_PORT_INSECURE: 3143
IMAP_PORT_SECURE: 3993
IMAP_SERVER: localhost
IMAP_USERNAME: lucee
IMAP_PASSWORD: doesntmatter
POP_PORT_INSECURE: 3110
POP_PORT_SECURE: 3995
POP_SERVER: localhost
POP_USERNAME: lucee
POP_PASSWORD: doesntmatter
LDAP_SERVER: localhost
LDAP_PORT: 10389
LDAP_BASE_DN: dc=planetexpress,dc=com
LDAP_USERNAME: cn=admin,dc=planetexpress,dc=com
LDAP_PASSWORD: GoodNewsEveryone
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_ID_TEST }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY_TEST }}
S3_BUCKET_PREFIX: lucee-ldev-6-
# DO_DEPLOY: ${{ github.event_name == 'push' }}
# for uploading successful builds
S3_ACCESS_ID_DOWNLOAD: ${{ secrets.S3_ACCESS_ID_DOWNLOAD }}
S3_SECRET_KEY_DOWNLOAD: ${{ secrets.S3_SECRET_KEY_DOWNLOAD }}
# used by travis-settings.xml
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
CI_DEPLOY_PASSPHRASE: ${{ secrets.CI_DEPLOY_PASSPHRASE }}
LUCEE_DOCKER_FILES_PAT_TOKEN: ${{ secrets.LUCEE_DOCKER_FILES_PAT_TOKEN }}
LUCEE_BUILD_FAIL_CONFIGURED_SERVICES_FATAL: true
#run: ant -noinput -buildfile loader/build.xml
run: |
if [ "${{ env.DO_DEPLOY }}" == "true" ]; then
echo "------- Maven Deploy on ${{ github.event_name }} -------";
mvn -B -e -f loader/pom.xml clean deploy --settings travis-settings.xml -DtestJavaVersionExec="${{ env.LUCEE_TEST_JAVA_EXEC }}";
else
echo "------- Maven Install on ${{ github.event_name }} ---------";
mvn -B -e -f loader/pom.xml clean install -DtestJavaVersionExec="${{ env.LUCEE_TEST_JAVA_EXEC }}"
fi
- name: clean github.ref_name
uses: mad9000/actions-find-and-replace-string@3
id: cleanrefname
if: always()
with:
source: ${{ github.ref_name }}
find: '/'
replace: '-'
- name: Upload Artifact (junit-test-results)
uses: actions/upload-artifact@v3
if: always()
with:
name: Lucee-${{ steps.cleanrefname.outputs.value }}-junit-test-results-${{ github.run_number }}
path: test/reports/*.xml
- name: Remove Lucee build artifacts from local maven cache (avoid growing cache)
run: |
rm -rfv ~/.m2/repository/org/lucee/lucee/
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: test/reports/*.xml
check_name: "Lucee Test Results"
- name: Trigger Docker Build
if: ${{ env.DO_DEPLOY == 'true' }}
env:
TRAVIS_JOB_ID: ${{ github.run_id }}
TRAVIS_TOKEN: ${{ secrets.DOCKER_AUTH_TOKEN }} # not set up yet
run: |
echo "Trigger Docker Build on Travis https://travis-ci.com/github/lucee/lucee-dockerfiles"
chmod +x travis-docker-build.sh
./travis-docker-build.sh