Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/process-linting-results/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
shell: bash
- id: stage
#continue-on-error: true
uses: Thalhammer/patch-generator-action@v2
uses: Thalhammer/patch-generator-action@v3

# Unfortunately the previous action reports a failure so nothing else can run
# partially a limitation on composite actions since `continue-on-error` is not
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/autobahn-ws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ on:
- ".github/actions/**"
- ".github/workflows/autobahn-ws.yml"
env:
CXX: /usr/bin/clang++-15
CC: /usr/bin/clang-15
CXX: /usr/bin/clang++-18
CC: /usr/bin/clang-18
jobs:
autobahn-ws:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Configure
Expand Down
44 changes: 15 additions & 29 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,28 @@ on:
- ".github/workflows/cmake.yml"

env:
CXX: /usr/bin/clang++-12
CC: /usr/bin/clang-12
RUN_ON: ubuntu-20.04
CMAKE_URL: https://cmake.org/files/v3.15/cmake-3.15.7.tar.gz
CXX: /usr/bin/clang++-18
CC: /usr/bin/clang-18
CMAKE_URL: https://cmake.org/files/v3.15/cmake-3.15.7-Linux-x86_64.sh
CMAKE_VERSION: 3.15.7

jobs:
min-req:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Cache CMake
id: cache-cmake
uses: actions/cache@v3
with:
path: cmake-${{ env.CMAKE_VERSION }}
key: ubuntu-20.04-${{ github.job }}-cmake-${{ env.CMAKE_VERSION }}
- name: Build cmake
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: |
wget ${{ env.CMAKE_URL }}
tar -zxf cmake-${{ env.CMAKE_VERSION }}.tar.gz
cd cmake-${{ env.CMAKE_VERSION }}
./bootstrap
make -j $(nproc)
- name: Install cmake
run: |
cd cmake-${{ env.CMAKE_VERSION }}
sudo make install
- name: Build Tests
wget ${{ env.CMAKE_URL }}
chmod +x cmake-${{ env.CMAKE_VERSION }}-Linux-x86_64.sh
./cmake-${{ env.CMAKE_VERSION }}-Linux-x86_64.sh --skip-license
- name: Build & Install
run: |
mkdir build
cd build
cmake .. -DASYNCPP_BUILD_TEST=ON -G 'Unix Makefiles'
cmake --build .
- name: Run Tests
cmake -S . -B build -D ASYNCPP_BUILD_TEST=OFF
cmake --build build
cmake --install build --prefix install
- name: Run Tests
run: |
cd build
./asyncpp_curl-test
cmake -S . -B test_build -D CMAKE_PREFIX_PATH=../install
cmake --build test_build
ctest --test-dir test_build --no-tests=error
41 changes: 19 additions & 22 deletions .github/workflows/compiler-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,39 @@ jobs:
fail-fast: false
matrix:
compiler:
- { tag: "ubuntu-2404_clang-16", name: "Ubuntu 24.04 Clang 16", cxx: "/usr/bin/clang++-16", cc: "/usr/bin/clang-16", runs-on: "ubuntu-24.04" }
- { tag: "ubuntu-2404_clang-17", name: "Ubuntu 24.04 Clang 17", cxx: "/usr/bin/clang++-17", cc: "/usr/bin/clang-17", runs-on: "ubuntu-24.04" }
- { tag: "ubuntu-2404_clang-18", name: "Ubuntu 24.04 Clang 18", cxx: "/usr/bin/clang++-18", cc: "/usr/bin/clang-18", runs-on: "ubuntu-24.04" }
- { tag: "ubuntu-2404_gcc-12", name: "Ubuntu 24.04 G++ 12", cxx: "/usr/bin/g++-12", cc: "/usr/bin/gcc-12", runs-on: "ubuntu-24.04" }
- { tag: "ubuntu-2404_gcc-13", name: "Ubuntu 24.04 G++ 13", cxx: "/usr/bin/g++-13", cc: "/usr/bin/gcc-13", runs-on: "ubuntu-24.04" }
- { tag: "ubuntu-2404_gcc-14", name: "Ubuntu 24.04 G++ 14", cxx: "/usr/bin/g++-14", cc: "/usr/bin/gcc-14", runs-on: "ubuntu-24.04" }
- { tag: "ubuntu-2204_clang-13", name: "Ubuntu 22.04 Clang 13", cxx: "/usr/bin/clang++-13", cc: "/usr/bin/clang-13", runs-on: "ubuntu-22.04" }
- { tag: "ubuntu-2204_clang-14", name: "Ubuntu 22.04 Clang 14", cxx: "/usr/bin/clang++-14", cc: "/usr/bin/clang-14", runs-on: "ubuntu-22.04" }
- { tag: "ubuntu-2204_clang-15", name: "Ubuntu 22.04 Clang 15", cxx: "/usr/bin/clang++-15", cc: "/usr/bin/clang-15", runs-on: "ubuntu-22.04" }
- { tag: "ubuntu-2204_gcc-10", name: "Ubuntu 22.04 G++ 10", cxx: "/usr/bin/g++-10", cc: "/usr/bin/gcc-10", runs-on: "ubuntu-22.04" }
- { tag: "ubuntu-2204_gcc-11", name: "Ubuntu 22.04 G++ 11", cxx: "/usr/bin/g++-11", cc: "/usr/bin/gcc-11", runs-on: "ubuntu-22.04" }
- { tag: "ubuntu-2004_clang-12", name: "Ubuntu 20.04 Clang 12", cxx: "/usr/bin/clang++-12", cc: "/usr/bin/clang-12", runs-on: "ubuntu-20.04" }
- { tag: "ubuntu-2004_clang-11", name: "Ubuntu 20.04 Clang 11", cxx: "/usr/bin/clang++-11", cc: "/usr/bin/clang-11", runs-on: "ubuntu-20.04" }
- { tag: "ubuntu-2004_clang-10", name: "Ubuntu 20.04 Clang 10", cxx: "/usr/bin/clang++-10", cc: "/usr/bin/clang-10", runs-on: "ubuntu-20.04" }
- { tag: "ubuntu-2004_gcc-10", name: "Ubuntu 20.04 G++ 10", cxx: "/usr/bin/g++-10", cc: "/usr/bin/gcc-10", runs-on: "ubuntu-20.04" }
- { tag: "windows-2025_msvc17", name: "Windows Server 2025 MSVC 17", cxx: "", cc: "", runs-on: "windows-2025" }
- { tag: "windows-2022_msvc17", name: "Windows Server 2022 MSVC 17", cxx: "", cc: "", runs-on: "windows-2022" }
- { tag: "windows-2019_msvc16", name: "Windows Server 2019 MSVC 16", cxx: "", cc: "", runs-on: "windows-2019" }
runs-on: ${{ matrix.compiler.runs-on }}
name: Compiler ${{ matrix.compiler.name }}
env:
CXX: ${{ matrix.compiler.cxx }}
CC: ${{ matrix.compiler.cc }}
outputs:
# Because github wants us to suffer we need to list out every output instead of using a matrix statement or some kind of dynamic setting
ubuntu-2404_clang-16: ${{ steps.status.outputs.ubuntu-2404_clang-16 }}
ubuntu-2404_clang-17: ${{ steps.status.outputs.ubuntu-2404_clang-17 }}
ubuntu-2404_clang-18: ${{ steps.status.outputs.ubuntu-2404_clang-18 }}
ubuntu-2404_gcc-12: ${{ steps.status.outputs.ubuntu-2404_gcc-12 }}
ubuntu-2404_gcc-13: ${{ steps.status.outputs.ubuntu-2404_gcc-13 }}
ubuntu-2404_gcc-14: ${{ steps.status.outputs.ubuntu-2404_gcc-14 }}
ubuntu-2204_clang-13: ${{ steps.status.outputs.ubuntu-2204_clang-13 }}
ubuntu-2204_clang-14: ${{ steps.status.outputs.ubuntu-2204_clang-14 }}
ubuntu-2204_clang-15: ${{ steps.status.outputs.ubuntu-2204_clang-15 }}
ubuntu-2204_gcc-10: ${{ steps.status.outputs.ubuntu-2204_gcc-10 }}
ubuntu-2204_gcc-11: ${{ steps.status.outputs.ubuntu-2204_gcc-11 }}
ubuntu-2004_clang-12: ${{ steps.status.outputs.ubuntu-2004_clang-12 }}
ubuntu-2004_clang-11: ${{ steps.status.outputs.ubuntu-2004_clang-11 }}
ubuntu-2004_clang-10: ${{ steps.status.outputs.ubuntu-2004_clang-10 }}
ubuntu-2004_gcc-10: ${{ steps.status.outputs.ubuntu-2004_gcc-10 }}
windows-2025_msvc17: ${{ steps.status.outputs.windows-2025_msvc17 }}
windows-2022_msvc17: ${{ steps.status.outputs.windows-2022_msvc17 }}
windows-2019_msvc16: ${{ steps.status.outputs.windows-2019_msvc16 }}
defaults:
run:
shell: bash -l {0}
Expand All @@ -54,29 +58,23 @@ jobs:
sudo apt install libstdc++-12-dev gcc-12 libgcc-12-dev
- name: Configure
if: contains(matrix.compiler.runs-on, 'ubuntu')
run: cmake -S. -Bbuild -DASYNCPP_BUILD_TEST=ON -DASYNCPP_WITH_ASAN=ON
run: cmake -S. -Bbuild -DASYNCPP_BUILD_TEST=ON -DASYNCPP_WITH_ASAN=ON -DASYNCPP_WITH_TSAN=OFF
- name: Configure
if: contains(matrix.compiler.runs-on, 'ubuntu') != true
run: cmake -S. -Bbuild -DASYNCPP_BUILD_TEST=ON -DASYNCPP_WITH_ASAN=OFF
run: cmake -S. -Bbuild -DASYNCPP_BUILD_TEST=ON -DASYNCPP_WITH_ASAN=OFF -DASYNCPP_WITH_TSAN=OFF
- name: Build
run: cmake --build build --config Debug
- name: Test
working-directory: ${{ github.workspace }}/build
if: contains(matrix.compiler.runs-on, 'windows') != true
run: ./asyncpp_curl-test
- name: Test
if: contains(matrix.compiler.runs-on, 'windows')
working-directory: ${{ github.workspace }}/build
run: Debug/asyncpp_curl-test.exe
run: ctest --test-dir build --output-on-failure --no-tests=error
- name: Update Result
id: status
if: ${{ always() }}
run: echo "${{ matrix.compiler.tag }}=${{ job.status }}" >> $GITHUB_OUTPUT

badge-upload:
if: ${{ github.event_name == 'push' && always() }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && always() }}
needs: [build]
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
name: Publish badges
steps:
- name: Checkout repository
Expand All @@ -86,4 +84,3 @@ jobs:
with:
category: compiler
badges: ${{ toJson(needs.build.outputs) }}

11 changes: 7 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: |
sudo apt-get update && sudo apt-get install clang-format-14
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main" | sudo tee /etc/apt/sources.list.d/llvm.list
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-21 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt update && sudo apt-get install clang-format-21
shopt -s globstar
- uses: actions/checkout@v3
- run: find \( -name "*.h" -or -name "*.cpp" \) -exec clang-format-14 -i {} \;
- run: find \( -name "*.h" -or -name "*.cpp" \) -exec clang-format-21 -i {} \;
- run: find \( -name "*.h" -or -name "*.cpp" \) -exec ./.github/scripts/add-newline-if-missing.sh {} \;
- uses: ./.github/actions/process-linting-results
with:
linter_name: clang-format

cmake-format:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-python@v4.3.0
with:
Expand All @@ -35,7 +38,7 @@ jobs:
linter_name: cmake-format

line-ending:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- run: git add --renormalize .
Expand Down
20 changes: 14 additions & 6 deletions cmake/GetCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,35 @@ else()
OFF
CACHE INTERNAL "" FORCE)
set(BUILD_TESTING OFF)
set(CURL_USE_LIBPSL OFF)

if(WIN32)
set(CMAKE_USE_SCHANNEL
set(CURL_USE_SCHANNEL
ON
CACHE INTERNAL "" FORCE)
else()
set(CMAKE_USE_OPENSSL
set(CURL_USE_OPENSSL
ON
CACHE INTERNAL "" FORCE)
endif()

include(FetchContent)
FetchContent_Declare(
curl
URL https://github.com/curl/curl/releases/download/curl-7_80_0/curl-7.80.0.tar.xz
URL https://github.com/curl/curl/releases/download/curl-8_18_0/curl-8.18.0.tar.xz
URL_HASH
SHA256=a132bd93188b938771135ac7c1f3ac1d3ce507c1fcbef8c471397639214ae2ab # the file
# hash for curl-7.80.0.tar.xz
SHA256=40df79166e74aa20149365e11ee4c798a46ad57c34e4f68fd13100e2c9a91946
USES_TERMINAL_DOWNLOAD TRUE)
FetchContent_MakeAvailable(curl)
set_property(TARGET libcurl PROPERTY FOLDER "external")
get_property(
CURL_ALIAS_TARGET
TARGET libcurl
PROPERTY ALIASED_TARGET)
if("${CURL_ALIAS_TARGET}" STREQUAL "")
set_property(TARGET libcurl PROPERTY FOLDER "external")
else()
set_property(TARGET ${CURL_ALIAS_TARGET} PROPERTY FOLDER "external")
endif()
message(STATUS "Building libcurl using FetchContent")
endif()
endif()
2 changes: 1 addition & 1 deletion src/curl/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ namespace asyncpp::curl {
// No additional data
res = 0;
}
assert(res < (parser_data.size() - old_size));
assert(res <= (parser_data.size() - old_size));
parser_data.resize(old_size + res);

// Parse the data if there's any
Expand Down