Skip to content

ci(cli): include p2p and crypto modules in strict CI #5

ci(cli): include p2p and crypto modules in strict CI

ci(cli): include p2p and crypto modules in strict CI #5

Workflow file for this run

name: CLI Strict CI
on:
push:
branches: [main, master, dev]
paths:
- ".github/workflows/cli-strict-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]
paths:
- ".github/workflows/cli-strict-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:
DEPS: >
build-essential
cmake
ninja-build
clang
llvm
lld
g++
cppcheck
clang-tidy
valgrind
pkg-config
git
libasio-dev
nlohmann-json3-dev
libspdlog-dev
libfmt-dev
libssl-dev
libsqlite3-dev
libmysqlcppconn-dev
BUILD_JOBS: 2
VIX_GIT_BRANCH: dev
jobs:
build:
name: Build (${{ matrix.compiler }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [clang, gcc]
steps:
- name: Checkout cli repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y $DEPS
test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1)
- name: Prepare Asio layout for local core builds
run: |
set -e
mkdir -p /tmp/vix-asio/include
cp -r /usr/include/asio* /tmp/vix-asio/include/ || true
test -f /tmp/vix-asio/include/asio.hpp || (echo "::error::System Asio headers copy failed"; exit 1)
- name: Fetch sibling dependencies
run: |
rm -rf ../core ../utils ../async ../json ../template ../p2p ../crypto
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/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 || 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/p2p.git ../p2p
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto
git -C ../async submodule update --init --recursive --depth 1 || true
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
cp -r /tmp/vix-asio/include ../async/third_party/asio/
echo "---- sibling dependencies ----"
ls -la ../core || true
ls -la ../utils || true
ls -la ../async || true
ls -la ../async/third_party/asio/include || true
ls -la ../json || true
ls -la ../template || true
ls -la ../p2p || true
ls -la ../crypto || true
- name: Verify required sibling dependencies
run: |
test -f ../core/CMakeLists.txt || (echo "::error::../core/CMakeLists.txt is missing"; exit 1)
test -f ../utils/CMakeLists.txt || (echo "::error::../utils/CMakeLists.txt is missing"; exit 1)
test -f ../async/CMakeLists.txt || (echo "::error::../async/CMakeLists.txt is missing"; exit 1)
test -f ../p2p/CMakeLists.txt || (echo "::error::../p2p/CMakeLists.txt is missing"; exit 1)
test -f ../crypto/CMakeLists.txt || (echo "::error::../crypto/CMakeLists.txt is missing"; exit 1)
- name: Export dependency include paths
run: |
EXTRA_PATHS="$GITHUB_WORKSPACE/../core/include:$GITHUB_WORKSPACE/../utils/include:$GITHUB_WORKSPACE/../async/include:$GITHUB_WORKSPACE/../p2p/include:$GITHUB_WORKSPACE/../crypto/include"
if [ -d "$GITHUB_WORKSPACE/../json/include" ]; then
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include"
fi
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: 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: Configure
run: |
cmake -G Ninja -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DVIX_ENABLE_LTO=OFF
- name: Build
run: |
cmake --build build -j"${BUILD_JOBS}"
- name: Verify output binary
run: |
test -f build/vix || (echo "::error::build/vix not found"; exit 1)
ls -la build/vix
runtime-smoke:
name: Runtime Smoke Checks
runs-on: ubuntu-latest
steps:
- name: Checkout cli repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y $DEPS
test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1)
- name: Prepare Asio layout for local core builds
run: |
set -e
mkdir -p /tmp/vix-asio/include
cp -r /usr/include/asio* /tmp/vix-asio/include/ || true
test -f /tmp/vix-asio/include/asio.hpp || (echo "::error::System Asio headers copy failed"; exit 1)
- name: Fetch sibling dependencies
run: |
rm -rf ../core ../utils ../async ../json ../template ../p2p ../crypto
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/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 || 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/p2p.git ../p2p
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto
git -C ../async submodule update --init --recursive --depth 1 || true
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
cp -r /tmp/vix-asio/include ../async/third_party/asio/
- name: Verify required sibling dependencies
run: |
test -f ../core/CMakeLists.txt || (echo "::error::../core/CMakeLists.txt is missing"; exit 1)
test -f ../utils/CMakeLists.txt || (echo "::error::../utils/CMakeLists.txt is missing"; exit 1)
test -f ../async/CMakeLists.txt || (echo "::error::../async/CMakeLists.txt is missing"; exit 1)
test -f ../p2p/CMakeLists.txt || (echo "::error::../p2p/CMakeLists.txt is missing"; exit 1)
test -f ../crypto/CMakeLists.txt || (echo "::error::../crypto/CMakeLists.txt is missing"; exit 1)
- name: Export dependency include paths
run: |
EXTRA_PATHS="$GITHUB_WORKSPACE/../core/include:$GITHUB_WORKSPACE/../utils/include:$GITHUB_WORKSPACE/../async/include:$GITHUB_WORKSPACE/../p2p/include:$GITHUB_WORKSPACE/../crypto/include"
if [ -d "$GITHUB_WORKSPACE/../json/include" ]; then
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include"
fi
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 runtime build
run: |
cmake -G Ninja -S . -B build-runtime \
-DCMAKE_BUILD_TYPE=Debug \
-DVIX_ENABLE_LTO=OFF
- name: Build runtime artifacts
run: |
cmake --build build-runtime -j"${BUILD_JOBS}"
- name: Run help/version smoke
shell: bash
run: |
set +e
FAIL=0
echo "==> vix --help"
timeout 10s ./build-runtime/vix --help >/tmp/vix_help.log 2>&1
STATUS=$?
cat /tmp/vix_help.log || true
if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then
echo "::warning::vix --help returned status=$STATUS"
FAIL=1
fi
echo "==> vix -h"
timeout 10s ./build-runtime/vix -h >/tmp/vix_short_help.log 2>&1
STATUS=$?
cat /tmp/vix_short_help.log || true
if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then
echo "::warning::vix -h returned status=$STATUS"
FAIL=1
fi
echo "==> vix --version"
timeout 10s ./build-runtime/vix --version >/tmp/vix_version.log 2>&1
STATUS=$?
cat /tmp/vix_version.log || true
if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then
echo "::warning::vix --version returned status=$STATUS"
FAIL=1
fi
if [ $FAIL -ne 0 ]; then
echo "::warning::CLI smoke checks reported issues."
else
echo "CLI smoke checks completed."
fi
exit 0
static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout cli repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y $DEPS
test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1)
- name: Prepare Asio layout for local core builds
run: |
set -e
mkdir -p /tmp/vix-asio/include
cp -r /usr/include/asio* /tmp/vix-asio/include/ || true
test -f /tmp/vix-asio/include/asio.hpp || (echo "::error::System Asio headers copy failed"; exit 1)
- name: Fetch sibling dependencies
run: |
rm -rf ../core ../utils ../async ../json ../template ../p2p ../crypto
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/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 || 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/p2p.git ../p2p
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto
git -C ../async submodule update --init --recursive --depth 1 || true
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
cp -r /tmp/vix-asio/include ../async/third_party/asio/
- name: Verify required sibling dependencies
run: |
test -f ../core/CMakeLists.txt || (echo "::error::../core/CMakeLists.txt is missing"; exit 1)
test -f ../utils/CMakeLists.txt || (echo "::error::../utils/CMakeLists.txt is missing"; exit 1)
test -f ../async/CMakeLists.txt || (echo "::error::../async/CMakeLists.txt is missing"; exit 1)
test -f ../p2p/CMakeLists.txt || (echo "::error::../p2p/CMakeLists.txt is missing"; exit 1)
test -f ../crypto/CMakeLists.txt || (echo "::error::../crypto/CMakeLists.txt is missing"; exit 1)
- name: Export dependency include paths
run: |
EXTRA_PATHS="$GITHUB_WORKSPACE/../core/include:$GITHUB_WORKSPACE/../utils/include:$GITHUB_WORKSPACE/../async/include:$GITHUB_WORKSPACE/../p2p/include:$GITHUB_WORKSPACE/../crypto/include"
if [ -d "$GITHUB_WORKSPACE/../json/include" ]; then
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include"
fi
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 for analysis
run: |
cmake -G Ninja -S . -B build-analyze \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DVIX_ENABLE_LTO=OFF
- name: Run clang-tidy on source files
run: |
set +e
find src -name '*.cpp' -print0 | xargs -0 -n1 -P2 clang-tidy -p build-analyze
if [ -f main.cpp ]; then
clang-tidy -p build-analyze main.cpp || true
fi
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "::warning::clang-tidy reported issues."
else
echo "clang-tidy completed successfully."
fi
exit 0
- name: Run cppcheck on headers and sources
run: |
set +e
cppcheck \
--enable=all \
--std=c++20 \
--inconclusive \
--quiet \
--suppress=missingIncludeSystem \
include/ src/ .
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "::warning::cppcheck reported issues."
else
echo "cppcheck completed successfully."
fi
exit 0
valgrind:
name: Valgrind Checks
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout cli repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y $DEPS
test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1)
- name: Prepare Asio layout for local core builds
run: |
set -e
mkdir -p /tmp/vix-asio/include
cp -r /usr/include/asio* /tmp/vix-asio/include/ || true
test -f /tmp/vix-asio/include/asio.hpp || (echo "::error::System Asio headers copy failed"; exit 1)
- name: Fetch sibling dependencies
run: |
rm -rf ../core ../utils ../async ../json ../template ../p2p ../crypto
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/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 || 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/p2p.git ../p2p
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto
git -C ../async submodule update --init --recursive --depth 1 || true
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
cp -r /tmp/vix-asio/include ../async/third_party/asio/
- name: Verify required sibling dependencies
run: |
test -f ../core/CMakeLists.txt || (echo "::error::../core/CMakeLists.txt is missing"; exit 1)
test -f ../utils/CMakeLists.txt || (echo "::error::../utils/CMakeLists.txt is missing"; exit 1)
test -f ../async/CMakeLists.txt || (echo "::error::../async/CMakeLists.txt is missing"; exit 1)
test -f ../p2p/CMakeLists.txt || (echo "::error::../p2p/CMakeLists.txt is missing"; exit 1)
test -f ../crypto/CMakeLists.txt || (echo "::error::../crypto/CMakeLists.txt is missing"; exit 1)
- name: Export dependency include paths
run: |
EXTRA_PATHS="$GITHUB_WORKSPACE/../core/include:$GITHUB_WORKSPACE/../utils/include:$GITHUB_WORKSPACE/../async/include:$GITHUB_WORKSPACE/../p2p/include:$GITHUB_WORKSPACE/../crypto/include"
if [ -d "$GITHUB_WORKSPACE/../json/include" ]; then
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include"
fi
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 valgrind build
run: |
cmake -G Ninja -S . -B build-valgrind \
-DCMAKE_BUILD_TYPE=Debug \
-DVIX_ENABLE_LTO=OFF
- name: Build
run: |
cmake --build build-valgrind -j"${BUILD_JOBS}"
- name: Run valgrind on CLI
shell: bash
run: |
set +e
FAIL=0
echo "==> Valgrind: vix --help"
timeout 20s valgrind \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
./build-valgrind/vix --help
STATUS=$?
if [ $STATUS -ne 0 ] && [ $STATUS -ne 124 ]; then
echo "::warning::Valgrind reported issues for vix --help"
FAIL=1
fi
if [ $FAIL -ne 0 ]; then
echo "::warning::Valgrind detected potential issues."
else
echo "Valgrind checks completed."
fi
exit 0
standalone-package-check:
name: Standalone Package Export Check
runs-on: ubuntu-latest
steps:
- name: Checkout cli repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y $DEPS
test -f /usr/include/asio.hpp || (echo "::error::System Asio header not found after install"; exit 1)
- name: Prepare Asio layout for local core builds
run: |
set -e
mkdir -p /tmp/vix-asio/include
cp -r /usr/include/asio* /tmp/vix-asio/include/ || true
test -f /tmp/vix-asio/include/asio.hpp || (echo "::error::System Asio headers copy failed"; exit 1)
- name: Fetch sibling dependencies
run: |
rm -rf ../core ../utils ../async ../json ../template ../p2p ../crypto
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/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 || 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/p2p.git ../p2p
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto
git -C ../async submodule update --init --recursive --depth 1 || true
mkdir -p ../async/third_party/asio
rm -rf ../async/third_party/asio/include
cp -r /tmp/vix-asio/include ../async/third_party/asio/
- name: Verify required sibling dependencies
run: |
test -f ../core/CMakeLists.txt || (echo "::error::../core/CMakeLists.txt is missing"; exit 1)
test -f ../utils/CMakeLists.txt || (echo "::error::../utils/CMakeLists.txt is missing"; exit 1)
test -f ../async/CMakeLists.txt || (echo "::error::../async/CMakeLists.txt is missing"; exit 1)
test -f ../p2p/CMakeLists.txt || (echo "::error::../p2p/CMakeLists.txt is missing"; exit 1)
test -f ../crypto/CMakeLists.txt || (echo "::error::../crypto/CMakeLists.txt is missing"; exit 1)
- name: Export dependency include paths
run: |
EXTRA_PATHS="$GITHUB_WORKSPACE/../core/include:$GITHUB_WORKSPACE/../utils/include:$GITHUB_WORKSPACE/../async/include:$GITHUB_WORKSPACE/../p2p/include:$GITHUB_WORKSPACE/../crypto/include"
if [ -d "$GITHUB_WORKSPACE/../json/include" ]; then
EXTRA_PATHS="$EXTRA_PATHS:$GITHUB_WORKSPACE/../json/include"
fi
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 installable standalone build
run: |
cmake -G Ninja -S . -B build-install \
-DCMAKE_BUILD_TYPE=Release \
-DVIX_ENABLE_LTO=OFF \
-DCMAKE_INSTALL_PREFIX="${PWD}/.ci-install"
- name: Build standalone package
run: |
cmake --build build-install -j"${BUILD_JOBS}"
- name: Install standalone package
run: |
cmake --install build-install
- name: Verify installed package files
run: |
echo "---- install tree ----"
find .ci-install -maxdepth 8 -type f | sort || true
test -f .ci-install/include/vix/cli/CLI.hpp || (echo "::error::cli headers not found"; exit 1)
test -f .ci-install/bin/vix || (echo "::error::vix binary not found in install tree"; exit 1)