Skip to content

Commit fd49f83

Browse files
authored
Add linter analysis workflow (#9)
1 parent 3c41cc8 commit fd49f83

File tree

2 files changed

+77
-4
lines changed

2 files changed

+77
-4
lines changed

.github/workflows/analysis.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: cpp-linter-analysis
2+
3+
on: [push, pull_request]
4+
5+
defaults:
6+
run:
7+
shell: bash -e -l {0}
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-24.04
12+
13+
steps:
14+
# Set up Clang and LLVM
15+
- name: Install LLVM and Clang
16+
run: |
17+
wget https://apt.llvm.org/llvm.sh
18+
chmod +x llvm.sh
19+
sudo ./llvm.sh 20
20+
sudo apt-get install -y clang-tools-20
21+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 200
22+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 200
23+
sudo update-alternatives --install /usr/bin/clang-scan-deps clang-scan-deps /usr/bin/clang-scan-deps-20 200
24+
sudo update-alternatives --set clang /usr/bin/clang-20
25+
sudo update-alternatives --set clang++ /usr/bin/clang++-20
26+
sudo update-alternatives --set clang-scan-deps /usr/bin/clang-scan-deps-20
27+
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
# Set conda environment using setup-micromamba
32+
- name: Set conda environment
33+
uses: mamba-org/setup-micromamba@main
34+
with:
35+
environment-name: myenv
36+
environment-file: environment-dev.yml
37+
init-shell: bash
38+
cache-downloads: true
39+
40+
# Run CMake configuration
41+
- name: Configure using CMake
42+
run: |
43+
export CC=clang; export CXX=clang++
44+
cmake -G Ninja \
45+
-Bbuild \
46+
-DCMAKE_BUILD_TYPE=Release \
47+
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
48+
-DSPARROW_IPC_BUILD_TESTS=ON \
49+
-DSPARROW_IPC_BUILD_INTEGRATION_TESTS=ON \
50+
-DSPARROW_IPC_BUILD_EXAMPLES=ON \
51+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
52+
53+
# Build sparrow-ipc to have the generated flatbuffers files available
54+
- name: Build sparrow-ipc
55+
working-directory: build
56+
run: cmake --build . --target sparrow-ipc
57+
58+
# Run Clang-Tidy and Clang-Format Analysis
59+
- name: Run C++ analysis
60+
uses: cpp-linter/cpp-linter-action@v2
61+
id: linter
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
version: 20
66+
files-changed-only: false # check all files
67+
database: 'build'
68+
style: 'file' # Use .clang-format config file
69+
tidy-checks: '' # Use .clang-tidy config file
70+
step-summary: true
71+
ignore: build
72+
extra-args: '-std=c++20 -I${{ github.workspace }}/build/generated'

include/sparrow_ipc/compression.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <cstdint>
4+
#include <memory>
45
#include <optional>
56
#include <span>
67
#include <variant>
@@ -10,7 +11,7 @@
1011

1112
namespace sparrow_ipc
1213
{
13-
enum class CompressionType
14+
enum class CompressionType : std::uint8_t
1415
{
1516
LZ4_FRAME,
1617
ZSTD
@@ -33,9 +34,9 @@ namespace sparrow_ipc
3334
std::optional<std::span<const std::uint8_t>> find(const void* data_ptr, const size_t data_size);
3435
std::span<const std::uint8_t> store(const void* data_ptr, const size_t data_size, std::vector<std::uint8_t>&& data);
3536

36-
size_t size() const;
37-
size_t count(const void* data_ptr, const size_t data_size) const;
38-
bool empty() const;
37+
[[nodiscard]] size_t size() const;
38+
[[nodiscard]] size_t count(const void* data_ptr, const size_t data_size) const;
39+
[[nodiscard]] bool empty() const;
3940
void clear();
4041

4142
private:

0 commit comments

Comments
 (0)