Skip to content

Commit

Permalink
chore: workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Becheler committed Sep 21, 2024
1 parent a9e6b55 commit 2762ca2
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 37 deletions.
98 changes: 62 additions & 36 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,38 @@ env:

jobs:
build:
runs-on: ubuntu-24.04

name: "C++${{ matrix.std }} ${{ matrix.config.name }} ${{ matrix.build_type }}"
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
build_type: ["Release", "Debug"]
std: [20, 23]
config:
- {
name: "GCC-12",
os: ubuntu-24.04,
compiler:
{
type: GCC,
version: 12,
cc: "gcc-12",
cxx: "g++-12",
},
conan-config: "",
}
- {
name: "GCC-13",
os: ubuntu-24.04,
compiler:
{
type: GCC,
version: 13,
cc: "gcc-13",
cxx: "g++-13",
},
conan-config: "",
}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -23,66 +53,62 @@ jobs:
run: >
sudo apt-get update -y &&
sudo apt-get install -y --no-install-recommends
vim
git
gcc-13
g++-13
build-essential
cmake
unzip
tar
ca-certificates
doxygen
graphviz
pipx
- name: Conan installation
run: pipx install conan
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Conan version
run: echo "${{ steps.conan.outputs.version }}"
- name: Conan installation
run: |
pip install -U conan
- name: Cache Conan
uses: actions/cache@v4
if: always()
env:
cache-name: cache-conan-data
with:
path: ~/.conan2/p
key: ${{ runner.os }}-conan-${{ hashFiles('conanfile.txt') }}
restore-keys: |
${{ runner.os }}-conan-
key: ${{ matrix.config.os }}-{{ matrix.std }}-${{ matrix.config.name }}-${{ matrix.build_type }}-${{ hashFiles('conanfile.txt') }}

- name: Conan Configure
shell: bash
run: |
conan profile detect --force
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.std }}/' ~/.conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default
conan profile show -pr default
- name: Conan install dependencies
- name: Conan Install
run: >
conan install conanfile.py
--profile:build=conan/profiles/linux-x86-gcc13-debug
--profile:host=conan/profiles/linux-x86-gcc13-debug
--build=missing
--profile:build=~/.conan2/profiles/default
--profile:host=~/.conan2/profiles/default
--build=missing
--output-folder=build
- name: CMake configuration
run: >
cmake
-B ${{github.workspace}}/build
-S .
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DBUILD_TESTS=ON
--toolchain ${{github.workspace}}/build/conan_toolchain.cmake
- name: CMake build
run: >
cmake
--build ${{github.workspace}}/build
--config ${{env.BUILD_TYPE}}
--config ${{ matrix.build_type }}
- name: CMake test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure

- name: Doxygen documentation generation
working-directory: ${{github.workspace}}/build
run: make docs

- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{github.workspace}}/build/docs/html
run: >
ctest
-C ${{ matrix.build_type }}
--rerun-failed
--output-on-failure
90 changes: 90 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Documentation and Examples

on:
push:
branches: [ master ]

env:
BUILD_TYPE: Debug
STD: 23

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Get Apt packages
run: >
sudo apt-get update -y &&
sudo apt-get install -y --no-install-recommends
build-essential
cmake
doxygen
graphviz
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Set Up Conan
run: pip install conan==2.0.13

- name: Cache Conan
uses: actions/cache@v4
if: always()
env:
cache-name: cache-conan-data
with:
path: ~/.conan2/p
key: documentation-${{ hashFiles('conanfile.txt') }}

- name: Conan Configure
shell: bash
run: |
conan profile detect --force
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{env.STD}}/' ~/.conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{env.BUILD_TYPE}}/' ~/.conan2/profiles/default
conan profile show -pr default
- name: Conan Install
run: >
conan install conanfile.py
--profile:build=~/.conan2/profiles/default
--profile:host=~/.conan2/profiles/default
--build=missing
--output-folder=build
- name: CMake Configure
run: >
cmake
-B ${{github.workspace}}/build
-S .
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DBUILD_TESTS=ON
--toolchain ${{github.workspace}}/build/conan_toolchain.cmake
- name: CMake Build
run: >
cmake
--build ${{github.workspace}}/build
--config ${{env.BUILD_TYPE}}
- name: CMake Test
working-directory: ${{github.workspace}}/build
run: ctest -L "example"

- name: Doxygen Generation
working-directory: ${{github.workspace}}/build
run: make docs

- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{github.workspace}}/build/docs/html
5 changes: 4 additions & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ foreach(testSrc ${SRCS})
add_test(
NAME ${testName}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/example
COMMAND sh -c "$<TARGET_FILE:${testName}> > output/${testName}.txt" )
COMMAND sh -c "$<TARGET_FILE:${testName}> > output/${testName}.txt" )

set_tests_properties(${testName} PROPERTIES LABELS "documentation example")

endforeach(testSrc)

0 comments on commit 2762ca2

Please sign in to comment.