forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (137 loc) · 4.63 KB
/
CodeQuality.yml
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
154
155
156
157
158
159
160
161
162
name: CodeQuality
on:
workflow_dispatch:
repository_dispatch:
push:
branches:
- '**'
- '!master'
- '!feature'
tags:
- '**'
paths-ignore:
- '**.md'
- '.github/workflows/**'
- '!.github/workflows/CodeQuality.yml'
pull_request:
paths-ignore:
- '**.md'
- '.github/workflows/**'
- '!.github/workflows/CodeQuality.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/master' || github.sha }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
format-check:
name: Format Check
runs-on: ubuntu-20.04
env:
CC: gcc-10
CXX: g++-10
GEN: ninja
steps:
- uses: actions/checkout@v3
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 && sudo pip3 install cmake-format
- name: Format Check
shell: bash
run: |
clang-format --version
clang-format --dump-config
make format-check-silent
tidy-check:
name: Tidy Check
runs-on: ubuntu-20.04
needs: format-check
env:
CC: gcc-10
CXX: g++-10
GEN: ninja
TIDY_THREADS: 4
steps:
- uses: actions/checkout@v3
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]
- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
with:
key: ${{ github.job }}
save: ${{ github.ref == 'refs/heads/master' || github.repository != 'duckdb/duckdb' }}
- name: Download clang-tidy-cache
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
run: make tidy-check TIDY_BINARY=/tmp/clang-tidy-cache
codecov:
name: Code Coverage
runs-on: ubuntu-20.04
needs: format-check
strategy:
fail-fast: false
env:
GEN: ninja
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
shell: bash
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build lcov curl g++ zip
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Coverage Reset
shell: bash
run: |
lcov --config-file .github/workflows/lcovrc --zerocounters --directory .
lcov --config-file .github/workflows/lcovrc --capture --initial --directory . --base-directory . --no-external --output-file coverage.info
- name: Build
shell: bash
run: |
mkdir -p build/coverage
(cd build/coverage && cmake -E env CXXFLAGS="--coverage" cmake -DBUILD_PARQUET_EXTENSION=1 -DBUILD_ICU_EXTENSION=1 -DBUILD_JSON_EXTENSION=1 -DBUILD_JEMALLOC_EXTENSION=1 -DBUILD_AUTOCOMPLETE_EXTENSION=1 -DENABLE_SANITIZER=0 -DCMAKE_BUILD_TYPE=Debug ../.. && make)
- name: Run Tests
shell: bash
run: |
build/coverage/test/unittest
build/coverage/test/unittest "[intraquery]"
build/coverage/test/unittest "[interquery]"
build/coverage/test/unittest "[detailed_profiler]"
build/coverage/test/unittest test/sql/tpch/tpch_sf01.test_slow
build/coverage/tools/sqlite3_api_wrapper/test_sqlite3_api_wrapper
python tools/shell/shell-test.py build/coverage/duckdb
- name: Generate Coverage
shell: bash
run: |
lcov --config-file .github/workflows/lcovrc --directory . --base-directory . --no-external --capture --output-file coverage.info
lcov --config-file .github/workflows/lcovrc --remove coverage.info $(< .github/workflows/lcov_exclude) -o lcov.info
genhtml -o coverage_html lcov.info
- name: Check Coverage
shell: bash
run: |
python3 scripts/check_coverage.py
- name: Create Archive
if: always()
shell: bash
run: |
zip -r coverage.zip coverage_html
- uses: actions/upload-artifact@v3
if: always()
with:
name: coverage
path: coverage.zip
if-no-files-found: error