Skip to content

Merge pull request #4 from stlab/sean-parent/cpp-library-update #43

Merge pull request #4 from stlab/sean-parent/cpp-library-update

Merge pull request #4 from stlab/sean-parent/cpp-library-update #43

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:
name: Test (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
cc: gcc
cxx: g++
- name: Ubuntu Clang
os: ubuntu-latest
cc: clang
cxx: clang++
- name: macOS
os: macos-latest
- name: Windows
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Configure CMake
run: cmake --preset=test
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
if: ${{ matrix.cc }}
- name: Configure CMake
run: cmake --preset=test
if: ${{ !matrix.cc }}
- name: Build
run: cmake --build --preset=test
- name: Test
run: ctest --preset=test
- name: Build and Install
run: |
cmake --preset=default
cmake --build --preset=default
cmake --install build/default --prefix ${{ runner.temp }}/install
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
if: ${{ matrix.cc }}
- name: Build and Install
run: |
cmake --preset=default
cmake --build --preset=default
cmake --install build/default --prefix ${{ runner.temp }}/install
if: ${{ !matrix.cc }}
- 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
# Create test CMakeLists.txt
cat > CMakeLists.txt << EOF
cmake_minimum_required(VERSION 3.20)
project(test-find-package CXX)
find_package(stlab-enum-ops REQUIRED)
message(STATUS "Successfully found stlab-enum-ops")
EOF
# Convert paths to forward slashes for CMake (works on all platforms)
INSTALL_PREFIX=$(echo '${{ runner.temp }}/install' | sed 's|\\|/|g')
# Test find_package with CMAKE_PREFIX_PATH
cmake -B build -S . -DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
clang-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- 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@v6
# ssciwr/[email protected]
- name: Install Doxygen
uses: ssciwr/doxygen-install@501e53b879da7648ab392ee226f5b90e42148449
- 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