-
Notifications
You must be signed in to change notification settings - Fork 25
222 lines (212 loc) · 7.68 KB
/
CI.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
name: JQM CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
defaults:
run:
working-directory: ./jqm-all
jobs:
jdk_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [11, 17, 21]
steps:
- uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: ${{ matrix.java }}
- name: Build
run: mvn install -DskipTests
- name: Test
run: mvn test
postgres_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
postgres: [9.6, 12, 15]
steps:
- uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "zulu"
- uses: harmon758/postgresql-action@v1
with:
postgresql version: ${{ matrix.postgres }}
postgresql db: "jqm"
postgresql user: "jqm"
postgresql password: "jqm"
- name: Build
run: mvn install -DskipTests
- name: Test
run: mvn test
env:
DB: postgresql
DB_VERSION: ${{ matrix.postgres }}
mysql_tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: jqm
MYSQL_USER: jqm
MYSQL_PASSWORD: jqm
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "zulu"
- name: Build
run: mvn install -DskipTests
- name: Test
run: mvn test
env:
DB: mysql
DB_VERSION: 5.7
mariadb_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mariadb: [10.1, 10.3]
steps:
- uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "zulu"
- uses: getong/[email protected]
with:
mariadb version: ${{matrix.mariadb}}
mysql database: "jqm"
mysql user: "jqm"
mysql password: "jqm"
- name: Build
run: mvn install -DskipTests
- name: Test
run: mvn test
env:
DB: mariadb
DB_VERSION: ${{matrix.mariadb}}
db2_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- run: docker run --privileged=true --rm --name db2 --detach -p 50000:50000 -e "LICENSE=accept" -e "DB2INST1_PASSWORD=superpassword" -e "DBNAME=jqm" -e "ARCHIVE_LOGS=false" ibmcom/db2;
- run: while true; do if docker logs db2 2>/dev/null | grep -q "Setup has completed"; then break; fi; done
- run: docker exec db2 /bin/bash -c 'useradd -G db2iadm1 jqm; echo "jqm:jqm" | chpasswd';
- run: docker exec --user db2inst1 db2 /bin/bash -c 'export DB2INSTANCE=db2inst1; printf "connect to jqm\n create schema jqm AUTHORIZATION jqm\n " | /opt/ibm/db2/V11.5/bin/db2 -v -';
- name: Set up java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "zulu"
- name: Build
run: mvn install -DskipTests
- name: Test
run: mvn test
env:
DB: db2
DB_VERSION: 11.5
oracle_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Oracle container registry
uses: docker/login-action@v3
with:
registry: container-registry.oracle.com
password: ${{ secrets.DOCKER_ORACLE_REPO_PASSWORD }}
username: ${{ secrets.DOCKER_ORACLE_REPO_USERNAME }}
- run: docker run --detach --rm -p 1521:1521 --name oracle -e "DB_SID=JQM" container-registry.oracle.com/database/enterprise:12.2.0.1;
- run: while true; do if docker ps | grep "oracle" | grep -q "(healthy)" ; then break; fi; done
- run: docker exec oracle /bin/bash -c ". /home/oracle/.bashrc ; printf 'alter session set \"_ORACLE_SCRIPT\"=true; \n CREATE USER JQM IDENTIFIED BY jqm DEFAULT TABLESPACE SYSAUX QUOTA UNLIMITED ON SYSAUX ACCOUNT UNLOCK;\n GRANT CONNECT, RESOURCE TO JQM;\n ALTER SYSTEM SET OPEN_CURSORS=9999 SCOPE=BOTH;\n ' | sqlplus / as sysdba";
- name: Set up java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "zulu"
- name: Build
run: mvn install -DskipTests
- name: Test
run: mvn test
env:
DB: oracle
DB_VERSION: 12.2
publish_docker_image:
runs-on: ubuntu-latest
needs:
[
oracle_test,
db2_test,
mariadb_tests,
mysql_tests,
postgres_tests,
jdk_tests,
]
# trigger job on merge only
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Push only for linux
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
push: true
file: docker/linux/Dockerfile
tags: enioka/jqm:nightly
publish_snapshot:
runs-on: ubuntu-latest
needs:
[
oracle_test,
db2_test,
mariadb_tests,
mysql_tests,
postgres_tests,
jdk_tests,
]
# trigger job on merge only
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "zulu"
server-id: sonatype-nexus-snapshots
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
- name: Publish package
run: mvn deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }}