Skip to content

Commit c4ca1d2

Browse files
authored
Merge pull request #260 from embulk/embulk/add-github-actions-postgresql13-mysql8
[CI] Add GitHub Actions PostgreSQL 13 and MySQL 8.3
2 parents d5bb81c + 77cf13f commit c4ca1d2

File tree

1 file changed

+116
-17
lines changed

1 file changed

+116
-17
lines changed

.github/workflows/build.yml

Lines changed: 116 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build and test
2-
on: push
2+
on: [push, pull_request]
33
jobs:
4-
mysql:
4+
mysql5_7:
55
strategy:
66
fail-fast: false
77
runs-on: ubuntu-latest
@@ -16,8 +16,8 @@ jobs:
1616
MYSQL_USER: ci
1717
MYSQL_PASSWORD: password
1818
steps:
19-
- uses: actions/checkout@v2
20-
- uses: actions/setup-java@v2
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-java@v4
2121
with:
2222
java-version: 8
2323
distribution: 'zulu'
@@ -30,12 +30,71 @@ jobs:
3030
env:
3131
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
3232
EMBULK_INPUT_MYSQL_TEST_CONFIG: "${{ github.workspace }}/ci/mysql.yml"
33-
- uses: actions/upload-artifact@v2
33+
- uses: actions/upload-artifact@v4
3434
if: always()
3535
with:
36-
name: mysql
36+
name: mysql5_7
3737
path: embulk-input-mysql/build/reports/tests/test
38-
postgresql:
38+
mysql8_3:
39+
strategy:
40+
fail-fast: false
41+
runs-on: ubuntu-latest
42+
services:
43+
mysql:
44+
# Due to MySQL 8.4 disabled mysql_native_password by default,
45+
# Connector/J 5.x can't connect to database.
46+
# So, Use MySQL 8.3.
47+
image: mysql:8.3
48+
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
49+
ports:
50+
- "3306:3306"
51+
env:
52+
MYSQL_ROOT_PASSWORD: root
53+
MYSQL_USER: ci
54+
MYSQL_PASSWORD: password
55+
steps:
56+
- uses: actions/checkout@v4
57+
- uses: actions/setup-java@v4
58+
with:
59+
java-version: 8
60+
distribution: 'zulu'
61+
- name: Connect
62+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "show databases;"
63+
- name: show version
64+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "select version();"
65+
- name: Create database
66+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "create database ci_test;"
67+
#
68+
# MySQL 8 uses caching_sha2_password mechanism by default.
69+
# Connector/J 5.x doesn't support it.
70+
#
71+
# This part change password mechanism to mysql_native_password.
72+
# Remove the following part after update Connector/J
73+
#
74+
- name: Show password plugins
75+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "SELECT user, host, plugin FROM mysql.user;"
76+
- name: Change password mechanism1 (root@localhost)
77+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
78+
- name: Change password mechanism2 (root@%)
79+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';"
80+
- name: FLUSH PRIVILEGES
81+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "FLUSH PRIVILEGES;"
82+
- name: Show password plugins2
83+
run: mysql -h 127.0.0.1 --port 3306 -uroot -proot -e "SELECT user, host, plugin FROM mysql.user;"
84+
#
85+
# End caching_sha2_password workaround.
86+
#
87+
- name: Build with testing
88+
run: ./gradlew --stacktrace :embulk-input-mysql:check
89+
env:
90+
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
91+
EMBULK_INPUT_MYSQL_TEST_CONFIG: "${{ github.workspace }}/ci/mysql.yml"
92+
- uses: actions/upload-artifact@v4
93+
if: always()
94+
with:
95+
name: mysql8_3
96+
path: embulk-input-mysql/build/reports/tests/test
97+
postgresql9_4:
3998
runs-on: ubuntu-latest
4099
services:
41100
postgres:
@@ -46,15 +105,55 @@ jobs:
46105
env:
47106
POSTGRES_PASSWORD: postgres
48107
steps:
49-
- uses: actions/checkout@v2
50-
- uses: actions/setup-java@v2
108+
- uses: actions/checkout@v4
109+
- uses: actions/setup-java@v4
110+
with:
111+
java-version: 8
112+
distribution: 'zulu'
113+
- name: Connect
114+
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "\l"
115+
env:
116+
PGPASSWORD: postgres
117+
- name: Create database
118+
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "create database ci_test;"
119+
env:
120+
PGPASSWORD: postgres
121+
- name: Build with testing
122+
run: ./gradlew --stacktrace :embulk-input-postgresql:check
123+
env:
124+
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
125+
EMBULK_INPUT_POSTGRESQL_TEST_CONFIG: "${{ github.workspace }}/ci/postgresql.yml"
126+
- uses: actions/upload-artifact@v4
127+
if: always()
128+
with:
129+
name: postgresql9_4
130+
path: embulk-input-postgresql/build/reports/tests/test
131+
# PostgreSQL 14 and later, raise the exception "The authentication type 10 is not supported."
132+
# Use PostgreSQL 13 at this time.
133+
postgresql13:
134+
runs-on: ubuntu-latest
135+
services:
136+
postgres:
137+
image: postgres:13
138+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
139+
ports:
140+
- "5432:5432"
141+
env:
142+
POSTGRES_PASSWORD: postgres
143+
steps:
144+
- uses: actions/checkout@v4
145+
- uses: actions/setup-java@v4
51146
with:
52147
java-version: 8
53148
distribution: 'zulu'
54149
- name: Connect
55150
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "\l"
56151
env:
57152
PGPASSWORD: postgres
153+
- name: Show version
154+
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "select * from version();"
155+
env:
156+
PGPASSWORD: postgres
58157
- name: Create database
59158
run: psql -h 127.0.0.1 -p 5432 -U postgres -d postgres -c "create database ci_test;"
60159
env:
@@ -64,10 +163,10 @@ jobs:
64163
env:
65164
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
66165
EMBULK_INPUT_POSTGRESQL_TEST_CONFIG: "${{ github.workspace }}/ci/postgresql.yml"
67-
- uses: actions/upload-artifact@v2
166+
- uses: actions/upload-artifact@v4
68167
if: always()
69168
with:
70-
name: postgresql
169+
name: postgresql13
71170
path: embulk-input-postgresql/build/reports/tests/test
72171
redshift:
73172
runs-on: ubuntu-latest
@@ -81,8 +180,8 @@ jobs:
81180
env:
82181
POSTGRES_PASSWORD: postgres
83182
steps:
84-
- uses: actions/checkout@v2
85-
- uses: actions/setup-java@v2
183+
- uses: actions/checkout@v4
184+
- uses: actions/setup-java@v4
86185
with:
87186
java-version: 8
88187
distribution: 'zulu'
@@ -99,7 +198,7 @@ jobs:
99198
env:
100199
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
101200
EMBULK_INPUT_REDSHIFT_TEST_CONFIG: "${{ github.workspace }}/ci/redshift.yml"
102-
- uses: actions/upload-artifact@v2
201+
- uses: actions/upload-artifact@v4
103202
if: always()
104203
with:
105204
name: redshift
@@ -118,8 +217,8 @@ jobs:
118217
ACCEPT_EULA: Y
119218
SA_PASSWORD: "P@ssw0rd"
120219
steps:
121-
- uses: actions/checkout@v2
122-
- uses: actions/setup-java@v2
220+
- uses: actions/checkout@v4
221+
- uses: actions/setup-java@v4
123222
with:
124223
java-version: 8
125224
distribution: 'zulu'
@@ -146,7 +245,7 @@ jobs:
146245
_JAVA_OPTIONS: "-Xmx2048m -Xms512m"
147246
EMBULK_INPUT_SQLSERVER_TEST_CONFIG: "${{ github.workspace }}/ci/sqlserver.yml"
148247
EMBULK_INPUT_SQLSERVER_TEST_SQLCMD_COMMAND: "docker exec mssqlcontainer /opt/mssql-tools/bin/sqlcmd"
149-
- uses: actions/upload-artifact@v2
248+
- uses: actions/upload-artifact@v4
150249
if: always()
151250
with:
152251
name: sqlserver

0 commit comments

Comments
 (0)