|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +# contributor license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright ownership. |
| 4 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 | +# (the "License"); you may not use this file except in compliance with |
| 6 | +# the License. You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +name: Clang Tidy Check |
| 17 | + |
| 18 | +on: |
| 19 | + pull_request: |
| 20 | + paths: |
| 21 | + - '.github/workflows/cpp_clang_tidy.yml' |
| 22 | + - 'cpp/**' |
| 23 | + |
| 24 | +env: |
| 25 | + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true |
| 26 | + MVN_CMD: 'mvn -ntp' |
| 27 | + WGET_CMD: 'wget -nv' |
| 28 | + SETUP: 'source .github/workflows/util/setup-helper.sh' |
| 29 | + CCACHE_DIR: "${{ github.workspace }}/.ccache" |
| 30 | + # spark.sql.ansi.enabled defaults to false. |
| 31 | + SPARK_ANSI_SQL_MODE: false |
| 32 | + |
| 33 | +concurrency: |
| 34 | + group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} |
| 35 | + cancel-in-progress: true |
| 36 | + |
| 37 | +jobs: |
| 38 | + build-native-lib-centos-7: |
| 39 | + runs-on: ubuntu-22.04 |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + - name: Get Ccache |
| 43 | + uses: actions/cache/restore@v4 |
| 44 | + with: |
| 45 | + path: '${{ env.CCACHE_DIR }}' |
| 46 | + key: ccache-centos7-release-default-${{github.sha}} |
| 47 | + restore-keys: | |
| 48 | + ccache-centos7-release-default |
| 49 | + - name: Build Gluten native libraries |
| 50 | + run: | |
| 51 | + docker pull apache/gluten:vcpkg-centos-7 |
| 52 | + docker run -v $GITHUB_WORKSPACE:/work -w /work apache/gluten:vcpkg-centos-7 bash -c " |
| 53 | + set -e |
| 54 | + yum install tzdata -y |
| 55 | + df -a |
| 56 | + cd /work |
| 57 | + export CCACHE_DIR=/work/.ccache |
| 58 | + mkdir -p /work/.ccache |
| 59 | + bash dev/ci-velox-buildstatic-centos-7.sh |
| 60 | + mkdir -p /work/.m2/repository/org/apache/arrow/ |
| 61 | + cp -r /root/.m2/repository/org/apache/arrow/* /work/.m2/repository/org/apache/arrow/ |
| 62 | + " |
| 63 | +
|
| 64 | + - name: "Save ccache" |
| 65 | + uses: actions/cache/save@v4 |
| 66 | + id: ccache |
| 67 | + with: |
| 68 | + path: '${{ env.CCACHE_DIR }}' |
| 69 | + key: ccache-centos7-release-default-${{github.sha}} |
| 70 | + - uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: velox-native-lib-centos-7-${{github.sha}} |
| 73 | + path: ./cpp/build/ |
| 74 | + if-no-files-found: error |
| 75 | + - uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: arrow-jars-centos-7-${{github.sha}} |
| 78 | + path: .m2/repository/org/apache/arrow/ |
| 79 | + if-no-files-found: error |
| 80 | + |
| 81 | + clang-tidy-check: |
| 82 | + needs: build-native-lib-centos-7 |
| 83 | + runs-on: ubuntu-22.04 |
| 84 | + container: apache/gluten:centos-8-jdk8 |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v4 |
| 87 | + with: |
| 88 | + fetch-depth: 0 |
| 89 | + - uses: actions/download-artifact@v4 |
| 90 | + with: |
| 91 | + name: velox-native-lib-centos-7-${{github.sha}} |
| 92 | + path: ./cpp/build/ |
| 93 | + - name: Check Clang Tidy |
| 94 | + run: | |
| 95 | + pip3 install regex |
| 96 | + cd $GITHUB_WORKSPACE/ |
| 97 | + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04.tar.xz |
| 98 | + tar -xvf clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04.tar.xz |
| 99 | + mv clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04/bin/clang-tidy /usr/bin/ |
| 100 | + chmod +x /usr/bin/clang-tidy |
| 101 | + ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5 |
| 102 | + ls /usr/bin/clang-tidy |
| 103 | + clang-tidy -version |
| 104 | + sed -i "s|/work|$(pwd)|g" cpp/build/compile_commands.json |
| 105 | + python3 dev/check.py tidy commit --fix |
| 106 | +
|
0 commit comments