4646 RUST_VERSION : stable
4747
4848jobs :
49+ # Build native library once and share with all test jobs
50+ build-native :
51+ if : contains(github.event.pull_request.title, '[iceberg]')
52+ name : Build Native Library
53+ runs-on : ubuntu-24.04
54+ container :
55+ image : amd64/rust
56+ steps :
57+ - uses : actions/checkout@v6
58+
59+ - name : Setup Rust & Java toolchain
60+ uses : ./.github/actions/setup-builder
61+ with :
62+ rust-version : ${{ env.RUST_VERSION }}
63+ jdk-version : 17
64+
65+ - name : Restore Cargo cache
66+ uses : actions/cache/restore@v5
67+ with :
68+ path : |
69+ ~/.cargo/registry
70+ ~/.cargo/git
71+ native/target
72+ key : ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}
73+ restore-keys : |
74+ ${{ runner.os }}-cargo-ci-
75+
76+ - name : Build native library
77+ # Use CI profile for faster builds (no LTO) and to share cache with pr_build_linux.yml.
78+ run : |
79+ cd native && cargo build --profile ci
80+
81+ - name : Save Cargo cache
82+ uses : actions/cache/save@v5
83+ if : github.ref == 'refs/heads/main'
84+ with :
85+ path : |
86+ ~/.cargo/registry
87+ ~/.cargo/git
88+ native/target
89+ key : ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}
90+
91+ - name : Upload native library
92+ uses : actions/upload-artifact@v6
93+ with :
94+ name : native-lib-iceberg
95+ path : native/target/ci/libcomet.so
96+ retention-days : 1
97+
4998 iceberg-spark :
99+ needs : build-native
50100 if : contains(github.event.pull_request.title, '[iceberg]')
51101 strategy :
52102 matrix :
@@ -69,10 +119,14 @@ jobs:
69119 with :
70120 rust-version : ${{env.RUST_VERSION}}
71121 jdk-version : ${{ matrix.java-version }}
122+ - name : Download native library
123+ uses : actions/download-artifact@v7
124+ with :
125+ name : native-lib-iceberg
126+ path : native/target/release/
72127 - name : Build Comet
73- shell : bash
74128 run : |
75- PROFILES="- Pspark-${{matrix.spark-version.short}} -Pscala-${{matrix.scala-version}}" make release
129+ ./mvnw install -Prelease -DskipTests - Pspark-${{ matrix.spark-version.short }} -Pscala-${{ matrix.scala-version }}
76130 - name : Setup Iceberg
77131 uses : ./.github/actions/setup-iceberg-builder
78132 with :
86140 -Pquick=true -x javadoc
87141
88142 iceberg-spark-extensions :
143+ needs : build-native
89144 if : contains(github.event.pull_request.title, '[iceberg]')
90145 strategy :
91146 matrix :
@@ -108,10 +163,14 @@ jobs:
108163 with :
109164 rust-version : ${{env.RUST_VERSION}}
110165 jdk-version : ${{ matrix.java-version }}
166+ - name : Download native library
167+ uses : actions/download-artifact@v7
168+ with :
169+ name : native-lib-iceberg
170+ path : native/target/release/
111171 - name : Build Comet
112- shell : bash
113172 run : |
114- PROFILES="- Pspark-${{matrix.spark-version.short}} -Pscala-${{matrix.scala-version}}" make release
173+ ./mvnw install -Prelease -DskipTests - Pspark-${{ matrix.spark-version.short }} -Pscala-${{ matrix.scala-version }}
115174 - name : Setup Iceberg
116175 uses : ./.github/actions/setup-iceberg-builder
117176 with :
@@ -125,6 +184,7 @@ jobs:
125184 -Pquick=true -x javadoc
126185
127186 iceberg-spark-runtime :
187+ needs : build-native
128188 if : contains(github.event.pull_request.title, '[iceberg]')
129189 strategy :
130190 matrix :
@@ -147,10 +207,14 @@ jobs:
147207 with :
148208 rust-version : ${{env.RUST_VERSION}}
149209 jdk-version : ${{ matrix.java-version }}
210+ - name : Download native library
211+ uses : actions/download-artifact@v7
212+ with :
213+ name : native-lib-iceberg
214+ path : native/target/release/
150215 - name : Build Comet
151- shell : bash
152216 run : |
153- PROFILES="- Pspark-${{matrix.spark-version.short}} -Pscala-${{matrix.scala-version}}" make release
217+ ./mvnw install -Prelease -DskipTests - Pspark-${{ matrix.spark-version.short }} -Pscala-${{ matrix.scala-version }}
154218 - name : Setup Iceberg
155219 uses : ./.github/actions/setup-iceberg-builder
156220 with :
@@ -164,6 +228,7 @@ jobs:
164228 -Pquick=true -x javadoc
165229
166230 iceberg-spark-rust :
231+ needs : build-native
167232 if : contains(github.event.pull_request.title, '[iceberg]')
168233 strategy :
169234 matrix :
@@ -186,10 +251,14 @@ jobs:
186251 with :
187252 rust-version : ${{env.RUST_VERSION}}
188253 jdk-version : ${{ matrix.java-version }}
254+ - name : Download native library
255+ uses : actions/download-artifact@v7
256+ with :
257+ name : native-lib-iceberg
258+ path : native/target/release/
189259 - name : Build Comet
190- shell : bash
191260 run : |
192- PROFILES="- Pspark-${{matrix.spark-version.short}} -Pscala-${{matrix.scala-version}}" make release
261+ ./mvnw install -Prelease -DskipTests - Pspark-${{ matrix.spark-version.short }} -Pscala-${{ matrix.scala-version }}
193262 - name : Setup Iceberg
194263 uses : ./.github/actions/setup-iceberg-rust-builder
195264 with :
@@ -203,6 +272,7 @@ jobs:
203272 -Pquick=true -x javadoc
204273
205274 iceberg-spark-extensions-rust :
275+ needs : build-native
206276 if : contains(github.event.pull_request.title, '[iceberg]')
207277 strategy :
208278 matrix :
@@ -225,10 +295,14 @@ jobs:
225295 with :
226296 rust-version : ${{env.RUST_VERSION}}
227297 jdk-version : ${{ matrix.java-version }}
298+ - name : Download native library
299+ uses : actions/download-artifact@v7
300+ with :
301+ name : native-lib-iceberg
302+ path : native/target/release/
228303 - name : Build Comet
229- shell : bash
230304 run : |
231- PROFILES="- Pspark-${{matrix.spark-version.short}} -Pscala-${{matrix.scala-version}}" make release
305+ ./mvnw install -Prelease -DskipTests - Pspark-${{ matrix.spark-version.short }} -Pscala-${{ matrix.scala-version }}
232306 - name : Setup Iceberg
233307 uses : ./.github/actions/setup-iceberg-rust-builder
234308 with :
@@ -242,6 +316,7 @@ jobs:
242316 -Pquick=true -x javadoc
243317
244318 iceberg-spark-runtime-rust :
319+ needs : build-native
245320 if : contains(github.event.pull_request.title, '[iceberg]')
246321 strategy :
247322 matrix :
@@ -264,10 +339,14 @@ jobs:
264339 with :
265340 rust-version : ${{env.RUST_VERSION}}
266341 jdk-version : ${{ matrix.java-version }}
342+ - name : Download native library
343+ uses : actions/download-artifact@v7
344+ with :
345+ name : native-lib-iceberg
346+ path : native/target/release/
267347 - name : Build Comet
268- shell : bash
269348 run : |
270- PROFILES="- Pspark-${{matrix.spark-version.short}} -Pscala-${{matrix.scala-version}}" make release
349+ ./mvnw install -Prelease -DskipTests - Pspark-${{ matrix.spark-version.short }} -Pscala-${{ matrix.scala-version }}
271350 - name : Setup Iceberg
272351 uses : ./.github/actions/setup-iceberg-rust-builder
273352 with :
0 commit comments