Skip to content

Commit 3e76f80

Browse files
committed
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
1 parent 5823003 commit 3e76f80

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

.github/workflows/test.yml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,41 +62,34 @@ jobs:
6262
sudo apt-get update
6363
sudo apt-get install -y jq
6464
65-
- name: Install kcov
65+
- name: Build and install kcov from source
6666
run: |
67-
# Install kcov dependencies
67+
# Install kcov build dependencies
6868
sudo apt-get install -y \
69+
cmake \
70+
g++ \
6971
binutils-dev \
7072
libcurl4-openssl-dev \
7173
libdw-dev \
7274
libiberty-dev \
73-
zlib1g-dev
74-
75-
# Download and extract pre-built kcov
76-
wget -q https://github.com/SimonKagworthy/kcov/releases/download/v${KCOV_VERSION}/kcov-amd64.tar.gz -O /tmp/kcov.tar.gz || \
77-
wget -q https://github.com/SimonKagstrom/kcov/releases/download/v${KCOV_VERSION}/kcov-amd64.tar.gz -O /tmp/kcov.tar.gz || \
78-
{
79-
# Fallback: build from source if pre-built not available
80-
echo "Pre-built kcov not found, building from source..."
81-
sudo apt-get install -y cmake g++
82-
git clone --depth 1 --branch v${KCOV_VERSION} https://github.com/SimonKagstrom/kcov.git /tmp/kcov-src
83-
cd /tmp/kcov-src
84-
mkdir build && cd build
85-
cmake ..
86-
make -j$(nproc)
87-
sudo make install
88-
cd /
89-
}
90-
91-
# Extract if we downloaded the tarball
92-
if [[ -f /tmp/kcov.tar.gz ]]; then
93-
sudo tar -xzf /tmp/kcov.tar.gz -C /usr/local
94-
fi
75+
zlib1g-dev \
76+
libssl-dev
77+
78+
# Clone and build kcov
79+
git clone --depth 1 --branch v${KCOV_VERSION} https://github.com/SimonKagstrom/kcov.git /tmp/kcov-src
80+
cd /tmp/kcov-src
81+
mkdir build && cd build
82+
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
83+
make -j$(nproc)
84+
sudo make install
85+
86+
# Verify installation
87+
/usr/local/bin/kcov --version
9588
9689
- name: Verify kcov installation
9790
run: |
98-
kcov --version || echo "kcov installed"
99-
which kcov || echo "kcov in PATH"
91+
which kcov
92+
kcov --version
10093
10194
- name: Run tests with coverage
10295
run: |
@@ -136,6 +129,7 @@ jobs:
136129
echo "Warning: Could not find coverage results"
137130
# List what we do have for debugging
138131
find coverage -type f -name "*.json" 2>/dev/null || echo "No JSON files found"
132+
ls -laR coverage/ 2>/dev/null || echo "Coverage directory empty or not found"
139133
fi
140134
fi
141135

0 commit comments

Comments
 (0)