ci(p2p): fix standalone dependency workflow #19
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: P2P Strict CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - release/** | |
| paths: | |
| - ".github/workflows/p2p-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/p2p-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 P2P (${{ matrix.compiler }}, ssl=${{ matrix.ssl }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: | |
| - gcc | |
| - clang | |
| ssl: | |
| - OFF | |
| - ON | |
| steps: | |
| - name: Checkout p2p 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 \ | |
| libssl-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-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 \ | |
| ../async \ | |
| ../process \ | |
| ../net \ | |
| ../utils \ | |
| ../json | |
| 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}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/process.git ../process | |
| 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/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| git -C ../async submodule update --init --recursive --depth 1 || true | |
| - name: Prepare Asio layouts | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p third_party/asio/include | |
| cp -r /usr/include/asio* third_party/asio/include/ || true | |
| test -f third_party/asio/include/asio.hpp | |
| 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 ../async/CMakeLists.txt | |
| test -f ../process/CMakeLists.txt | |
| test -f ../net/CMakeLists.txt | |
| test -f ../utils/CMakeLists.txt | |
| test -f ../json/CMakeLists.txt | |
| test -f third_party/asio/include/asio.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/../async/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../process/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../net/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../utils/include" | |
| EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include" | |
| 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_P2P_BUILD_TESTS=OFF \ | |
| -DVIX_P2P_FETCH_NET=OFF \ | |
| -DVIX_P2P_FETCH_UTILS=OFF \ | |
| -DVIX_P2P_FETCH_SYNC=OFF \ | |
| -DVIX_P2P_FETCH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_UTILS=AUTO \ | |
| -DVIX_P2P_WITH_SYNC=OFF \ | |
| -DVIX_P2P_WITH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_JSON=OFF \ | |
| -DVIX_P2P_WITH_SSL=${{ matrix.ssl }} \ | |
| -DVIX_NET_BUILD_TESTS=OFF \ | |
| -DVIX_NET_FETCH_ERROR=OFF \ | |
| -DVIX_NET_FETCH_PROCESS=OFF | |
| - name: Build | |
| run: | | |
| cmake --build build -j"${BUILD_JOBS}" | |
| - name: Print artifacts | |
| run: | | |
| find build -maxdepth 6 -type f | sort | |
| static-analysis: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout p2p 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 \ | |
| libssl-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../async \ | |
| ../process \ | |
| ../net \ | |
| ../utils \ | |
| ../json | |
| 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}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/process.git ../process | |
| 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/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| - name: Prepare Asio layouts | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p third_party/asio/include | |
| cp -r /usr/include/asio* third_party/asio/include/ || true | |
| test -f third_party/asio/include/asio.hpp | |
| 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: 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_P2P_BUILD_TESTS=OFF \ | |
| -DVIX_P2P_FETCH_NET=OFF \ | |
| -DVIX_P2P_FETCH_UTILS=OFF \ | |
| -DVIX_P2P_FETCH_SYNC=OFF \ | |
| -DVIX_P2P_FETCH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_UTILS=AUTO \ | |
| -DVIX_P2P_WITH_SYNC=OFF \ | |
| -DVIX_P2P_WITH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_JSON=OFF \ | |
| -DVIX_P2P_WITH_SSL=OFF \ | |
| -DVIX_NET_BUILD_TESTS=OFF \ | |
| -DVIX_NET_FETCH_ERROR=OFF \ | |
| -DVIX_NET_FETCH_PROCESS=OFF | |
| - 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/ | |
| exit 0 | |
| install-check: | |
| name: Install P2P | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout p2p 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 \ | |
| libssl-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../async \ | |
| ../process \ | |
| ../net \ | |
| ../utils \ | |
| ../json | |
| 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}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/process.git ../process | |
| 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/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| - name: Prepare Asio layouts | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p third_party/asio/include | |
| cp -r /usr/include/asio* third_party/asio/include/ || true | |
| test -f third_party/asio/include/asio.hpp | |
| 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: Configure installable build | |
| run: | | |
| cmake -S . -B build-install -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_P2P_BUILD_TESTS=OFF \ | |
| -DVIX_P2P_FETCH_NET=OFF \ | |
| -DVIX_P2P_FETCH_UTILS=OFF \ | |
| -DVIX_P2P_FETCH_SYNC=OFF \ | |
| -DVIX_P2P_FETCH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_UTILS=AUTO \ | |
| -DVIX_P2P_WITH_SYNC=OFF \ | |
| -DVIX_P2P_WITH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_JSON=OFF \ | |
| -DVIX_P2P_WITH_SSL=OFF \ | |
| -DVIX_NET_BUILD_TESTS=OFF \ | |
| -DVIX_NET_FETCH_ERROR=OFF \ | |
| -DVIX_NET_FETCH_PROCESS=OFF \ | |
| -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/p2p | |
| test -f .ci-install/lib/libvix_p2p.a | |
| config-coverage: | |
| name: Configuration Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout p2p 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 \ | |
| libssl-dev \ | |
| nlohmann-json3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev | |
| - name: Fetch sibling dependencies | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../env \ | |
| ../async \ | |
| ../process \ | |
| ../net \ | |
| ../utils \ | |
| ../json | |
| 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}" --recurse-submodules https://github.com/vixcpp/async.git ../async | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/process.git ../process | |
| 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/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| - name: Prepare Asio layouts | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p third_party/asio/include | |
| cp -r /usr/include/asio* third_party/asio/include/ || true | |
| test -f third_party/asio/include/asio.hpp | |
| 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: Configure release minimal mode | |
| run: | | |
| cmake -S . -B build-release-min -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_P2P_BUILD_TESTS=OFF \ | |
| -DVIX_P2P_FETCH_NET=OFF \ | |
| -DVIX_P2P_FETCH_UTILS=OFF \ | |
| -DVIX_P2P_FETCH_SYNC=OFF \ | |
| -DVIX_P2P_FETCH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_UTILS=OFF \ | |
| -DVIX_P2P_WITH_SYNC=OFF \ | |
| -DVIX_P2P_WITH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_JSON=OFF \ | |
| -DVIX_P2P_WITH_SSL=OFF \ | |
| -DVIX_NET_BUILD_TESTS=OFF \ | |
| -DVIX_NET_FETCH_ERROR=OFF \ | |
| -DVIX_NET_FETCH_PROCESS=OFF | |
| - name: Build release minimal mode | |
| run: | | |
| cmake --build build-release-min -j"${BUILD_JOBS}" | |
| - name: Configure release with utils and SSL | |
| run: | | |
| cmake -S . -B build-release-utils-ssl -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_ENABLE_SANITIZERS=OFF \ | |
| -DVIX_P2P_BUILD_TESTS=OFF \ | |
| -DVIX_P2P_FETCH_NET=OFF \ | |
| -DVIX_P2P_FETCH_UTILS=OFF \ | |
| -DVIX_P2P_FETCH_SYNC=OFF \ | |
| -DVIX_P2P_FETCH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_UTILS=AUTO \ | |
| -DVIX_P2P_WITH_SYNC=OFF \ | |
| -DVIX_P2P_WITH_CACHE=OFF \ | |
| -DVIX_P2P_WITH_JSON=OFF \ | |
| -DVIX_P2P_WITH_SSL=ON \ | |
| -DVIX_NET_BUILD_TESTS=OFF \ | |
| -DVIX_NET_FETCH_ERROR=OFF \ | |
| -DVIX_NET_FETCH_PROCESS=OFF | |
| - name: Build release with utils and SSL | |
| run: | | |
| cmake --build build-release-utils-ssl -j"${BUILD_JOBS}" | |
| summary: | |
| name: P2P Strict CI Summary | |
| needs: | |
| - build | |
| - static-analysis | |
| - install-check | |
| - config-coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print summary | |
| run: | | |
| echo "P2P strict CI completed." | |
| echo "- gcc and clang builds" | |
| echo "- required net/process/async dependency chain" | |
| echo "- SSL ON and OFF builds" | |
| echo "- static analysis" | |
| echo "- install tree check" | |
| echo "- minimal and utils/SSL configuration coverage" |