Skip to content

Fixing coverage

Fixing coverage #256

Workflow file for this run

name: GitHub CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
debug_unix:
name: Debug ${{ matrix.label }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- label: linux-x64
runner: ubuntu-22.04
with_optional: ON
conda_pkgs: c-compiler cxx-compiler cmake ninja boost-cpp tbb tbb-devel eigen nlopt ipopt
- label: linux-arm64
runner: ubuntu-22.04-arm
with_optional: OFF
conda_pkgs: c-compiler cxx-compiler cmake ninja boost-cpp tbb tbb-devel eigen
- label: macos-arm64
runner: macos-latest
with_optional: ON
conda_pkgs: c-compiler cxx-compiler libcxx cmake ninja boost-cpp tbb tbb-devel eigen nlopt ipopt
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge
channel-priority: strict
- name: Install dependencies
shell: bash
run: |
set -e
conda create -y -q -p "$HOME/local" ${{ matrix.conda_pkgs }}
- name: Configure
shell: bash
run: |
set -e
conda run -p "$HOME/local" cmake -S . -B build -G Ninja \
-DCMAKE_PREFIX_PATH="$HOME/local" \
-DCMAKE_BUILD_TYPE=Debug \
-DBoost_NO_BOOST_CMAKE=ON \
-DPAGMO_BUILD_TESTS=ON \
-DPAGMO_WITH_EIGEN3=ON \
-DPAGMO_WITH_NLOPT=${{ matrix.with_optional }} \
-DPAGMO_WITH_IPOPT=${{ matrix.with_optional }} \
-DPAGMO_ENABLE_IPO=ON
- name: Build
shell: bash
run: |
set -e
conda run -p "$HOME/local" cmake --build build --parallel
- name: Test
shell: bash
run: |
set -e
conda run -p "$HOME/local" ctest --test-dir build -VV --output-on-failure -j4
release_windows_x64:
name: Release windows-x64
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge
channel-priority: strict
- name: Configure
shell: powershell
run: |
conda create -y -q -p $env:USERPROFILE\local cmake ninja eigen nlopt ipopt boost-cpp tbb tbb-devel
conda run -p $env:USERPROFILE\local cmake -S . -B build -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_PREFIX_PATH=$env:USERPROFILE\local `
-DCMAKE_INSTALL_PREFIX=$env:USERPROFILE\local `
-DBoost_NO_BOOST_CMAKE=ON `
-DPAGMO_BUILD_TESTS=ON `
-DPAGMO_WITH_EIGEN3=ON `
-DPAGMO_WITH_NLOPT=ON `
-DPAGMO_WITH_IPOPT=ON `
-DPAGMO_ENABLE_IPO=ON
- name: Build
shell: powershell
run: conda run -p $env:USERPROFILE\local cmake --build build --config Release --parallel
- name: Test
shell: powershell
run: |
$env:PATH = "$PWD\build\Release;$env:USERPROFILE\local\Library\bin;$env:USERPROFILE\local\bin;$env:PATH"
ctest --test-dir build -VV --output-on-failure -j4 -C Release
linux_coverage_docs:
name: Linux coverage + docs${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && ' and deploy' || '' }}
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge
channel-priority: strict
- name: Install dependencies
shell: bash
run: |
set -e
conda create -y -q -p "$HOME/local" \
c-compiler cxx-compiler cmake ninja boost-cpp tbb tbb-devel eigen nlopt ipopt \
python=3.10 sphinx=4.5.0 sphinx-book-theme breathe "doxygen<1.13" graphviz lcov
- name: Build and test (coverage, no torture)
shell: bash
run: |
set -e
conda run -p "$HOME/local" cmake -S . -B build -G Ninja \
-DCMAKE_PREFIX_PATH="$HOME/local" \
-DCMAKE_BUILD_TYPE=Debug \
-DBoost_NO_BOOST_CMAKE=ON \
-DPAGMO_BUILD_TESTS=ON \
-DPAGMO_WITH_EIGEN3=ON \
-DPAGMO_WITH_NLOPT=ON \
-DPAGMO_WITH_IPOPT=ON \
-DPAGMO_ENABLE_IPO=OFF \
-DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_SHARED_LINKER_FLAGS="--coverage" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
conda run -p "$HOME/local" cmake --build build --parallel
conda run -p "$HOME/local" ctest --test-dir build -VV --output-on-failure -j4 -E torture
- name: Generate coverage
shell: bash
run: |
set -e
GCOV=$(conda run -p "$HOME/local" bash -lc 'command -v x86_64-conda-linux-gnu-gcov || command -v aarch64-conda-linux-gnu-gcov || command -v gcov')
echo "Using gcov tool: $GCOV"
# Print gcov version to help debugging mismatch issues
if [ -n "$GCOV" ]; then
"$GCOV" --version || true
fi
conda run -p "$HOME/local" lcov \
--gcov-tool "$GCOV" \
--capture \
--directory build \
--output-file lcov.info \
--no-external
# Fail fast if lcov did not collect any project source file.
test "$(grep -c '^SF:' lcov.info || true)" -gt 0
- name: Upload coverage report
uses: codecov/codecov-action@v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
- name: Build Doxygen XML
shell: bash
run: |
set -e
cd doc/doxygen
conda run -p "$HOME/local" doxygen
cp images/* xml/
- name: Build Sphinx docs
shell: bash
run: |
set -e
cd doc/sphinx
conda run -p "$HOME/local" make html
if ! conda run -p "$HOME/local" make linkcheck; then
echo "Warning: Sphinx linkcheck failed (likely transient external outage); continuing."
fi
- name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: doc/sphinx/_build/html