This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
214 lines (205 loc) · 8.06 KB
/
cross-maven.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
#
# Copyright Debezium Authors
#
# Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
#
# Cross CI workflow is triggered on a `pull_request` event.
# It builds the Debezium core before building the Db2 connector basing on either the `master` branch or the `pull_request` branch.
# If a `pull_request` with same branch name is present in the Debezium's upstream core repository, then the core build of this `pull_request`
# will be based on `pull_request` branch of user's Debezium core repository.
# Otherwise the core build of this `pull_request` will be based on the `master` branch of Debezium's upstream core repository.
name: Cross Maven CI
on:
pull_request:
branches:
- main
- 1.*
- 2.*
paths-ignore:
- '*.md'
jobs:
build_core:
runs-on: ubuntu-latest
outputs:
coreHash: ${{ steps.core_hash.outputs.hash }}
steps:
- name: Check if pull request branch exists in debezium main repository
id: branch
env:
branch_name: ${{ github.head_ref }}
run: |
curl --silent -X "GET" https://api.github.com/repos/debezium/debezium/pulls | jq '.[] | {branch: .head.ref}' | jq -r '.branch' >> SORTED_PULLS.txt
while IFS=" " read -r BRANCH;
do
if grep -q "$branch_name" <<< "$BRANCH"; then
echo "BRANCH_FOUND=true" >> $GITHUB_OUTPUT
fi
done < SORTED_PULLS.txt
- name: Checkout core repository with pull request branch
if: ${{ steps.branch.outputs.BRANCH_FOUND == 'true' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.user.login }}/debezium
ref: ${{ github.head_ref }}
path: core
- name: Checkout core repository with default base branch
if: ${{ steps.branch.outputs.BRANCH_FOUND != 'true' }}
uses: actions/checkout@v4
with:
repository: debezium/debezium
ref: ${{ github.base_ref }}
path: core
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Cache Maven packages
uses: actions/cache@v4
id: cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-debezium-core-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-debezium-core-${{ hashFiles('**/pom.xml') }}
- name: Maven build core
if: steps.cache.outputs.cache-hit != 'true'
run: ./core/mvnw clean install -f core/pom.xml -pl debezium-bom,debezium-core,debezium-embedded,debezium-storage -am -DskipTests -DskipITs -Dformat.formatter.goal=validate -Dformat.imports.goal=check -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
- name: Output core cache hash
id: core_hash
run: |
echo "hash=${{ hashFiles('**/pom.xml') }}" >> "$GITHUB_OUTPUT"
# Build step that checks out the source, builds, and includes the integration and the
# end to end tests for DB2 as part of the build step.
build_db2:
name: Build and test (Db2)
needs: [ build_core ]
runs-on: ubuntu-latest
steps:
- name: Checkout JDBC sink connector
uses: actions/checkout@v4
with:
path: jdbc
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Load Debezium core cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-debezium-core-${{ needs.build_core.outputs.coreHash}}
- name: Build sink
run: ./jdbc/mvnw clean install -f jdbc/pom.xml -B -Passembly -Dtest.tags=it-db2,e2e-db2 -Dsource.connectors=mysql,postgres,sqlserver
# Build step that checks out the source, builds, and includes the integration and the
# end to end tests for MySQL as part of the build step.
build_mysql:
name: Build and test (MySQL)
needs: [ build_core ]
runs-on: ubuntu-latest
steps:
- name: Checkout core repository
uses: actions/checkout@v4
with:
repository: debezium/debezium
path: core
- name: Checkout JDBC sink connector
uses: actions/checkout@v4
with:
path: jdbc
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Load Debezium core cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-debezium-core-${{ needs.build_core.outputs.coreHash}}
- name: Build sink
run: ./jdbc/mvnw clean install -f jdbc/pom.xml -B -Passembly -Dtest.tags=it-mysql,e2e-mysql -Dsource.connectors=mysql,postgres,sqlserver
# Build step that checks out the source, builds, and includes the integration and the
# end to end tests for Oracle as part of the build step.
# build_oracle:
# name: Build and test (Oracle)
# needs: [build_core]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout core repository
# uses: actions/checkout@v4
# with:
# repository: debezium/debezium
# path: core
# - name: Checkout JDBC sink connector
# uses: actions/checkout@v4
# with:
# path: jdbc
# - name: Set up Java 21
# uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: 21
# - name: Load Debezium core cache
# uses: actions/cache/restore@v4
# with:
# path: ~/.m2/repository
# key: ${{ runner.os }}-maven-debezium-core-${{ needs.build_core.outputs.coreHash}}
# - name: Build sink
# run: ./jdbc/mvnw clean install -f jdbc/pom.xml -B -Passembly -Dtest.tags=it-oracle,e2e-oracle -Dsource.connectors=mysql,postgres,sqlserver
# Build step that checks out the source, builds, and includes the integration and the
# end to end tests for PostgreSQL as part of the build step.
build_postgresql:
name: Build and test (PostgreSQL)
needs: [ build_core ]
runs-on: ubuntu-latest
steps:
- name: Checkout core repository
uses: actions/checkout@v4
with:
repository: debezium/debezium
path: core
- name: Checkout JDBC sink connector
uses: actions/checkout@v4
with:
path: jdbc
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Load Debezium core cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-debezium-core-${{ needs.build_core.outputs.coreHash}}
- name: Build sink
run: ./jdbc/mvnw clean install -f jdbc/pom.xml -B -Passembly -Dtest.tags=it-postgresql,e2e-postgresql -Dsource.connectors=mysql,postgres,sqlserver
# Build step that checks out the source, builds, and includes the integration and the
# end to end tests for SQL Server as part of the build step.
build_sqlserver:
name: Build and test (SQL Server)
needs: [ build_core ]
runs-on: ubuntu-latest
steps:
- name: Checkout core repository
uses: actions/checkout@v4
with:
repository: debezium/debezium
path: core
- name: Checkout JDBC sink connector
uses: actions/checkout@v4
with:
path: jdbc
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Load Debezium core cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-debezium-core-${{ needs.build_core.outputs.coreHash}}
- name: Build sink
run: ./jdbc/mvnw clean install -f jdbc/pom.xml -B -Passembly -Dtest.tags=it-sqlserver,e2e-sqlserver -Dsource.connectors=mysql,postgres,sqlserver