Skip to content

Commit 1f92d5a

Browse files
authored
Bump dependencies and improve workflows (#64)
- Bump Catch2 from 3.2.1 to 3.3.2 - Update libtins from 4.4 to 4.5, add missing #include to fix compilation errors after bump - Fix Conan setup and caching in workflows with setup-conan action - Correct use of Conan profiles, options, and cache paths for Conan 2 - Update Dockerfile to properly install Conan and use toolchain generation - Adjust CMakeLists.txt module path and target options for correctness and clarity This commit improves stability and alignment with Conan 2 and GitHub Actions best practices, cleaning up versions and build workflow flags.
1 parent 7aec365 commit 1f92d5a

File tree

6 files changed

+63
-61
lines changed

6 files changed

+63
-61
lines changed

.github/workflows/binaries.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,56 @@ jobs:
66
linux:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
10-
- uses: actions/cache@v3
9+
- uses: actions/checkout@v4
10+
- name: Setup Conan Client
11+
uses: conan-io/setup-conan@v1
1112
with:
12-
path: ~/.conan/data
13-
key: binaries-${{ runner.os }}-x86_64
13+
version: '2.21.0'
14+
cache_packages: true # automatically cache Conan packages
1415
- name: Install dependencies
15-
run: |
16-
sudo apt update
17-
sudo apt install --yes build-essential cmake ninja-build python3-pip
18-
pip3 install "conan<2.0"
16+
run: sudo apt update && sudo apt install --yes build-essential cmake ninja-build
17+
- name: Install Conan dependencies
18+
run: conan install . --build=missing -s compiler=gcc -s compiler.version=10 -s compiler.cppstd=20 -s build_type=Release
1919
- name: Configure project
20-
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_BINARY=ON -DWITH_CONAN=ON
20+
run: cmake -S . -B build -G Ninja -DWITH_BINARY=ON -DWITH_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
2121
- name: Build executable
2222
run: |
2323
cmake --build build --target caracal-bin
2424
mv build/caracal build/caracal-linux-amd64
25-
- uses: actions/upload-artifact@v3
25+
- uses: actions/upload-artifact@v4.6.2
2626
with:
27+
name: caracal-linux-amd64-${{ runner.os }}
2728
path: build/caracal-linux-amd64
2829

2930
macos:
3031
runs-on: macos-latest
3132
steps:
32-
- uses: actions/checkout@v3
33-
- uses: actions/cache@v3
33+
- uses: actions/checkout@v4
34+
- name: Setup Conan Client
35+
uses: conan-io/setup-conan@v1
3436
with:
35-
path: ~/.conan/data
36-
key: binaries-${{ runner.os }}-x86_64
37+
version: '2.21.0'
38+
cache_packages: true
3739
- name: Install dependencies
3840
run: brew install cmake ninja
39-
- name: Install Conan
40-
run: pip3 install "conan<2.0"
41-
# For some unknown reasons bison fails to build on GitHub macOS 12 runners.
42-
# However, if we call conan twice, it seems to work...¯\(◉‿◉)/¯
41+
- name: Install Conan dependencies
42+
run: conan install . --build=missing -s compiler=apple-clang -s compiler.version=17 -s compiler.cppstd=20 -s build_type=Release
4343
- name: Configure project
44-
run: |
45-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_BINARY=ON -DWITH_CONAN=ON || true
46-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_BINARY=ON -DWITH_CONAN=ON
44+
run: cmake -S . -B build -G Ninja -DWITH_BINARY=ON -DWITH_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
4745
- name: Build executable
4846
run: |
4947
cmake --build build --target caracal-bin
5048
mv build/caracal build/caracal-macos-amd64
51-
- uses: actions/upload-artifact@v3
49+
- uses: actions/upload-artifact@v4.6.2
5250
with:
51+
name: caracal-macos-amd64-${{ runner.os }}
5352
path: build/caracal-macos-amd64
5453

5554
release:
5655
needs: [ linux, macos ]
5756
runs-on: ubuntu-latest
5857
steps:
59-
- uses: actions/download-artifact@v3
58+
- uses: actions/download-artifact@v4.1.7
6059
- uses: softprops/action-gh-release@v1
6160
if: startsWith(github.ref, 'refs/tags/')
6261
with:

.github/workflows/tests.yml

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
docker:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
- name: Build Docker image
1111
run: docker build --tag caracal .
1212
- name: Test Docker image
@@ -15,7 +15,7 @@ jobs:
1515
nix:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- uses: cachix/install-nix-action@v20
2020
- uses: cachix/cachix-action@v12
2121
with:
@@ -27,48 +27,45 @@ jobs:
2727
linux:
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v3
31-
- uses: actions/cache@v3
30+
- uses: actions/checkout@v4
31+
- name: Setup Conan Client
32+
uses: conan-io/setup-conan@v1
3233
with:
33-
path: ~/.conan/data
34-
key: tests-${{ runner.os }}-x86_64
34+
version: '2.21.0'
35+
cache_packages: true # automatically cache Conan packages
3536
- name: Install dependencies
36-
run: |
37-
sudo apt update
38-
sudo apt install --yes build-essential cmake gcovr ninja-build python3-pip
39-
pip3 install "conan<2.0"
37+
run: sudo apt update && sudo apt install --yes build-essential cmake gcovr ninja-build python3-pip
38+
- name: Install Conan dependencies
39+
run: conan install . --output-folder=build --build=missing -s compiler=gcc -s compiler.version=10 -s compiler.cppstd=20 -s build_type=Debug
4040
- name: Configure project
41-
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
41+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake
4242
- name: Build tests
4343
run: cmake --build build --target caracal-test
4444
- name: Run tests
4545
run: sudo --preserve-env=CI build/caracal-test --benchmark-warmup-time 0 --benchmark-samples 1
4646
- name: Compute coverage
4747
run: gcovr --exclude-unreachable-branches --exclude-throw-branches --exclude apps --exclude extern --exclude tests --output coverage.xml --xml
48-
- uses: codecov/codecov-action@v3
48+
- uses: codecov/codecov-action@v5
4949

5050
macos:
5151
runs-on: macos-latest
5252
steps:
53-
- uses: actions/checkout@v3
54-
- uses: actions/cache@v3
53+
- uses: actions/checkout@v4
54+
- name: Setup Conan Client
55+
uses: conan-io/setup-conan@v1
5556
with:
56-
path: ~/.conan/data
57-
key: tests-${{ runner.os }}-x86_64
57+
version: '2.21.0'
58+
cache_packages: true
5859
- name: Install dependencies
59-
run: brew install cmake gcovr ninja
60-
- name: Install Conan
61-
run: pip3 install "conan<2.0"
62-
# For some unknown reasons bison fails to build on GitHub macOS 12 runners.
63-
# However, if we call conan twice, it seems to work...¯\(◉‿◉)/¯
60+
run: brew install cmake gcovr ninja python3
61+
- name: Install Conan dependencies
62+
run: conan install . --output-folder=build --build=missing -s compiler=apple-clang -s compiler.version=17 -s compiler.cppstd=20 -s build_type=Debug
6463
- name: Configure project
65-
run: |
66-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON || true
67-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
64+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake
6865
- name: Build tests
6966
run: cmake --build build --target caracal-test
7067
- name: Run tests
7168
run: sudo --preserve-env=CI build/caracal-test --benchmark-warmup-time 0 --benchmark-samples 1
7269
- name: Compute coverage
7370
run: gcovr --exclude-unreachable-branches --exclude-throw-branches --exclude apps --exclude extern --exclude tests --output coverage.xml --xml
74-
- uses: codecov/codecov-action@v3
71+
- uses: codecov/codecov-action@v5

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
cmake_minimum_required(VERSION 3.16)
22
project(caracal VERSION 0.15.3)
33

4-
# We have Find* modules in two places:
5-
# - The build directory, for the libraries fetched by Conan
6-
# - The cmake/ directory, for the libraries not available with Conan
7-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
4+
# We have Find* modules in the cmake/ directory, for the libraries not available with Conan
85
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
96

107
set(CARACAL_PRIVATE_FLAGS -Wall -Wextra -pedantic)

Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ RUN apt-get update && \
1111
rm --force --recursive /var/lib/apt/lists/*
1212

1313
# hadolint ignore=DL3059
14-
RUN python3 -m pip install --no-cache-dir build "conan>=1.35,<2.0"
14+
RUN python3 -m pip install --no-cache-dir "conan>=1.35,<2.0"
1515

1616
WORKDIR /tmp
1717
COPY . .
1818

19-
RUN cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_CONAN=ON -DWITH_BINARY=ON && \
19+
# Run Conan install first to generate toolchain and install dependencies
20+
RUN conan install . --build=missing -g CMakeToolchain -s compiler=gcc -s compiler.version=10 -s compiler.cppstd=20 -s build_type=Release
21+
22+
# Run CMake configure and build, passing the Conan toolchain explicitly
23+
RUN cmake -S . -B build -G Ninja \
24+
-DCMAKE_BUILD_TYPE=Release \
25+
-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \
26+
-DWITH_BINARY=ON && \
2027
cmake --build build --target caracal-bin
2128

2229
# Main

conanfile.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[requires]
2-
catch2/3.2.1
2+
catch2/3.3.2
33
cxxopts/3.0.0
4-
libtins/4.4
4+
libtins/4.5
55
spdlog/1.10.0
66

77
[generators]
8-
cmake_find_package
8+
CMakeDeps
9+
CMakeToolchain
910

1011
[options]
11-
libtins:with_ack_tracker=False
12-
libtins:with_tcp_stream_custom_data=False
13-
libtins:with_dot11=False
14-
libtins:with_wpa2=False
12+
libtins/*:with_ack_tracker=False
13+
libtins/*:with_tcp_stream_custom_data=False
14+
libtins/*:with_dot11=False
15+
libtins/*:with_wpa2=False

src/reply.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <spdlog/fmt/fmt.h>
22
#include <spdlog/fmt/ostr.h>
33

4+
#include <algorithm>
45
#include <caracal/checksum.hpp>
56
#include <caracal/constants.hpp>
67
#include <caracal/pretty.hpp>

0 commit comments

Comments
 (0)