forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (131 loc) · 4.36 KB
/
CodeQuality.yml
File metadata and controls
153 lines (131 loc) · 4.36 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CodeQuality
on:
workflow_dispatch:
inputs:
explicit_checks:
description: 'Pass which checks to run or remain empty for default checks'
type: string
repository_dispatch:
push:
branches-ignore:
- 'main'
- 'feature'
- 'v*.*-*'
paths-ignore:
- '**.md'
- 'test/configs/**'
- '.github/patches/duckdb-wasm/**'
- '.github/workflows/**'
- '!.github/workflows/lcov_exclude'
- '!.github/workflows/CodeQuality.yml'
- '.github/config/extensions/*.cmake'
- '.github/patches/extensions/**/*.patch'
merge_group:
pull_request:
types: [opened, reopened, ready_for_review, converted_to_draft]
paths-ignore:
- '**.md'
- 'test/configs/**'
- '.github/patches/duckdb-wasm/**'
- '.github/workflows/**'
- '!.github/workflows/lcov_exclude'
- '!.github/workflows/CodeQuality.yml'
- '.github/config/extensions/*.cmake'
- '.github/patches/extensions/**/*.patch'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
check-draft:
# We run all other jobs on PRs only if they are not draft PR
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-24.04
steps:
- name: Preliminary checks on CI
run: echo "Event name is ${{ github.event_name }}"
format-check:
name: Format Check
runs-on: ubuntu-22.04
needs: check-draft
env:
CC: gcc-10
CXX: g++-10
GEN: ninja
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install
shell: bash
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build clang-format-11 && sudo pip3 install cmake-format 'black==24.*' cxxheaderparser pcpp 'clang_format==11.0.1'
- name: List Installed Packages
shell: bash
run: pip3 freeze
- name: Format Check
shell: bash
run: |
clang-format --version
clang-format --dump-config
black --version
make format-check-silent
- name: Generated Check
shell: bash
run: |
make generate-files
git diff --exit-code
enum-check:
name: C Enum Integrity Check
needs: format-check
runs-on: ubuntu-22.04
env:
CC: gcc-10
CXX: g++-10
GEN: ninja
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install python dependencies
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: python -m pip install cxxheaderparser pcpp
- name: Verify C enum integrity
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: python scripts/verify_enum_integrity.py src/include/duckdb.h
tidy-check:
name: Tidy Check
runs-on: ubuntu-24.04
needs: format-check
env:
CC: gcc
CXX: g++
GEN: ninja
TIDY_THREADS: 4
TIDY_CHECKS: ${{ inputs.explicit_checks && inputs.explicit_checks || '' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install
shell: bash
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build clang-tidy && sudo pip3 install pybind11[global] --break-system-packages
- uses: ./.github/actions/ccache-action
- name: Download clang-tidy-cache
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature' }}
shell: bash
run: |
set -e
curl -Lo /tmp/clang-tidy-cache https://github.com/ejfitzgerald/clang-tidy-cache/releases/download/v0.4.0/clang-tidy-cache-linux-amd64
md5sum /tmp/clang-tidy-cache | grep 880b290d7bbe7c1fb2a4f591f9a86cc1
chmod +x /tmp/clang-tidy-cache
- name: Tidy Check
shell: bash
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature' }}
run: make tidy-check TIDY_BINARY=/tmp/clang-tidy-cache
- name: Tidy Check Diff
shell: bash
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/feature' }}
run: DUCKDB_GIT_BASE_BRANCH=${{ github.base_ref }} make tidy-check-diff