5252 RUST_VERSION : stable
5353
5454jobs :
55+
56+ # Build native library once and share with all test jobs
57+ build-native :
58+ name : Build Native Library
59+ runs-on : ubuntu-24.04
60+ container :
61+ image : amd64/rust
62+ steps :
63+ - uses : actions/checkout@v6
64+
65+ - name : Setup Rust toolchain
66+ uses : ./.github/actions/setup-builder
67+ with :
68+ rust-version : ${{ env.RUST_VERSION }}
69+ jdk-version : 17
70+
71+ - name : Cache Cargo
72+ uses : actions/cache@v4
73+ with :
74+ path : |
75+ ~/.cargo/registry
76+ ~/.cargo/git
77+ native/target
78+ key : ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}
79+ restore-keys : |
80+ ${{ runner.os }}-cargo-ci-
81+
82+ - name : Build native library (CI profile)
83+ run : |
84+ cd native
85+ cargo build --profile ci
86+
87+ - name : Upload native library
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : native-lib-linux
91+ path : native/target/ci/libcomet.so
92+ retention-days : 1
93+
5594 spark-sql-auto-scan :
95+ needs : build-native
5696 strategy :
5797 matrix :
5898 os : [ubuntu-24.04]
@@ -81,11 +121,17 @@ jobs:
81121 with :
82122 rust-version : ${{env.RUST_VERSION}}
83123 jdk-version : ${{ matrix.spark-version.java }}
124+ - name : Download native library
125+ uses : actions/download-artifact@v4
126+ with :
127+ name : native-lib-linux
128+ path : native/target/release/
84129 - name : Setup Spark
85130 uses : ./.github/actions/setup-spark-builder
86131 with :
87132 spark-version : ${{ matrix.spark-version.full }}
88133 spark-short-version : ${{ matrix.spark-version.short }}
134+ skip-native-build : true
89135 - name : Run Spark tests
90136 run : |
91137 cd apache-spark
@@ -105,6 +151,7 @@ jobs:
105151 path : " **/fallback.log"
106152
107153 spark-sql-native-native-comet :
154+ needs : build-native
108155 strategy :
109156 matrix :
110157 os : [ ubuntu-24.04 ]
@@ -130,11 +177,17 @@ jobs:
130177 with :
131178 rust-version : ${{env.RUST_VERSION}}
132179 jdk-version : ${{ matrix.java-version }}
180+ - name : Download native library
181+ uses : actions/download-artifact@v4
182+ with :
183+ name : native-lib-linux
184+ path : native/target/release/
133185 - name : Setup Spark
134186 uses : ./.github/actions/setup-spark-builder
135187 with :
136188 spark-version : ${{ matrix.spark-version.full }}
137189 spark-short-version : ${{ matrix.spark-version.short }}
190+ skip-native-build : true
138191 - name : Run Spark tests
139192 run : |
140193 cd apache-spark
@@ -154,6 +207,7 @@ jobs:
154207 path : " **/fallback.log"
155208
156209 spark-sql-native-iceberg-compat :
210+ needs : build-native
157211 strategy :
158212 matrix :
159213 os : [ubuntu-24.04]
@@ -179,11 +233,17 @@ jobs:
179233 with :
180234 rust-version : ${{env.RUST_VERSION}}
181235 jdk-version : ${{ matrix.java-version }}
236+ - name : Download native library
237+ uses : actions/download-artifact@v4
238+ with :
239+ name : native-lib-linux
240+ path : native/target/release/
182241 - name : Setup Spark
183242 uses : ./.github/actions/setup-spark-builder
184243 with :
185244 spark-version : ${{ matrix.spark-version.full }}
186245 spark-short-version : ${{ matrix.spark-version.short }}
246+ skip-native-build : true
187247 - name : Run Spark tests
188248 run : |
189249 cd apache-spark
0 commit comments