Skip to content

Testing CPP library update #27

Testing CPP library update

Testing CPP library update #27

Workflow file for this run

# Auto-generated from cpp-library (https://github.com/stlab/cpp-library)
# Do not edit this file directly - it will be overwritten when templates are regenerated
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
release:
types: [published]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
compiler: [gcc, clang, msvc]
exclude:
- os: ubuntu-latest
compiler: msvc
- os: macos-latest
compiler: msvc
- os: macos-latest
compiler: gcc
- os: windows-latest
compiler: gcc
- os: windows-latest
compiler: clang
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Configure CMake
run: cmake --preset=test
- name: Build
run: cmake --build --preset=test
- name: Test
run: ctest --preset=test
install-test:
name: Test Installation (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- name: Build and Install
run: |
cmake --preset=default
cmake --build --preset=default
cmake --install build/default --prefix ${{ runner.temp }}/install
- name: Test find_package
shell: bash
run: |
# Create a minimal test to verify the installation works with find_package
mkdir -p ${{ runner.temp }}/test-find-package
cd ${{ runner.temp }}/test-find-package
# Get project name from CMakeLists.txt
THIS_PROJECT_NAME=$(grep -m1 "project(" ${{ github.workspace }}/CMakeLists.txt | sed 's/project(\(.*\))/\1/' | awk '{print $1}')
# Create test CMakeLists.txt
cat > CMakeLists.txt << EOF
cmake_minimum_required(VERSION 3.20)
project(test-find-package CXX)
set(CMAKE_PREFIX_PATH "${{ runner.temp }}/install")
find_package(${THIS_PROJECT_NAME} REQUIRED)
message(STATUS "Successfully found ${THIS_PROJECT_NAME}")
EOF
# Test find_package
cmake -B build -S .
clang-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Configure CMake with clang-tidy
run: cmake --preset=clang-tidy
- name: Build with clang-tidy
run: cmake --build --preset=clang-tidy
- name: Run tests with clang-tidy
run: ctest --preset=clang-tidy
docs:
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
pages: write
contents: read
steps:
- uses: actions/checkout@v5
- name: Install Doxygen
uses: ssciwr/doxygen-install@v1
- name: Configure CMake
run: cmake --preset=docs
- name: Build Documentation
run: cmake --build --preset=docs
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: build/docs/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4