Skip to content

Commit

Permalink
Update build system / move to CPM (#7)
Browse files Browse the repository at this point in the history
* Update build system / move to CPM
  • Loading branch information
lefticus committed Apr 21, 2023
1 parent 3c2fcc2 commit 5eef464
Show file tree
Hide file tree
Showing 39 changed files with 1,652 additions and 581 deletions.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: lefticus
patreon: lefticus
109 changes: 85 additions & 24 deletions .github/workflows/ci.yml
Expand Up @@ -3,17 +3,16 @@ on:
pull_request:
release:
types: [published]

push:
tags:
branches:
- main
- develop

env:
# Conan cache environment variables
CONAN_SYSREQUIRES_MODE: enabled
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
CLANG_TIDY_VERSION: "15.0.2"
VERBOSE: 1

jobs:
Test:
Expand All @@ -34,17 +33,19 @@ jobs:
- macos-10.15
- windows-2019
compiler:
# you can specify the version after `-` like "llvm-13.0.0".
- llvm-13.0.0
# you can specify the version after `-` like "llvm-15.0.2".
- llvm-15.0.2
- gcc-11
generator:
- "Ninja Multi-Config"
build_type:
- Release
- Debug
developer_mode:
package_maintainer_mode:
- ON
- OFF
build_shared:
- OFF

exclude:
# mingw is determined by this author to be too buggy to support
Expand All @@ -56,50 +57,107 @@ jobs:
# if you try to use a compiler that does not have gcov set
- compiler: gcc-11
gcov_executable: gcov
- compiler: llvm-13.0.0
enable_ipo: On

- compiler: llvm-15.0.2
enable_ipo: Off
gcov_executable: "llvm-cov gcov"

- os: macos-10.15
enable_ipo: Off
enable_cppcheck: OFF
enable_clang_tidy: OFF

- os: ubuntu-20.04
enable_clang_tidy: On
enable_cppcheck: On


# Set up preferred package generators, for given build configurations
- build_type: Release
developer_mode: OFF
package_maintainer_mode: OFF
package_generator: TBZ2

# This exists solely to make sure a non-multiconfig build works
- os: ubuntu-20.04
compiler: gcc-11
generator: "Unix Makefiles"
build_type: Debug
gcov_executable: gcov
package_maintainer_mode: On
enable_ipo: Off
enable_clang_tidy: On
enable_cppcheck: On


# Windows msvc builds
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
developer_mode: On
package_maintainer_mode: On
enable_ipo: On
enable_clang_tidy: Off
enable_cppcheck: Off


- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
developer_mode: On
package_maintainer_mode: On
enable_ipo: On
enable_clang_tidy: Off
enable_cppcheck: Off


- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
developer_mode: Off
package_maintainer_mode: Off
enable_clang_tidy: Off
enable_cppcheck: Off


- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
developer_mode: Off
package_maintainer_mode: Off
package_generator: ZIP
enable_clang_tidy: Off
enable_cppcheck: Off


- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
package_maintainer_mode: On
enable_ipo: On
build_shared: On
enable_clang_tidy: Off
enable_cppcheck: Off



steps:
- name: Check for llvm version mismatches
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen')
- uses: actions/checkout@v2

- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
developer_mode: ${{ matrix.developer_mode }}
package_maintainer_mode: ${{ matrix.package_maintainer_mode }}
generator: ${{ matrix.generator }}

- name: Setup Cpp
Expand All @@ -110,25 +168,19 @@ jobs:

cmake: true
ninja: true
conan: true
vcpkg: false
ccache: true
clangtidy: true
clangtidy: ${{ env.CLANG_TIDY_VERSION }}


cppcheck: true

gcovr: 5.0
gcovr: true
opencppcoverage: true

- name: Cleanup Conan system packages (they are not properly cached)
run: |
conan remove -f '*/system'
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
# has meaningful results
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}
cmake -S . -B ./build -G "${{matrix.generator}}" -Dtravels_ENABLE_CLANG_TIDY:BOOL=${{ matrix.enable_clang_tidy }} -Dtravels_ENABLE_CPPCHECK:BOOL=${{ matrix.enable_cppcheck }} -Dtravels_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -Dtravels_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.package_maintainer_mode}} -Dtravels_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}
- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
Expand Down Expand Up @@ -156,6 +208,15 @@ jobs:
run: |
cpack -C ${{matrix.build_type}} -G ${{matrix.package_generator}}
- name: Publish Snapshot Release
uses: softprops/action-gh-release@v1
if: ${{ (github.ref == 'refs/heads/main') && matrix.package_generator != '' }}
with:
tag_name: "snapshot-${{ github.sha }}"
files: |
build/*-*${{ matrix.build_type }}*-*.*
- name: Publish Tagged Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }}
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -20,12 +20,6 @@ on:
schedule:
- cron: '38 0 * * 5'

env:
# Conan cache environment variables
CONAN_SYSREQUIRES_MODE: enabled
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"


jobs:
analyze:
Expand All @@ -49,8 +43,8 @@ jobs:
- "Ninja Multi-Config"
build_type:
- Debug
developer_mode:
- OFF
packaging_maintainer_mode:
- ON


steps:
Expand All @@ -61,7 +55,7 @@ jobs:
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
developer_mode: ${{ matrix.developer_mode }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
generator: ${{ matrix.generator }}


Expand All @@ -73,7 +67,6 @@ jobs:

cmake: true
ninja: true
conan: true
vcpkg: false
ccache: true
clangtidy: false
Expand All @@ -83,15 +76,11 @@ jobs:
gcovr: false
opencppcoverage: false

- name: Cleanup Conan system packages (they are not properly cached)
run: |
conan remove -f '*/system'
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
# has meaningful results
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }}
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -Dtravels_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -Dtravels_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down

0 comments on commit 5eef464

Please sign in to comment.