From d8c4d84dc75300c6d4d8b0adceafa33741960b92 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 27 Sep 2025 18:38:35 +0200 Subject: added http lib, working on AI invoice importing --- libs/cpp-httplib/.github/workflows/abidiff.yaml | 69 +++++++++ libs/cpp-httplib/.github/workflows/cifuzz.yaml | 32 ++++ .../.github/workflows/release-docker.yml | 51 ++++++ libs/cpp-httplib/.github/workflows/test.yaml | 171 +++++++++++++++++++++ libs/cpp-httplib/.github/workflows/test_proxy.yaml | 20 +++ 5 files changed, 343 insertions(+) create mode 100644 libs/cpp-httplib/.github/workflows/abidiff.yaml create mode 100644 libs/cpp-httplib/.github/workflows/cifuzz.yaml create mode 100644 libs/cpp-httplib/.github/workflows/release-docker.yml create mode 100644 libs/cpp-httplib/.github/workflows/test.yaml create mode 100644 libs/cpp-httplib/.github/workflows/test_proxy.yaml (limited to 'libs/cpp-httplib/.github') diff --git a/libs/cpp-httplib/.github/workflows/abidiff.yaml b/libs/cpp-httplib/.github/workflows/abidiff.yaml new file mode 100644 index 0000000..186e4fc --- /dev/null +++ b/libs/cpp-httplib/.github/workflows/abidiff.yaml @@ -0,0 +1,69 @@ +# SPDX-FileCopyrightText: 2025 Andrea Pappacoda +# SPDX-License-Identifier: MIT + +name: abidiff + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +defaults: + run: + shell: sh + +jobs: + abi: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + container: + image: debian:testing + + steps: + - name: Install dependencies + run: apt -y --update install --no-install-recommends + abigail-tools + ca-certificates + g++ + git + libbrotli-dev + libssl-dev + meson + pkg-config + python3 + zlib1g-dev + + - uses: actions/checkout@v4 + with: + path: current + + - uses: actions/checkout@v4 + with: + path: previous + fetch-depth: 0 + + - name: Checkout previous + working-directory: previous + run: | + git switch master + git describe --tags --abbrev=0 master | xargs git checkout + + - name: Build current + working-directory: current + run: | + meson setup --buildtype=debug -Dcpp-httplib_compile=true build + ninja -C build + + - name: Build previous + working-directory: previous + run: | + meson setup --buildtype=debug -Dcpp-httplib_compile=true build + ninja -C build + + - name: Run abidiff + run: abidiff + --headers-dir1 previous/build + --headers-dir2 current/build + previous/build/libcpp-httplib.so + current/build/libcpp-httplib.so diff --git a/libs/cpp-httplib/.github/workflows/cifuzz.yaml b/libs/cpp-httplib/.github/workflows/cifuzz.yaml new file mode 100644 index 0000000..422b58d --- /dev/null +++ b/libs/cpp-httplib/.github/workflows/cifuzz.yaml @@ -0,0 +1,32 @@ +name: CIFuzz + +on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + Fuzzing: + runs-on: ubuntu-latest + steps: + - name: Build Fuzzers + id: build + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'cpp-httplib' + dry-run: false + language: c++ + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'cpp-httplib' + fuzz-seconds: 600 + dry-run: false + language: c++ + - name: Upload Crash + uses: actions/upload-artifact@v4 + if: failure() && steps.build.outcome == 'success' + with: + name: artifacts + path: ./out/artifacts diff --git a/libs/cpp-httplib/.github/workflows/release-docker.yml b/libs/cpp-httplib/.github/workflows/release-docker.yml new file mode 100644 index 0000000..179ab82 --- /dev/null +++ b/libs/cpp-httplib/.github/workflows/release-docker.yml @@ -0,0 +1,51 @@ +name: Release Docker Image + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Extract tag (manual) + if: github.event_name == 'workflow_dispatch' + id: set_tag_manual + run: | + # Checkout the latest tag and set output + git fetch --tags + LATEST_TAG=$(git describe --tags --abbrev=0) + git checkout $LATEST_TAG + echo "tag=${LATEST_TAG#v}" >> $GITHUB_OUTPUT + + - name: Extract tag (release) + if: github.event_name == 'release' + id: set_tag_release + run: echo "tag=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/amd64,linux/arm64 # Build for both amd64 and arm64 + # Use extracted tag without leading 'v' + tags: | + yhirose4dockerhub/cpp-httplib-server:latest + yhirose4dockerhub/cpp-httplib-server:${{ steps.set_tag_manual.outputs.tag || steps.set_tag_release.outputs.tag }} diff --git a/libs/cpp-httplib/.github/workflows/test.yaml b/libs/cpp-httplib/.github/workflows/test.yaml new file mode 100644 index 0000000..45dc91c --- /dev/null +++ b/libs/cpp-httplib/.github/workflows/test.yaml @@ -0,0 +1,171 @@ +name: test + +on: + push: + pull_request: + workflow_dispatch: + inputs: + gtest_filter: + description: 'Google Test filter' + test_linux: + description: 'Test on Linux' + type: boolean + default: true + test_macos: + description: 'Test on MacOS' + type: boolean + default: true + test_windows: + description: 'Test on Windows' + type: boolean + default: true + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +env: + GTEST_FILTER: ${{ github.event.inputs.gtest_filter || '*' }} + +jobs: + style-check: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + continue-on-error: true + steps: + - name: checkout + uses: actions/checkout@v4 + - name: run style check + run: | + clang-format --version + cd test && make style_check + + build-error-check-on-32bit: + runs-on: ubuntu-latest + if: > + (github.event_name == 'push') || + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || + (github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true') + strategy: + matrix: + config: + - arch_flags: -m32 + arch_suffix: :i386 + name: (32-bit) + steps: + - name: checkout + uses: actions/checkout@v4 + - name: install libraries + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y libc6-dev${{ matrix.config.arch_suffix }} libstdc++-13-dev${{ matrix.config.arch_suffix }} \ + libssl-dev${{ matrix.config.arch_suffix }} libcurl4-openssl-dev${{ matrix.config.arch_suffix }} \ + zlib1g-dev${{ matrix.config.arch_suffix }} libbrotli-dev${{ matrix.config.arch_suffix }} \ + libzstd-dev${{ matrix.config.arch_suffix }} + - name: build and run tests (expect failure) + run: cd test && make test EXTRA_CXXFLAGS="${{ matrix.config.arch_flags }}" + continue-on-error: true + + ubuntu: + runs-on: ubuntu-latest + if: > + (github.event_name == 'push') || + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || + (github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true') + steps: + - name: checkout + uses: actions/checkout@v4 + - name: install libraries + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y libc6-dev${{ matrix.config.arch_suffix }} libstdc++-13-dev${{ matrix.config.arch_suffix }} \ + libssl-dev${{ matrix.config.arch_suffix }} libcurl4-openssl-dev${{ matrix.config.arch_suffix }} \ + zlib1g-dev${{ matrix.config.arch_suffix }} libbrotli-dev${{ matrix.config.arch_suffix }} \ + libzstd-dev${{ matrix.config.arch_suffix }} + - name: build and run tests + run: cd test && make EXTRA_CXXFLAGS="${{ matrix.config.arch_flags }}" + - name: run fuzz test target + run: cd test && make EXTRA_CXXFLAGS="${{ matrix.config.arch_flags }}" fuzz_test + + macos: + runs-on: macos-latest + if: > + (github.event_name == 'push') || + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || + (github.event_name == 'workflow_dispatch' && github.event.inputs.test_macos == 'true') + steps: + - name: checkout + uses: actions/checkout@v4 + - name: build and run tests + run: cd test && make + - name: run fuzz test target + run: cd test && make fuzz_test + + windows: + runs-on: windows-latest + if: > + (github.event_name == 'push') || + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || + (github.event_name == 'workflow_dispatch' && github.event.inputs.test_windows == 'true') + strategy: + matrix: + config: + - with_ssl: false + compiled: false + run_tests: true + name: without SSL + - with_ssl: true + compiled: false + run_tests: true + name: with SSL + - with_ssl: false + compiled: true + run_tests: false + name: compiled + name: windows ${{ matrix.config.name }} + steps: + - name: Prepare Git for Checkout on Windows + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout + uses: actions/checkout@v4 + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Setup msbuild on windows + uses: microsoft/setup-msbuild@v2 + - name: Install vcpkg dependencies + run: vcpkg install gtest curl zlib brotli zstd + - name: Install OpenSSL + if: ${{ matrix.config.with_ssl }} + run: choco install openssl --version 3.5.2 # workaround for chocolatey issue with the latest OpenSSL + - name: Configure CMake ${{ matrix.config.name }} + run: > + cmake -B build -S . + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake + -DHTTPLIB_TEST=ON + -DHTTPLIB_COMPILE=${{ matrix.config.compiled && 'ON' || 'OFF' }} + -DHTTPLIB_REQUIRE_ZLIB=ON + -DHTTPLIB_REQUIRE_BROTLI=ON + -DHTTPLIB_REQUIRE_ZSTD=ON + -DHTTPLIB_REQUIRE_OPENSSL=${{ matrix.config.with_ssl && 'ON' || 'OFF' }} + - name: Build ${{ matrix.config.name }} + run: cmake --build build --config Release -- /v:m /clp:ShowCommandLine + - name: Run tests ${{ matrix.config.name }} + if: ${{ matrix.config.run_tests }} + run: ctest --output-on-failure --test-dir build -C Release + + env: + VCPKG_ROOT: "C:/vcpkg" + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" diff --git a/libs/cpp-httplib/.github/workflows/test_proxy.yaml b/libs/cpp-httplib/.github/workflows/test_proxy.yaml new file mode 100644 index 0000000..571dc96 --- /dev/null +++ b/libs/cpp-httplib/.github/workflows/test_proxy.yaml @@ -0,0 +1,20 @@ +name: Proxy Test + +on: [push, pull_request] + +jobs: + test-proxy: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential libssl-dev zlib1g-dev libcurl4-openssl-dev libbrotli-dev libzstd-dev netcat-openbsd + + - name: Run proxy tests + run: | + cd test && make proxy \ No newline at end of file -- cgit v1.2.3-70-g09d2