-
Notifications
You must be signed in to change notification settings - Fork 119
130 lines (126 loc) · 4.65 KB
/
Copy pathcpp-linter.yml
File metadata and controls
130 lines (126 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: C++ Linter
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
paths-ignore:
- '.asf.yaml'
- '.devcontainer/**'
- '.github/**'
- '**/*.md'
- 'ci/**'
- 'cmake_modules/**'
- 'dev/**'
- 'mkdocs/**'
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
cpp-linter:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
runs-on: ubuntu-26.04
permissions:
contents: read
pull-requests: write
env:
CPP_LINTER_VERSION: "1.13.0"
# clang-format is handled by the pre-commit workflow; cpp-linter runs
# clang-tidy only.
CLANG_TIDY_VERSION: "22.1.8"
steps:
- name: Checkout iceberg-cpp
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libsqlite3-dev libpq-dev default-libmysqlclient-dev
- name: Set up sccache
uses: ./.github/actions/setup-sccache
with:
key-prefix: sccache-cpp-linter-ubuntu
- name: Run build
env:
CC: gcc-14
CXX: g++-14
run: |
mkdir build && cd build
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DICEBERG_BUILD_SQL_CATALOG=ON \
-DICEBERG_BUILD_BENCHMARKS=ON \
-DICEBERG_SQL_SQLITE=ON \
-DICEBERG_SQL_POSTGRESQL=ON \
-DICEBERG_SQL_MYSQL=ON \
-DICEBERG_BUILD_HIVE=ON
cmake --build .
- name: Save sccache
if: always()
uses: ./.github/actions/save-sccache
with:
key-prefix: sccache-cpp-linter-ubuntu
job-status: ${{ job.status }}
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
if: github.event_name == 'pull_request'
with:
python-version: '3.13'
- name: Install cpp-linter and clang tools
if: github.event_name == 'pull_request'
run: |
python -m pip install --upgrade pip
python -m pip install "cpp-linter==${CPP_LINTER_VERSION}" "clang-tidy==${CLANG_TIDY_VERSION}"
- name: Run cpp-linter
id: linter
if: github.event_name == 'pull_request'
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# need '-fno-builtin-std-forward_like', see https://github.com/llvm/llvm-project/issues/101614
run: |
cpp-linter \
--style='' \
--tidy-checks='' \
--version="${pythonLocation}/bin" \
--files-changed-only=true \
--lines-changed-only=true \
--thread-comments=true \
--ignore='build|cmake_modules|ci|src/iceberg/catalog/hive/gen-cpp' \
--database=build \
--verbosity=debug \
--extra-arg='-std=c++23' \
--extra-arg="-I${PWD}/src" \
--extra-arg="-I${PWD}/build/src" \
--extra-arg="-I${PWD}/build/_deps/sqlpp23-src/include" \
--extra-arg='-I/usr/include/postgresql' \
--extra-arg='-I/usr/include/mysql' \
--extra-arg='-fno-builtin-std-forward_like'
- name: Fail fast?!
if: github.event_name == 'pull_request' && steps.linter.outputs.checks-failed != 0
run: |
echo "some linter checks failed. ${STEPS_LINTER_OUTPUTS_CHECKS_FAILED}"
exit 1
env:
STEPS_LINTER_OUTPUTS_CHECKS_FAILED: ${{ steps.linter.outputs.checks-failed }}