feat(middleware): add static response compression hook #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Middleware Strict CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - release/** | |
| paths: | |
| - ".github/workflows/middleware-strict-ci.yml" | |
| - "CMakeLists.txt" | |
| - "include/**" | |
| - "src/**" | |
| - "tests/**" | |
| - "scripts/**" | |
| - "README.md" | |
| - "CHANGELOG.md" | |
| - "cmd.md" | |
| - "vix.json" | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - release/** | |
| paths: | |
| - ".github/workflows/middleware-strict-ci.yml" | |
| - "CMakeLists.txt" | |
| - "include/**" | |
| - "src/**" | |
| - "tests/**" | |
| - "scripts/**" | |
| - "README.md" | |
| - "CHANGELOG.md" | |
| - "cmd.md" | |
| - "vix.json" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| BUILD_JOBS: 2 | |
| VIX_GIT_BRANCH: dev | |
| jobs: | |
| build: | |
| name: Build Middleware (${{ matrix.compiler }}, utils=${{ matrix.utils_mode }}, json=${{ matrix.json_mode }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: | |
| - gcc | |
| - clang | |
| utils_mode: | |
| - AUTO | |
| - OFF | |
| json_mode: | |
| - AUTO | |
| - OFF | |
| steps: | |
| - name: Checkout middleware repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| ninja-build \ | |
| clang \ | |
| g++ \ | |
| pkg-config \ | |
| git \ | |
| curl \ | |
| ca-certificates \ | |
| libasio-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev \ | |
| libssl-dev \ | |
| libsqlite3-dev | |
| test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found"; exit 1) | |
| - name: Select compiler | |
| run: | | |
| if [ "${{ matrix.compiler }}" = "clang" ]; then | |
| echo "CC=clang" >> "$GITHUB_ENV" | |
| echo "CXX=clang++" >> "$GITHUB_ENV" | |
| else | |
| echo "CC=gcc" >> "$GITHUB_ENV" | |
| echo "CXX=g++" >> "$GITHUB_ENV" | |
| fi | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../json \ | |
| ../template \ | |
| ../core \ | |
| ../net \ | |
| ../cache | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/net.git ../net | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/cache.git ../cache | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| test -f ../async/third_party/asio/include/asio.hpp | |
| - name: Verify required sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| test -f ../error/CMakeLists.txt | |
| test -f ../path/CMakeLists.txt | |
| test -f ../env/CMakeLists.txt | |
| test -f ../utils/CMakeLists.txt | |
| test -f ../async/CMakeLists.txt | |
| test -f ../json/CMakeLists.txt | |
| test -f ../core/CMakeLists.txt | |
| test -f ../net/CMakeLists.txt | |
| test -f ../cache/CMakeLists.txt | |
| test -f ../json/include/vix/json/Simple.hpp | |
| test -f ../async/third_party/asio/include/asio.hpp | |
| - name: Export dependency include paths | |
| run: | | |
| EXTRA_PATHS="$GITHUB_WORKSPACE/../error/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../path/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../env/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../async/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../core/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../net/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../cache/include" | |
| if [ -d "$GITHUB_WORKSPACE/../template/include" ]; then | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../template/include" | |
| fi | |
| echo "CPATH=$EXTRA_PATHS${CPATH:+:$CPATH}" >> "$GITHUB_ENV" | |
| echo "CPLUS_INCLUDE_PATH=$EXTRA_PATHS${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}" >> "$GITHUB_ENV" | |
| - name: Configure | |
| run: | | |
| cmake -S . -B build -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_MW_BUILD_TESTS=OFF \ | |
| -DVIX_MW_FETCH_CORE=OFF \ | |
| -DVIX_MW_FETCH_CACHE=OFF \ | |
| -DVIX_MW_FETCH_UTILS=OFF \ | |
| -DVIX_MW_WITH_UTILS=${{ matrix.utils_mode }} \ | |
| -DVIX_MW_WITH_JSON=${{ matrix.json_mode }} \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=AUTO \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_CORE_WITH_JSON=AUTO | |
| - name: Build | |
| run: | | |
| cmake --build build -j"${BUILD_JOBS}" | |
| - name: Print executables | |
| run: | | |
| find build -type f -executable | sort || true | |
| static-analysis: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout middleware repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| ninja-build \ | |
| clang \ | |
| g++ \ | |
| cppcheck \ | |
| clang-tidy \ | |
| pkg-config \ | |
| git \ | |
| curl \ | |
| ca-certificates \ | |
| libasio-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev \ | |
| libssl-dev \ | |
| libsqlite3-dev | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../json \ | |
| ../template \ | |
| ../core \ | |
| ../net \ | |
| ../cache | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/net.git ../net | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/cache.git ../cache | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| - name: Configure for analysis | |
| run: | | |
| cmake -S . -B build-analyze -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_MW_BUILD_TESTS=OFF \ | |
| -DVIX_MW_FETCH_CORE=OFF \ | |
| -DVIX_MW_FETCH_CACHE=OFF \ | |
| -DVIX_MW_FETCH_UTILS=OFF \ | |
| -DVIX_MW_WITH_UTILS=AUTO \ | |
| -DVIX_MW_WITH_JSON=AUTO \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=AUTO \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_CORE_WITH_JSON=AUTO | |
| - name: Run clang-tidy | |
| run: | | |
| set +e | |
| find src -name '*.cpp' -print0 | xargs -0 -r -n1 -P2 clang-tidy -p build-analyze | |
| exit 0 | |
| - name: Run cppcheck | |
| run: | | |
| set +e | |
| cppcheck \ | |
| --enable=all \ | |
| --std=c++20 \ | |
| --inconclusive \ | |
| --quiet \ | |
| --suppress=missingIncludeSystem \ | |
| include/ src/ tests/ | |
| exit 0 | |
| install-check: | |
| name: Install Middleware | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout middleware repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| ninja-build \ | |
| g++ \ | |
| pkg-config \ | |
| git \ | |
| curl \ | |
| ca-certificates \ | |
| libasio-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev \ | |
| libssl-dev \ | |
| libsqlite3-dev | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../json \ | |
| ../template \ | |
| ../core \ | |
| ../net \ | |
| ../cache | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/net.git ../net | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/cache.git ../cache | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| - name: Configure installable build | |
| run: | | |
| cmake -S . -B build-install -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_MW_BUILD_TESTS=OFF \ | |
| -DVIX_MW_FETCH_CORE=OFF \ | |
| -DVIX_MW_FETCH_CACHE=OFF \ | |
| -DVIX_MW_FETCH_UTILS=OFF \ | |
| -DVIX_MW_WITH_UTILS=AUTO \ | |
| -DVIX_MW_WITH_JSON=AUTO \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=AUTO \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_CORE_WITH_JSON=AUTO \ | |
| -DCMAKE_INSTALL_PREFIX="${PWD}/.ci-install" | |
| - name: Build installable package | |
| run: | | |
| cmake --build build-install -j"${BUILD_JOBS}" | |
| - name: Install package | |
| run: | | |
| cmake --install build-install | |
| - name: Verify install tree | |
| run: | | |
| find .ci-install -maxdepth 8 -type f | sort | |
| test -d .ci-install/include/vix | |
| test -f .ci-install/lib/libvix_middleware.a | |
| config-coverage: | |
| name: Configuration Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout middleware repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| ninja-build \ | |
| g++ \ | |
| pkg-config \ | |
| git \ | |
| curl \ | |
| ca-certificates \ | |
| libasio-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev \ | |
| libssl-dev \ | |
| libsqlite3-dev | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../utils \ | |
| ../async \ | |
| ../json \ | |
| ../template \ | |
| ../core \ | |
| ../net \ | |
| ../cache | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/net.git ../net | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/cache.git ../cache | |
| - name: Prepare Asio for async | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ../async/third_party/asio | |
| rm -rf ../async/third_party/asio/include | |
| mkdir -p ../async/third_party/asio/include | |
| cp -r /usr/include/asio* ../async/third_party/asio/include/ || true | |
| - name: Configure release minimal mode | |
| run: | | |
| cmake -S . -B build-release-min -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_MW_BUILD_TESTS=OFF \ | |
| -DVIX_MW_FETCH_CORE=OFF \ | |
| -DVIX_MW_FETCH_CACHE=OFF \ | |
| -DVIX_MW_FETCH_UTILS=OFF \ | |
| -DVIX_MW_WITH_UTILS=OFF \ | |
| -DVIX_MW_WITH_JSON=OFF \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=AUTO \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_CORE_WITH_JSON=AUTO | |
| - name: Build release minimal mode | |
| run: | | |
| cmake --build build-release-min -j"${BUILD_JOBS}" | |
| - name: Configure release auto mode | |
| run: | | |
| cmake -S . -B build-release-auto -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_MW_BUILD_TESTS=OFF \ | |
| -DVIX_MW_FETCH_CORE=OFF \ | |
| -DVIX_MW_FETCH_CACHE=OFF \ | |
| -DVIX_MW_FETCH_UTILS=OFF \ | |
| -DVIX_MW_WITH_UTILS=AUTO \ | |
| -DVIX_MW_WITH_JSON=AUTO \ | |
| -DVIX_CORE_WITH_OPENSSL=OFF \ | |
| -DVIX_CORE_WITH_TEMPLATE=AUTO \ | |
| -DVIX_CORE_WITH_MYSQL=OFF \ | |
| -DVIX_CORE_WITH_JSON=AUTO | |
| - name: Build release auto mode | |
| run: | | |
| cmake --build build-release-auto -j"${BUILD_JOBS}" | |
| summary: | |
| name: Middleware Strict CI Summary | |
| needs: | |
| - build | |
| - static-analysis | |
| - install-check | |
| - config-coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print summary | |
| run: | | |
| echo "Middleware strict CI completed." | |
| echo "- gcc and clang builds" | |
| echo "- tests when available" | |
| echo "- static analysis" | |
| echo "- install tree check" | |
| echo "- minimal and AUTO configuration coverage" |