|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: Test (JNI) |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + branches: |
| 23 | + - '**' |
| 24 | + - '!dependabot/**' |
| 25 | + tags: |
| 26 | + - '**' |
| 27 | + pull_request: |
| 28 | + |
| 29 | +concurrency: |
| 30 | + group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} |
| 31 | + cancel-in-progress: true |
| 32 | + |
| 33 | +permissions: |
| 34 | + contents: read |
| 35 | + |
| 36 | +env: |
| 37 | + DOCKER_VOLUME_PREFIX: ".docker/" |
| 38 | + |
| 39 | +jobs: |
| 40 | + cpp-ubuntu: |
| 41 | + name: Build C++ libraries ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} |
| 42 | + runs-on: ${{ matrix.platform.runs_on }} |
| 43 | + strategy: |
| 44 | + fail-fast: false |
| 45 | + matrix: |
| 46 | + platform: |
| 47 | + - runs_on: ubuntu-latest |
| 48 | + arch: "x86_64" |
| 49 | + archery_arch: "amd64" |
| 50 | + env: |
| 51 | + # architecture name used for archery build |
| 52 | + ARCH: ${{ matrix.platform.archery_arch }} |
| 53 | + permissions: |
| 54 | + contents: read |
| 55 | + packages: write |
| 56 | + steps: |
| 57 | + - name: Checkout apache/arrow-java |
| 58 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 59 | + with: |
| 60 | + fetch-depth: 0 |
| 61 | + submodules: recursive |
| 62 | + - name: Checkout apache/arrow |
| 63 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 64 | + with: |
| 65 | + repository: apache/arrow |
| 66 | + fetch-depth: 0 |
| 67 | + path: arrow |
| 68 | + submodules: recursive |
| 69 | + - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 |
| 70 | + with: |
| 71 | + registry: ghcr.io |
| 72 | + username: ${{ github.actor }} |
| 73 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + - name: Build C++ libraries |
| 75 | + run: | |
| 76 | + docker compose run vcpkg-jni |
| 77 | + - name: Push Docker image |
| 78 | + if: success() && github.event_name == 'push' && github.repository == 'apache/arrow-java' && github.ref_name == 'main' |
| 79 | + run: | |
| 80 | + docker compose push vcpkg-jni |
| 81 | + - name: Compress into single artifact to keep directory structure |
| 82 | + run: tar -cvzf arrow-shared-libs-linux-${{ matrix.platform.arch }}.tar.gz dist/ |
| 83 | + - name: Upload artifacts |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: ubuntu-shared-lib-${{ matrix.platform.arch }} |
| 87 | + path: arrow-shared-libs-linux-${{ matrix.platform.arch }}.tar.gz |
| 88 | + |
| 89 | + cpp-macos: |
| 90 | + name: Build C++ libraries macOS ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }} |
| 91 | + runs-on: ${{ matrix.platform.runs_on }} |
| 92 | + strategy: |
| 93 | + fail-fast: false |
| 94 | + matrix: |
| 95 | + platform: |
| 96 | + - { runs_on: macos-13, arch: "x86_64"} |
| 97 | + - { runs_on: macos-14, arch: "aarch_64" } |
| 98 | + env: |
| 99 | + MACOSX_DEPLOYMENT_TARGET: "14.0" |
| 100 | + steps: |
| 101 | + - name: Checkout apache/arrow-java |
| 102 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 103 | + with: |
| 104 | + fetch-depth: 0 |
| 105 | + submodules: recursive |
| 106 | + - name: Checkout apache/arrow |
| 107 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 108 | + with: |
| 109 | + repository: apache/arrow |
| 110 | + fetch-depth: 0 |
| 111 | + path: arrow |
| 112 | + submodules: recursive |
| 113 | + - name: Set up Python |
| 114 | + uses: actions/setup-python@v4 |
| 115 | + with: |
| 116 | + cache: 'pip' |
| 117 | + python-version: 3.12 |
| 118 | + - name: Install Archery |
| 119 | + run: pip install -e arrow/dev/archery[all] |
| 120 | + - name: Install dependencies |
| 121 | + run: | |
| 122 | + # We want to use llvm@14 to avoid shared z3 |
| 123 | + # dependency. llvm@14 doesn't depend on z3 and llvm depends |
| 124 | + # on z3. And Homebrew's z3 provides only shared library. It |
| 125 | + # doesn't provides static z3 because z3's CMake doesn't accept |
| 126 | + # building both shared and static libraries at once. |
| 127 | + # See also: Z3_BUILD_LIBZ3_SHARED in |
| 128 | + # https://github.com/Z3Prover/z3/blob/master/README-CMake.md |
| 129 | + # |
| 130 | + # If llvm is installed, Apache Arrow C++ uses llvm rather than |
| 131 | + # llvm@14 because llvm is newer than llvm@14. |
| 132 | + brew uninstall llvm || : |
| 133 | +
|
| 134 | + # Ensure updating python@XXX with the "--overwrite" option. |
| 135 | + # If python@XXX is updated without "--overwrite", it causes |
| 136 | + # a conflict error. Because Python 3 installed not by |
| 137 | + # Homebrew exists in /usr/local on GitHub Actions. If |
| 138 | + # Homebrew's python@XXX is updated without "--overwrite", it |
| 139 | + # tries to replace /usr/local/bin/2to3 and so on and causes |
| 140 | + # a conflict error. |
| 141 | + brew update |
| 142 | + for python_package in $(brew list | grep python@); do |
| 143 | + brew install --overwrite ${python_package} |
| 144 | + done |
| 145 | + brew install --overwrite python |
| 146 | +
|
| 147 | + if [ "$(uname -m)" = "arm64" ]; then |
| 148 | + # pkg-config formula is deprecated but it's still installed |
| 149 | + # in GitHub Actions runner now. We can remove this once |
| 150 | + # pkg-config formula is removed from GitHub Actions runner. |
| 151 | + brew uninstall pkg-config || : |
| 152 | + brew uninstall [email protected] || : |
| 153 | + fi |
| 154 | +
|
| 155 | + brew bundle --file=arrow/cpp/Brewfile |
| 156 | + # We want to link aws-sdk-cpp statically but Homebrew's |
| 157 | + # aws-sdk-cpp provides only shared library. If we have |
| 158 | + # Homebrew's aws-sdk-cpp, our build mix Homebrew's |
| 159 | + # aws-sdk-cpp and bundled aws-sdk-cpp. We uninstall Homebrew's |
| 160 | + # aws-sdk-cpp to ensure using only bundled aws-sdk-cpp. |
| 161 | + brew uninstall aws-sdk-cpp |
| 162 | + # We want to use bundled RE2 for static linking. If |
| 163 | + # Homebrew's RE2 is installed, its header file may be used. |
| 164 | + # We uninstall Homebrew's RE2 to ensure using bundled RE2. |
| 165 | + brew uninstall grpc || : # gRPC depends on RE2 |
| 166 | + brew uninstall [email protected] || : # gRPC 1.54 may be installed too |
| 167 | + brew uninstall re2 |
| 168 | + # We want to use bundled Protobuf for static linking. If |
| 169 | + # Homebrew's Protobuf is installed, its library file may be |
| 170 | + # used on test We uninstall Homebrew's Protobuf to ensure using |
| 171 | + # bundled Protobuf. |
| 172 | + brew uninstall protobuf |
| 173 | +
|
| 174 | + brew bundle --file=Brewfile |
| 175 | + - name: Build C++ libraries |
| 176 | + run: | |
| 177 | + set -e |
| 178 | + # make brew Java available to CMake |
| 179 | + export JAVA_HOME=$(brew --prefix openjdk@11)/libexec/openjdk.jdk/Contents/Home |
| 180 | + ./ci/scripts/jni_macos_build.sh \ |
| 181 | + $GITHUB_WORKSPACE \ |
| 182 | + $GITHUB_WORKSPACE/arrow \ |
| 183 | + $GITHUB_WORKSPACE/arrow-java/cpp-build \ |
| 184 | + $GITHUB_WORKSPACE/dist |
| 185 | + - name: Compress into single artifact to keep directory structure |
| 186 | + run: tar -cvzf arrow-shared-libs-macos-${{ matrix.platform.arch }}.tar.gz dist/ |
| 187 | + - name: Upload artifacts |
| 188 | + uses: actions/upload-artifact@v4 |
| 189 | + with: |
| 190 | + name: macos-shared-lib-${{ matrix.platform.arch }} |
| 191 | + path: arrow-shared-libs-macos-${{ matrix.platform.arch }}.tar.gz |
| 192 | + |
| 193 | + java-jars: |
| 194 | + name: Build JAR files |
| 195 | + runs-on: ubuntu-latest |
| 196 | + needs: |
| 197 | + - cpp-ubuntu |
| 198 | + - cpp-macos |
| 199 | + steps: |
| 200 | + - name: Checkout apache/arrow-java |
| 201 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 202 | + with: |
| 203 | + fetch-depth: 0 |
| 204 | + submodules: recursive |
| 205 | + - name: Checkout apache/arrow |
| 206 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 207 | + with: |
| 208 | + repository: apache/arrow |
| 209 | + fetch-depth: 0 |
| 210 | + path: arrow |
| 211 | + submodules: recursive |
| 212 | + - name: Download Libraries |
| 213 | + uses: actions/download-artifact@v4 |
| 214 | + with: |
| 215 | + path: artifacts |
| 216 | + - name: Decompress artifacts |
| 217 | + run: | |
| 218 | + mv artifacts/*/*.tar.gz . |
| 219 | + tar -xvzf arrow-shared-libs-linux-x86_64.tar.gz |
| 220 | + # tar -xvzf arrow-shared-libs-linux-aarch_64.tar.gz |
| 221 | + tar -xvzf arrow-shared-libs-macos-x86_64.tar.gz |
| 222 | + tar -xvzf arrow-shared-libs-macos-aarch_64.tar.gz |
| 223 | + # tar -xvzf arrow-shared-libs-windows.tar.gz |
| 224 | + - name: Test that shared libraries exist |
| 225 | + run: | |
| 226 | + set -x |
| 227 | +
|
| 228 | + test -f dist/arrow_cdata_jni/x86_64/libarrow_cdata_jni.so |
| 229 | + test -f dist/arrow_dataset_jni/x86_64/libarrow_dataset_jni.so |
| 230 | + test -f dist/arrow_orc_jni/x86_64/libarrow_orc_jni.so |
| 231 | + test -f dist/gandiva_jni/x86_64/libgandiva_jni.so |
| 232 | +
|
| 233 | + # test -f dist/arrow_cdata_jni/aarch_64/libarrow_cdata_jni.so |
| 234 | + # test -f dist/arrow_dataset_jni/aarch_64/libarrow_dataset_jni.so |
| 235 | + # test -f dist/arrow_orc_jni/aarch_64/libarrow_orc_jni.so |
| 236 | + # test -f dist/gandiva_jni/aarch_64/libgandiva_jni.so |
| 237 | +
|
| 238 | + test -f dist/arrow_cdata_jni/x86_64/libarrow_cdata_jni.dylib |
| 239 | + test -f dist/arrow_dataset_jni/x86_64/libarrow_dataset_jni.dylib |
| 240 | + test -f dist/arrow_orc_jni/x86_64/libarrow_orc_jni.dylib |
| 241 | + test -f dist/gandiva_jni/x86_64/libgandiva_jni.dylib |
| 242 | +
|
| 243 | + test -f dist/arrow_cdata_jni/aarch_64/libarrow_cdata_jni.dylib |
| 244 | + test -f dist/arrow_dataset_jni/aarch_64/libarrow_dataset_jni.dylib |
| 245 | + test -f dist/arrow_orc_jni/aarch_64/libarrow_orc_jni.dylib |
| 246 | + test -f dist/gandiva_jni/aarch_64/libgandiva_jni.dylib |
| 247 | +
|
| 248 | + # test -f dist/arrow_cdata_jni/x86_64/arrow_cdata_jni.dll |
| 249 | + # test -f dist/arrow_dataset_jni/x86_64/arrow_dataset_jni.dll |
| 250 | + # test -f dist/arrow_orc_jni/x86_64/arrow_orc_jni.dll |
| 251 | + - name: Build bundled jar |
| 252 | + env: |
| 253 | + MAVEN_ARGS: >- |
| 254 | + --no-transfer-progress |
| 255 | + run: | |
| 256 | + set -e |
| 257 | + # mvn versions:set -DnewVersion={{ arrow.no_rc_snapshot_version }} |
| 258 | + # mvn versions:set -DnewVersion={{ arrow.no_rc_snapshot_version }} -f bom |
| 259 | + ./ci/scripts/jni_full_build.sh \ |
| 260 | + $GITHUB_WORKSPACE \ |
| 261 | + $GITHUB_WORKSPACE/arrow \ |
| 262 | + $GITHUB_WORKSPACE/dist |
| 263 | + - name: Upload artifacts |
| 264 | + uses: actions/upload-artifact@v4 |
| 265 | + with: |
| 266 | + name: java-jars |
| 267 | + path: ${{ github.workspace }}/arrow-java/java-dist |
0 commit comments