-
Notifications
You must be signed in to change notification settings - Fork 74
296 lines (296 loc) · 11.7 KB
/
check.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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
name: Check
on: [ pull_request, push ]
jobs:
mysql5_7:
runs-on: ubuntu-latest
# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
services:
mysql:
image: mysql:5.7
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: ci
MYSQL_PASSWORD: password
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: "gradle"
- name: Connect
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "show databases;"
- name: Create database
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "create database ci_test;"
- name: Build with testing
run: ./gradlew --stacktrace :embulk-input-mysql:check
env:
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
EMBULK_INPUT_MYSQL_TEST_CONFIG: "${{ github.workspace }}/ci/mysql.yml"
- uses: actions/upload-artifact@v4
if: always()
with:
name: mysql5_7
path: embulk-input-mysql/build/reports/tests/test
mysql8_3:
runs-on: ubuntu-latest
# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
services:
mysql:
# Due to MySQL 8.4 disabled mysql_native_password by default,
# Connector/J 5.x can't connect to database.
# So, Use MySQL 8.3.
image: mysql:8.3
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: ci
MYSQL_PASSWORD: password
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: "gradle"
- name: Connect
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "show databases;"
- name: show version
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "select version();"
- name: Create database
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "create database ci_test;"
#
# MySQL 8 uses caching_sha2_password mechanism by default.
# Connector/J 5.x doesn't support it.
#
# This part change password mechanism to mysql_native_password.
# Remove the following part after update Connector/J
#
- name: Show password plugins
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "SELECT user, host, plugin FROM mysql.user;"
- name: Change password mechanism1 (root@localhost)
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
- name: Change password mechanism2 (root@%)
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';"
- name: FLUSH PRIVILEGES
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "FLUSH PRIVILEGES;"
- name: Show password plugins2
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "SELECT user, host, plugin FROM mysql.user;"
#
# End caching_sha2_password workaround.
#
- name: Build with testing
run: ./gradlew --stacktrace :embulk-input-mysql:check
env:
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
EMBULK_INPUT_MYSQL_TEST_CONFIG: "${{ github.workspace }}/ci/mysql.yml"
- uses: actions/upload-artifact@v4
if: always()
with:
name: mysql8_3
path: embulk-input-mysql/build/reports/tests/test
postgresql9_4:
runs-on: ubuntu-latest
# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
services:
postgres:
image: postgres:9.4
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: "gradle"
- name: Connect
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "\l"
env:
PGPASSWORD: postgres
- name: Create database
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "create database ci_test;"
env:
PGPASSWORD: postgres
- name: Build with testing
run: ./gradlew --stacktrace :embulk-input-postgresql:check
env:
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
EMBULK_INPUT_POSTGRESQL_TEST_CONFIG: "${{ github.workspace }}/ci/postgresql.yml"
- uses: actions/upload-artifact@v4
if: always()
with:
name: postgresql9_4
path: embulk-input-postgresql/build/reports/tests/test
# PostgreSQL 14 and later, raise the exception "The authentication type 10 is not supported."
# Use PostgreSQL 13 at this time.
postgresql13:
runs-on: ubuntu-latest
# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
services:
postgres:
image: postgres:13
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: "gradle"
- name: Connect
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "\l"
env:
PGPASSWORD: postgres
- name: Show version
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "select * from version();"
env:
PGPASSWORD: postgres
- name: Create database
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "create database ci_test;"
env:
PGPASSWORD: postgres
- name: Build with testing
run: ./gradlew --stacktrace :embulk-input-postgresql:check
env:
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
EMBULK_INPUT_POSTGRESQL_TEST_CONFIG: "${{ github.workspace }}/ci/postgresql.yml"
- uses: actions/upload-artifact@v4
if: always()
with:
name: postgresql13
path: embulk-input-postgresql/build/reports/tests/test
redshift:
runs-on: ubuntu-latest
# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
# Testing embulk-input-redshift emulated with PostgreSQL.
services:
postgres:
image: postgres:9.4
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- "5439:5432"
env:
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: "gradle"
- name: Connect
run: psql -h 127.0.0.1 -p 5439 -U postgres -d postgres -c "\l"
env:
PGPASSWORD: postgres
- name: Create database
run: psql -h 127.0.0.1 -p 5439 -U postgres -d postgres -c "create database ci_test;"
env:
PGPASSWORD: postgres
- name: Build with testing
run: ./gradlew --stacktrace :embulk-input-redshift:check
env:
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
EMBULK_INPUT_REDSHIFT_TEST_CONFIG: "${{ github.workspace }}/ci/redshift.yml"
- uses: actions/upload-artifact@v4
if: always()
with:
name: redshift
path: embulk-input-redshift/build/reports/tests/test
sqlserver: # https://hub.docker.com/_/microsoft-mssql-server
runs-on: ubuntu-latest
# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
services:
sqlserver:
# To run locallly:
# docker run -it --name mssqlcontainer -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=somepassword' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-CU4-ubuntu-16.04
# Using an older version of "mssql/server" explicitly and intentionally.
#
# "mssql/server" has a newer version (CU28 as of 2024-10-23),
# but it reportedly does not start correctly.
#
# https://learn.microsoft.com/en-ie/answers/questions/1853144/error-failed-to-initialize-container-mcr-microsoft
image: docker://mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04
options: --name "mssqlcontainer" --health-cmd "/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P P@ssw0rd -Q \"SELECT * FROM sys.objects;\"" --health-interval 20s --health-timeout 30s --health-retries 128
ports:
- "1433:1433"
env:
ACCEPT_EULA: Y
SA_PASSWORD: "P@ssw0rd"
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: "gradle"
# TODO: Find a better way to wait for completing setup.
- name: Sleep for 30 seconds to complete all the SQL Server setup process
run: sleep 30
- name: List Docker containers
run: docker ps -a
- name: Confirm log
run: docker logs mssqlcontainer
- name: Copy test resources into Docker container
run: docker cp ${{ github.workspace }}/embulk-input-sqlserver/src/test/resources/org/embulk/input/sqlserver/test/expect/. mssqlcontainer:/tmp
- name: List resource files
run: docker exec mssqlcontainer ls -R /tmp
- name: Show SQL Server objects
run: docker exec mssqlcontainer /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P "P@ssw0rd" -Q "SELECT * FROM sys.objects;"
- name: Create testdb
run: docker exec mssqlcontainer /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P "P@ssw0rd" -Q "CREATE DATABASE testdb;"
- name: Show SQL Server objects in testdb
run: docker exec mssqlcontainer /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P "P@ssw0rd" -d testdb -Q "SELECT * FROM sys.objects;"
- name: Build with testing
run: ./gradlew --stacktrace :embulk-input-sqlserver:check
env:
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
EMBULK_INPUT_SQLSERVER_TEST_CONFIG: "${{ github.workspace }}/ci/sqlserver.yml"
EMBULK_INPUT_SQLSERVER_TEST_SQLCMD_COMMAND: "docker exec mssqlcontainer /opt/mssql-tools/bin/sqlcmd"
- uses: actions/upload-artifact@v4
if: always()
with:
name: sqlserver
path: embulk-input-sqlserver/build/reports/tests/test