|
| 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 | +# Reusable workflow invoked by build_main.yml. Modelled on Apache Spark's |
| 19 | +# build_and_test.yml: the heavy work runs wherever the calling push lands, |
| 20 | +# i.e. on the contributor's fork. Currently runs only the sql_core-1 shard. |
| 21 | + |
| 22 | +name: Build and test |
| 23 | + |
| 24 | +on: |
| 25 | + workflow_call: |
| 26 | + inputs: |
| 27 | + spark-short: |
| 28 | + description: 'Spark minor version, e.g. 3.5' |
| 29 | + required: false |
| 30 | + type: string |
| 31 | + default: '3.5' |
| 32 | + spark-full: |
| 33 | + description: 'Spark full version, e.g. 3.5.8' |
| 34 | + required: false |
| 35 | + type: string |
| 36 | + default: '3.5.8' |
| 37 | + java: |
| 38 | + description: 'JDK major version' |
| 39 | + required: false |
| 40 | + type: number |
| 41 | + default: 11 |
| 42 | + |
| 43 | +env: |
| 44 | + RUST_VERSION: stable |
| 45 | + RUST_BACKTRACE: 1 |
| 46 | + RUSTFLAGS: "-Clink-arg=-fuse-ld=bfd" |
| 47 | + |
| 48 | +jobs: |
| 49 | + build-native: |
| 50 | + name: Build Native Library |
| 51 | + runs-on: ubuntu-24.04 |
| 52 | + container: |
| 53 | + image: amd64/rust |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v6 |
| 56 | + |
| 57 | + - name: Setup Rust toolchain |
| 58 | + uses: ./.github/actions/setup-builder |
| 59 | + with: |
| 60 | + rust-version: ${{ env.RUST_VERSION }} |
| 61 | + jdk-version: 17 |
| 62 | + |
| 63 | + - name: Restore Cargo cache |
| 64 | + uses: actions/cache/restore@v5 |
| 65 | + with: |
| 66 | + path: | |
| 67 | + ~/.cargo/registry |
| 68 | + ~/.cargo/git |
| 69 | + native/target |
| 70 | + key: ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-${{ hashFiles('native/**/*.rs') }} |
| 71 | + restore-keys: | |
| 72 | + ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}- |
| 73 | +
|
| 74 | + - name: Build native library (CI profile) |
| 75 | + run: | |
| 76 | + cd native |
| 77 | + cargo build --profile ci |
| 78 | + env: |
| 79 | + RUSTFLAGS: "-Ctarget-cpu=x86-64-v3 -Clink-arg=-fuse-ld=bfd" |
| 80 | + |
| 81 | + - name: Upload native library |
| 82 | + uses: actions/upload-artifact@v7 |
| 83 | + with: |
| 84 | + name: native-lib-linux |
| 85 | + path: native/target/ci/libcomet.so |
| 86 | + retention-days: 1 |
| 87 | + |
| 88 | + - name: Save Cargo cache |
| 89 | + uses: actions/cache/save@v5 |
| 90 | + if: github.ref == 'refs/heads/main' |
| 91 | + with: |
| 92 | + path: | |
| 93 | + ~/.cargo/registry |
| 94 | + ~/.cargo/git |
| 95 | + native/target |
| 96 | + key: ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-${{ hashFiles('native/**/*.rs') }} |
| 97 | + |
| 98 | + sql_core-1: |
| 99 | + needs: build-native |
| 100 | + name: "Build modules: sql_core-1" |
| 101 | + runs-on: ubuntu-24.04 |
| 102 | + container: |
| 103 | + image: amd64/rust |
| 104 | + steps: |
| 105 | + - uses: actions/checkout@v6 |
| 106 | + - name: Setup Rust & Java toolchain |
| 107 | + uses: ./.github/actions/setup-builder |
| 108 | + with: |
| 109 | + rust-version: ${{env.RUST_VERSION}} |
| 110 | + jdk-version: ${{ inputs.java }} |
| 111 | + - name: Download native library |
| 112 | + uses: actions/download-artifact@v8 |
| 113 | + with: |
| 114 | + name: native-lib-linux |
| 115 | + path: native/target/release/ |
| 116 | + - name: Setup Spark |
| 117 | + uses: ./.github/actions/setup-spark-builder |
| 118 | + with: |
| 119 | + spark-version: ${{ inputs.spark-full }} |
| 120 | + spark-short-version: ${{ inputs.spark-short }} |
| 121 | + skip-native-build: true |
| 122 | + - name: Run Spark sql_core-1 tests |
| 123 | + run: | |
| 124 | + cd apache-spark |
| 125 | + rm -rf /root/.m2/repository/org/apache/parquet |
| 126 | + export SERIAL_SBT_TESTS=1 |
| 127 | + NOLINT_ON_COMPILE=true ENABLE_COMET=true ENABLE_COMET_ONHEAP=true \ |
| 128 | + build/sbt -Dsbt.log.noformat=true -mem $SBT_MEM \ |
| 129 | + 'set Global / concurrentRestrictions := Seq(Tags.limit(Tags.ForkedTestGroup, 1))' \ |
| 130 | + "sql/testOnly * -- -l org.apache.spark.tags.ExtendedSQLTest -l org.apache.spark.tags.SlowSQLTest" |
| 131 | + env: |
| 132 | + LC_ALL: "C.UTF-8" |
| 133 | + SBT_MEM: "3072" |
0 commit comments