fix(cli): detect websocket upgrade failures #354
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: CLI CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - release/** | |
| paths: | |
| - ".github/workflows/cli-ci.yml" | |
| - "CMakeLists.txt" | |
| - "include/**" | |
| - "src/**" | |
| - "main.cpp" | |
| - "docs/**" | |
| - "scripts/**" | |
| - "README.md" | |
| - "README_REPL.md" | |
| - "CHANGELOG.md" | |
| - "CONTRIBUTING.md" | |
| - "cmd.md" | |
| - "vix.json" | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - release/** | |
| paths: | |
| - ".github/workflows/cli-ci.yml" | |
| - "CMakeLists.txt" | |
| - "include/**" | |
| - "src/**" | |
| - "main.cpp" | |
| - "docs/**" | |
| - "scripts/**" | |
| - "README.md" | |
| - "README_REPL.md" | |
| - "CHANGELOG.md" | |
| - "CONTRIBUTING.md" | |
| - "cmd.md" | |
| - "vix.json" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| BUILD_JOBS: 2 | |
| VIX_GIT_BRANCH: dev | |
| jobs: | |
| build: | |
| name: Build CLI (${{ matrix.compiler }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: | |
| - gcc | |
| - clang | |
| steps: | |
| - name: Checkout CLI 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 \ | |
| libssl-dev \ | |
| zlib1g-dev \ | |
| libsqlite3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev | |
| - 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 modules | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../fs \ | |
| ../io \ | |
| ../env \ | |
| ../os \ | |
| ../process \ | |
| ../utils \ | |
| ../json \ | |
| ../async \ | |
| ../core \ | |
| ../reply \ | |
| ../template \ | |
| ../net \ | |
| ../crypto \ | |
| ../sync \ | |
| ../cache \ | |
| ../p2p \ | |
| ../agent | |
| 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/fs.git ../fs | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io | |
| 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/os.git ../os | |
| 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/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| 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/core.git ../core | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/reply.git ../reply || true | |
| 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/net.git ../net | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/sync.git ../sync || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/cache.git ../cache || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/p2p.git ../p2p || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/agent.git ../agent || true | |
| - name: Prepare Asio for modules | |
| run: | | |
| set -euxo pipefail | |
| test -f /usr/include/asio.hpp | |
| for module in ../async ../p2p; do | |
| if [ -d "$module" ]; then | |
| mkdir -p "$module/third_party/asio" | |
| rm -rf "$module/third_party/asio/include" | |
| mkdir -p "$module/third_party/asio/include" | |
| cp -r /usr/include/asio* "$module/third_party/asio/include/" || true | |
| test -f "$module/third_party/asio/include/asio.hpp" | |
| fi | |
| done | |
| - name: Verify sibling layout | |
| run: | | |
| set -euxo pipefail | |
| test -f ../error/CMakeLists.txt | |
| test -f ../path/CMakeLists.txt | |
| test -f ../env/CMakeLists.txt | |
| test -f ../process/CMakeLists.txt | |
| test -f ../utils/CMakeLists.txt | |
| test -f ../json/CMakeLists.txt | |
| test -f ../async/CMakeLists.txt | |
| test -f ../core/CMakeLists.txt | |
| test -f ../net/CMakeLists.txt | |
| test -f ../crypto/CMakeLists.txt | |
| - name: Configure CLI | |
| run: | | |
| cmake -S . -B build -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DVIX_ENABLE_LTO=OFF | |
| - name: Build CLI | |
| run: | | |
| cmake --build build -j"${BUILD_JOBS}" | |
| - name: Verify CLI binary | |
| run: | | |
| test -f build/vix | |
| ./build/vix --version || ./build/vix version || true | |
| ./build/vix --help >/tmp/vix-help.txt | |
| head -n 40 /tmp/vix-help.txt | |
| install-check: | |
| name: Install CLI binary | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout CLI 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 \ | |
| libssl-dev \ | |
| zlib1g-dev \ | |
| libsqlite3-dev \ | |
| libspdlog-dev \ | |
| libfmt-dev | |
| - name: Fetch sibling modules | |
| run: | | |
| set -euxo pipefail | |
| rm -rf \ | |
| ../error \ | |
| ../path \ | |
| ../fs \ | |
| ../io \ | |
| ../env \ | |
| ../os \ | |
| ../process \ | |
| ../utils \ | |
| ../json \ | |
| ../async \ | |
| ../core \ | |
| ../reply \ | |
| ../template \ | |
| ../net \ | |
| ../crypto \ | |
| ../sync \ | |
| ../cache \ | |
| ../p2p \ | |
| ../agent | |
| 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/fs.git ../fs | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io | |
| 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/os.git ../os | |
| 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/utils.git ../utils | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json | |
| 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/core.git ../core | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/reply.git ../reply || true | |
| 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/net.git ../net | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/sync.git ../sync || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/cache.git ../cache || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/p2p.git ../p2p || true | |
| git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/agent.git ../agent || true | |
| - name: Prepare Asio for modules | |
| run: | | |
| set -euxo pipefail | |
| for module in ../async ../p2p; do | |
| if [ -d "$module" ]; then | |
| mkdir -p "$module/third_party/asio" | |
| rm -rf "$module/third_party/asio/include" | |
| mkdir -p "$module/third_party/asio/include" | |
| cp -r /usr/include/asio* "$module/third_party/asio/include/" || true | |
| fi | |
| done | |
| - name: Configure installable CLI | |
| run: | | |
| cmake -S . -B build-install -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVIX_ENABLE_LTO=OFF \ | |
| -DCMAKE_INSTALL_PREFIX="${PWD}/.ci-install" | |
| - name: Build installable CLI | |
| run: | | |
| cmake --build build-install -j"${BUILD_JOBS}" | |
| - name: Install CLI | |
| run: | | |
| cmake --install build-install | |
| - name: Verify installed CLI | |
| run: | | |
| find .ci-install -maxdepth 6 -type f | sort | |
| test -f .ci-install/bin/vix | |
| .ci-install/bin/vix --version || .ci-install/bin/vix version || true | |
| .ci-install/bin/vix --help >/tmp/vix-installed-help.txt |