|
| 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: PR Build |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +on: |
| 25 | + push: |
| 26 | + paths-ignore: |
| 27 | + - "doc/**" |
| 28 | + - "**.md" |
| 29 | + pull_request: |
| 30 | + paths-ignore: |
| 31 | + - "doc/**" |
| 32 | + - "**.md" |
| 33 | + # manual trigger |
| 34 | + # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow |
| 35 | + workflow_dispatch: |
| 36 | + |
| 37 | +env: |
| 38 | + JAVA_VERSION: 17 |
| 39 | + |
| 40 | +jobs: |
| 41 | + linux-rust-test: |
| 42 | + name: Rust test (amd64) |
| 43 | + runs-on: ubuntu-latest |
| 44 | + container: |
| 45 | + image: amd64/rust |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - name: Setup Rust & Java toolchain |
| 49 | + uses: ./.github/actions/setup-builder |
| 50 | + with: |
| 51 | + rust-version: nightly |
| 52 | + jdk-version: ${{env.JAVA_VERSION}} |
| 53 | + |
| 54 | + - name: Check cargo fmt |
| 55 | + run: | |
| 56 | + cd core |
| 57 | + cargo fmt --all -- --check --color=never |
| 58 | +
|
| 59 | + - name: Check cargo clippy |
| 60 | + run: | |
| 61 | + cd core |
| 62 | + cargo clippy --color=never -- -D warnings |
| 63 | +
|
| 64 | + - name: Check compilation |
| 65 | + run: | |
| 66 | + cd core |
| 67 | + cargo check --benches |
| 68 | +
|
| 69 | + - name: Setup JAVA_HOME |
| 70 | + run: | |
| 71 | + echo "JAVA_HOME=/usr/lib/jvm/java-${{env.JAVA_VERSION}}-openjdk-amd64" >> $GITHUB_ENV |
| 72 | +
|
| 73 | + - name: Cache Maven dependencies |
| 74 | + uses: actions/cache@v4 |
| 75 | + with: |
| 76 | + path: ~/.m2/repository |
| 77 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 78 | + restore-keys: | |
| 79 | + ${{ runner.os }}-maven- |
| 80 | +
|
| 81 | + - name: Build common module (pre-requisite for Rust tests) |
| 82 | + run: | |
| 83 | + cd common |
| 84 | + ../mvnw clean compile -DskipTests |
| 85 | +
|
| 86 | + - name: Run cargo test |
| 87 | + run: | |
| 88 | + cd core |
| 89 | + # This is required to run some JNI related tests on the Rust side |
| 90 | + RUST_BACKTRACE=1 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAVA_HOME/lib:$JAVA_HOME/lib/server cargo test |
| 91 | +
|
| 92 | + linux-java-test: |
| 93 | + name: Java test (amd64) |
| 94 | + runs-on: ubuntu-latest |
| 95 | + container: |
| 96 | + image: amd64/rust |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@v4 |
| 99 | + - name: Setup Rust & Java toolchain |
| 100 | + uses: ./.github/actions/setup-builder |
| 101 | + with: |
| 102 | + rust-version: nightly |
| 103 | + jdk-version: ${{env.JAVA_VERSION}} |
| 104 | + |
| 105 | + - name: Run cargo build |
| 106 | + run: | |
| 107 | + cd core |
| 108 | + cargo build |
| 109 | +
|
| 110 | + - name: Setup JAVA_HOME |
| 111 | + run: | |
| 112 | + echo "JAVA_HOME=/usr/lib/jvm/java-${{env.JAVA_VERSION}}-openjdk-amd64" >> $GITHUB_ENV |
| 113 | +
|
| 114 | + - name: Cache Maven dependencies |
| 115 | + uses: actions/cache@v4 |
| 116 | + with: |
| 117 | + path: ~/.m2/repository |
| 118 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 119 | + restore-keys: | |
| 120 | + ${{ runner.os }}-maven- |
| 121 | +
|
| 122 | + - name: Run Maven compile |
| 123 | + run: | |
| 124 | + ./mvnw compile test-compile scalafix:scalafix -Psemanticdb |
| 125 | +
|
| 126 | + - name: Run tests |
| 127 | + run: | |
| 128 | + SPARK_HOME=`pwd` ./mvnw clean install |
0 commit comments