-
Notifications
You must be signed in to change notification settings - Fork 811
263 lines (234 loc) · 8.41 KB
/
build.yml
File metadata and controls
263 lines (234 loc) · 8.41 KB
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
name: build
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main", "branch-*" ]
paths-ignore:
- '**/*.md'
- '**/*.mdx'
- 'docs/assets/**'
- 'web-v2/**'
pull_request:
branches: [ "main", "branch-*" ]
paths-ignore:
- '**/*.md'
- '**/*.mdx'
- 'docs/assets/**'
- 'web-v2/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
id: filter
with:
list-files: shell
filters: |
source_changes:
- '.github/**'
- 'catalogs/**'
- 'catalogs-contrib/**'
- 'clients/**'
- 'conf/**'
- 'dev/**'
- 'docs/open-api/**'
- 'gradle/**'
- 'gradle.properties'
- 'meta/**'
- 'scripts/**'
- 'web/**'
- '**/*.java'
- '**/*.kts'
- '**/*.py'
- '**/*.rs'
- '**/resources/**'
- '**/src/**'
- '!**/*.md'
- '!**/*.mdx'
- '!docs/**/*.png'
- '!docs/**/*.svg'
- '!docs/**/*.jpg'
- '!docs/**/*.jpeg'
- '!docs/**/*.gif'
- '!docs/**/*.webp'
- 'mcp-server/**'
spark_connector_changes:
- spark-connector/**
mcp_server_changes:
- mcp-server/**
- name: Determine maintenance-module-only changes
id: maintenance_module_only
env:
SOURCE_CHANGE_FILES: ${{ steps.filter.outputs.source_changes_files }}
run: |
# Route to the maintenance-only build path only when every source
# change in the PR is under maintenance/. Non-source changes are
# already filtered out by source_changes_files.
source_files=()
if [ -n "${SOURCE_CHANGE_FILES}" ]; then
eval "source_files=(${SOURCE_CHANGE_FILES})"
fi
maintenance_module_only=false
if [ "${#source_files[@]}" -gt 0 ]; then
maintenance_module_only=true
for path in "${source_files[@]}"; do
case "$path" in
maintenance/*) ;;
*)
maintenance_module_only=false
break
;;
esac
done
fi
echo "maintenance_module_only_changes=${maintenance_module_only}" >> "${GITHUB_OUTPUT}"
outputs:
source_changes: ${{ steps.filter.outputs.source_changes }}
spark_connector_changes: ${{ steps.filter.outputs.spark_connector_changes }}
mcp_server_changes: ${{ steps.filter.outputs.mcp_server_changes }}
maintenance_module_only_changes: ${{ steps.maintenance_module_only.outputs.maintenance_module_only_changes }}
compile-check:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.source_changes != 'true'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java-toolchains
with:
java-version: 17
- name: Build with Gradle
run: |
./gradlew assemble -PskipWeb=true
# To check the spark-connector is compatible with scala2.13
spark-connector-build:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: changes
if: needs.changes.outputs.spark_connector_changes == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Free up disk space
run: |
dev/ci/util_free_space.sh
- name: Build with Scala2.13
run: |
./gradlew :spark-connector:spark-3.3:build -PscalaVersion=2.13 -PskipITs -PskipDockerTests=false -PskipWeb=true
./gradlew :spark-connector:spark-3.4:build -PscalaVersion=2.13 -PskipITs -PskipDockerTests=false -PskipWeb=true
./gradlew :spark-connector:spark-3.5:build -PscalaVersion=2.13 -PskipITs -PskipDockerTests=false -PskipWeb=true
- name: Upload unit tests report
uses: actions/upload-artifact@v7
if: failure()
with:
name: unit test report
path: |
build/reports
spark-connector/**/*.log
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
timeout-minutes: 90
needs: changes
if: needs.changes.outputs.source_changes == 'true'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-java-toolchains
with:
java-version: ${{ matrix.java-version }}
- name: Test publish to local
run: ./gradlew publishToMavenLocal -PskipWeb=true -x test
- name: Free up disk space
run: |
dev/ci/util_free_space.sh
- name: Install dependencies
run: |
wget https://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
- name: Build with Gradle
run: |
if [ "${{ needs.changes.outputs.maintenance_module_only_changes }}" = "true" ]; then
./gradlew \
:maintenance:optimizer-api:build \
:maintenance:updaters:build \
:maintenance:optimizer:build \
:maintenance:jobs:build \
-PskipWeb=true \
-PskipITs \
-PskipDockerTests=false
exit 0
fi
gradle_args=(
build
-PskipWeb=true
-PskipITs
-PskipDockerTests=false
-x :clients:client-python:build
)
if [ "${{ needs.changes.outputs.mcp_server_changes }}" != "true" ]; then
gradle_args+=(
-x :mcp-server:build
-x :mcp-server:test
-x :mcp-server:pylint
-x :web-v2:web:build
)
fi
printf './gradlew'
printf ' %q' "${gradle_args[@]}"
printf '\n'
./gradlew "${gradle_args[@]}"
- name: Fetch base branch for coverage diff
if: github.event_name == 'pull_request'
run: git fetch origin ${{ github.base_ref }} --depth=1
- name: Generate Coverage Report
id: coverage
if: github.event_name == 'pull_request'
run: |
python3 dev/ci/jacoco_report.py \
--base-ref "${{ github.base_ref }}" \
--head-sha "${{ github.event.pull_request.head.sha }}" \
--repo-url "${{ github.event.pull_request.head.repo.html_url }}" \
--min-overall 40 \
--min-changed 60 \
--output coverage-report.md
- name: Save PR number
if: github.event_name == 'pull_request' && steps.coverage.outputs.has_reports == 'true'
run: echo "${{ github.event.pull_request.number }}" > pr-number.txt
- name: Upload Coverage Report
if: github.event_name == 'pull_request' && steps.coverage.outputs.has_reports == 'true'
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: |
coverage-report.md
pr-number.txt
- name: Output Coverage Info
if: github.event_name == 'pull_request' && steps.coverage.outputs.has_reports == 'true'
run: |
echo "Total coverage ${{ steps.coverage.outputs.coverage-overall }}"
echo "Changed Files coverage ${{ steps.coverage.outputs.coverage-changed-files }}"
- name: Upload unit tests report
uses: actions/upload-artifact@v7
if: failure()
with:
name: unit test report
path: |
build/reports
catalogs-contrib/**/*.log
catalogs-contrib/**/*.tar
catalogs/**/*.log
catalogs/**/*.tar