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_openssl: 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') name: ubuntu (openssl) steps: - name: checkout uses: actions/checkout@v4 - name: install common libraries run: | sudo apt-get update sudo apt-get install -y libcurl4-openssl-dev zlib1g-dev libbrotli-dev libzstd-dev - name: install OpenSSL run: sudo apt-get install -y libssl-dev - name: build and run tests (OpenSSL) run: cd test && make - name: run fuzz test target run: cd test && make fuzz_test ubuntu_mbedtls: runs-on: ubuntu-latest needs: ubuntu_openssl 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') name: ubuntu (mbedtls) steps: - name: checkout uses: actions/checkout@v4 - name: install common libraries run: | sudo apt-get update sudo apt-get install -y libcurl4-openssl-dev zlib1g-dev libbrotli-dev libzstd-dev - name: install Mbed TLS run: sudo apt-get install -y libmbedtls-dev - name: build and run tests (Mbed TLS) run: cd test && make test_split_mbedtls && make test_mbedtls && ./test_mbedtls ubuntu_no_tls: runs-on: ubuntu-latest needs: ubuntu_mbedtls 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') name: ubuntu (no TLS) steps: - name: checkout uses: actions/checkout@v4 - name: install common libraries run: | sudo apt-get update sudo apt-get install -y libcurl4-openssl-dev zlib1g-dev libbrotli-dev libzstd-dev - name: build and run tests (no TLS) run: cd test && make test_no_tls && make test_split_no_tls && ./test_no_tls macos_openssl: 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') name: macos (openssl) steps: - name: checkout uses: actions/checkout@v4 - name: build and run tests (OpenSSL) run: cd test && make - name: run fuzz test target run: cd test && make fuzz_test macos_mbedtls: runs-on: macos-latest needs: macos_openssl 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') name: macos (mbedtls) steps: - name: checkout uses: actions/checkout@v4 - name: install Mbed TLS run: brew install mbedtls@3 - name: build and run tests (Mbed TLS) run: cd test && make test_split_mbedtls && make test_mbedtls && ./test_mbedtls macos_no_tls: runs-on: macos-latest needs: macos_mbedtls 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') name: macos (no TLS) steps: - name: checkout uses: actions/checkout@v4 - name: build and run tests (no TLS) run: cd test && make test_split_no_tls && make test_no_tls && ./test_no_tls windows_without_ssl: 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') name: windows (without SSL) 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: Configure CMake without SSL run: > cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DHTTPLIB_TEST=ON -DHTTPLIB_COMPILE=OFF -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF -DHTTPLIB_REQUIRE_ZLIB=ON -DHTTPLIB_REQUIRE_BROTLI=ON -DHTTPLIB_REQUIRE_ZSTD=ON -DHTTPLIB_REQUIRE_OPENSSL=OFF - name: Build without SSL run: cmake --build build --config Release -- /v:m /clp:ShowCommandLine - name: Run tests without SSL run: ctest --output-on-failure --test-dir build -C Release -E "BenchmarkTest" env: VCPKG_ROOT: "C:/vcpkg" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" windows_with_ssl: runs-on: windows-latest needs: windows_without_ssl 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') name: windows (with SSL) 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 run: choco install openssl - name: Configure CMake with SSL run: > cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DHTTPLIB_TEST=ON -DHTTPLIB_COMPILE=OFF -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=ON -DHTTPLIB_REQUIRE_ZLIB=ON -DHTTPLIB_REQUIRE_BROTLI=ON -DHTTPLIB_REQUIRE_ZSTD=ON -DHTTPLIB_REQUIRE_OPENSSL=ON - name: Build with SSL run: cmake --build build --config Release -- /v:m /clp:ShowCommandLine - name: Run tests with SSL run: ctest --output-on-failure --test-dir build -C Release -E "BenchmarkTest" env: VCPKG_ROOT: "C:/vcpkg" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" windows_benchmark: runs-on: windows-latest needs: windows_with_ssl 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') name: windows (BenchmarkTest) 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 run: choco install openssl - name: Configure CMake BenchmarkTest run: > cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DHTTPLIB_TEST=ON -DHTTPLIB_COMPILE=OFF -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=ON -DHTTPLIB_REQUIRE_ZLIB=ON -DHTTPLIB_REQUIRE_BROTLI=ON -DHTTPLIB_REQUIRE_ZSTD=ON -DHTTPLIB_REQUIRE_OPENSSL=ON - name: Build BenchmarkTest run: cmake --build build --config Release -- /v:m /clp:ShowCommandLine - name: Run benchmark tests with retry run: ctest --output-on-failure --test-dir build -C Release -R "BenchmarkTest" --repeat until-pass:5 env: VCPKG_ROOT: "C:/vcpkg" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" windows_compiled: 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') name: windows (compiled) 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: Configure CMake compiled run: > cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DHTTPLIB_TEST=ON -DHTTPLIB_COMPILE=ON -DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF -DHTTPLIB_REQUIRE_ZLIB=ON -DHTTPLIB_REQUIRE_BROTLI=ON -DHTTPLIB_REQUIRE_ZSTD=ON -DHTTPLIB_REQUIRE_OPENSSL=OFF - name: Build compiled run: cmake --build build --config Release -- /v:m /clp:ShowCommandLine env: VCPKG_ROOT: "C:/vcpkg" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"