fix(ci): properly build kcov from source

Previous approach tried to download pre-built binaries that don't exist.
Now builds kcov from source with all required dependencies:
- cmake, g++ for compilation
- binutils-dev, libcurl4-openssl-dev, libdw-dev, libiberty-dev
- zlib1g-dev, libssl-dev

Also added better debugging output when coverage files not found.

Refs #10
This commit is contained in:
frankbria 2026-01-08 23:03:30 -07:00
parent 5823003ff0
commit 3e76f80e29

View file

@ -62,41 +62,34 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y jq sudo apt-get install -y jq
- name: Install kcov - name: Build and install kcov from source
run: | run: |
# Install kcov dependencies # Install kcov build dependencies
sudo apt-get install -y \ sudo apt-get install -y \
cmake \
g++ \
binutils-dev \ binutils-dev \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libdw-dev \ libdw-dev \
libiberty-dev \ libiberty-dev \
zlib1g-dev zlib1g-dev \
libssl-dev
# Download and extract pre-built kcov # Clone and build kcov
wget -q https://github.com/SimonKagworthy/kcov/releases/download/v${KCOV_VERSION}/kcov-amd64.tar.gz -O /tmp/kcov.tar.gz || \ git clone --depth 1 --branch v${KCOV_VERSION} https://github.com/SimonKagstrom/kcov.git /tmp/kcov-src
wget -q https://github.com/SimonKagstrom/kcov/releases/download/v${KCOV_VERSION}/kcov-amd64.tar.gz -O /tmp/kcov.tar.gz || \ cd /tmp/kcov-src
{ mkdir build && cd build
# Fallback: build from source if pre-built not available cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
echo "Pre-built kcov not found, building from source..." make -j$(nproc)
sudo apt-get install -y cmake g++ sudo make install
git clone --depth 1 --branch v${KCOV_VERSION} https://github.com/SimonKagstrom/kcov.git /tmp/kcov-src
cd /tmp/kcov-src
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
cd /
}
# Extract if we downloaded the tarball # Verify installation
if [[ -f /tmp/kcov.tar.gz ]]; then /usr/local/bin/kcov --version
sudo tar -xzf /tmp/kcov.tar.gz -C /usr/local
fi
- name: Verify kcov installation - name: Verify kcov installation
run: | run: |
kcov --version || echo "kcov installed" which kcov
which kcov || echo "kcov in PATH" kcov --version
- name: Run tests with coverage - name: Run tests with coverage
run: | run: |
@ -136,6 +129,7 @@ jobs:
echo "Warning: Could not find coverage results" echo "Warning: Could not find coverage results"
# List what we do have for debugging # List what we do have for debugging
find coverage -type f -name "*.json" 2>/dev/null || echo "No JSON files found" find coverage -type f -name "*.json" 2>/dev/null || echo "No JSON files found"
ls -laR coverage/ 2>/dev/null || echo "Coverage directory empty or not found"
fi fi
fi fi