Merge pull request #20 from hedzr/dependabot/github_actions/actions/c… #367
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CMake Build Matrix | |
| on: | |
| push: | |
| branches: [master,main] | |
| tags: | |
| - v* | |
| pull_request: | |
| branches: [master,main] | |
| types: [opened, synchronize, closed] | |
| env: | |
| # CMAKE_VERSION: 3.29 | |
| # NINJA_VERSION: 1.11.1 | |
| # CCACHE_VERSION: 3.7.7 | |
| # BUILD_TYPE: Release | |
| CI_RUNNING: 1 | |
| VCPKG_TARGET_TRIPLET: x64-windows | |
| # # 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: "14.0.0" | |
| CLANG_TIDY_VERSION: "19.1.1" | |
| VERBOSE: 1 | |
| jobs: | |
| build: | |
| permissions: | |
| contents: write | |
| discussions: write | |
| security-events: write | |
| name: ${{ matrix.config.name }} ${{ matrix.config.build_type == 'Release' && 'rel' || 'dbg' }} ${{ matrix.config.package_generator }} ${{ matrix.config.build_shared }} | |
| # runs-on: ${{ matrix.config.os }} | |
| # name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build_type}} ${{matrix.packaging_maintainer_mode == 'ON' && '(maintainer mode)' || ''}} | |
| runs-on: ${{ matrix.config.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| # - { | |
| # name: "Windows Latest MSVC", artifact: ".zip", | |
| # os: windows-latest, | |
| # compiler: msvc, | |
| # gcov_executable: gcov-14, | |
| # enable_ipo: OFF, | |
| # build_type: Release, | |
| # generator: "Visual Studio 17 2022", | |
| # packaging_maintainer_mode: OFF, | |
| # package_generator: ZIP, | |
| # build_shared: OFF, | |
| # cc: "cl", cxx: "cl", | |
| # environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
| # tcf: "-D CMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake" | |
| # # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/windows/Windows2022-Readme.md | |
| # } | |
| - { | |
| name: "Ubuntu Latest GCC", artifact: ".deb", | |
| os: ubuntu-latest, | |
| compiler: gcc-14, | |
| gcov_executable: OpenCppCoverage.exe, | |
| enable_ipo: On, | |
| build_type: Release, | |
| generator: "Ninja Multi-Config", # generator: "Unix Makefiles" | |
| packaging_maintainer_mode: ON, | |
| package_generator: DEB, | |
| build_shared: OFF, | |
| cc: "gcc-14", cxx: "g++-14" # for 22.04, gcc-10, 11, 12 are valid. | |
| # cc: "gcc-13", cxx: "g++-13" | |
| # cc: "gcc-14", cxx: "g++-14" | |
| # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/ubuntu/Ubuntu2204-Readme.md | |
| # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/ubuntu/Ubuntu2404-Readme.md | |
| } | |
| - { | |
| name: "Ubuntu Latest LLVM", artifact: ".tbz2", | |
| os: ubuntu-latest, | |
| compiler: llvm-19.1.1, | |
| gcov_executable: "llvm-cov gcov", | |
| enable_ipo: On, | |
| build_type: Debug, | |
| generator: "Ninja Multi-Config", | |
| packaging_maintainer_mode: ON, | |
| package_generator: TBZ2, | |
| build_shared: OFF, | |
| cc: "clang", cxx: "clang++" | |
| } | |
| # - { | |
| # name: "macOS Latest Arm64", artifact: ".dmg", | |
| # os: macos-latest, | |
| # compiler: clang, | |
| # gcov_executable: gcov-14, | |
| # enable_ipo: On, | |
| # build_type: release, | |
| # generator: "Ninja Multi-Config", | |
| # packaging_maintainer_mode: ON, | |
| # package_generator: DragNDrop, # for DMG: "DragNDrop", for PKG: "Bundle" | |
| # build_shared: OFF, | |
| # cc: "clang", cxx: "clang++" | |
| # # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/macos/macos-14-arm64-Readme.md | |
| # # https://github.com/actions/runner-images/releases/tag/macos-14-arm64%2F20240827.4 | |
| # } | |
| # # - { | |
| # # name: "macOS Latest Arm64", artifact: "macOS.7z", | |
| # # os: macos-latest, | |
| # # compiler: llvm-19.1.1, | |
| # # cc: "clang", cxx: "clang++" | |
| # # } | |
| # # macOS Latest Intel not support in free plan | |
| # # - { | |
| # # name: "macOS Latest Intel", artifact: "macOS-intel.7z", | |
| # # os: macos-latest-large, | |
| # # cc: "clang", cxx: "clang++" | |
| # # | |
| # # # https://github.com/actions/runner-images | |
| # # } | |
| # os: | |
| # # - windows-2022 | |
| # # - ubuntu-20.04 | |
| # # - ubuntu-24.04 | |
| # - ubuntu-latest | |
| # - macos-latest | |
| # - windows-latest | |
| # # - macos-14 # arm64 | |
| # # - macos-13 # intel | |
| # compiler: | |
| # # - llvm-14.0.0 | |
| # # - gcc-11 | |
| # # # - llvm | |
| # # # - gcc | |
| # # # you can specify the version after `-` like `llvm-18`. | |
| # - llvm-19.1.1 | |
| # - gcc-14 | |
| # generator: | |
| # - "Ninja Multi-Config" | |
| # build_type: | |
| # - Release | |
| # - Debug | |
| # # developer_mode: | |
| # # - ON | |
| # # - OFF | |
| # packaging_maintainer_mode: | |
| # - ON | |
| # - OFF | |
| # build_shared: | |
| # - OFF | |
| # exclude: | |
| # # mingw is determined by this author to be too buggy to support | |
| # - os: "windows-2022" | |
| # compiler: gcc-11 | |
| # # mingw is determined by this author to be too buggy to support | |
| # - os: windows-latest | |
| # compiler: gcc-14 | |
| # - os: windows-latest | |
| # compiler: llvm-19.1.1 | |
| # # - os: windows-latest | |
| # # developer_mode: ON | |
| # - os: windows-latest | |
| # build_type: Debug | |
| # - os: windows-latest | |
| # compiler: gcc-11 | |
| # - os: windows-latest | |
| # compiler: gcc-14 | |
| # - os: macos-latest | |
| # compiler: gcc-11 | |
| # - os: macos-latest | |
| # compiler: gcc-14 | |
| # - os: macos-latest | |
| # compiler: llvm-19.1.1 | |
| # - os: macos-latest | |
| # build_type: Debug | |
| # - os: macos-13 | |
| # compiler: gcc-11 | |
| # - os: macos-13 | |
| # compiler: gcc-14 | |
| # - os: macos-13 | |
| # compiler: llvm-19.1.1 | |
| # - os: macos-13 | |
| # build_type: Debug | |
| # - os: macos-14 | |
| # compiler: gcc-11 | |
| # - os: macos-14 | |
| # compiler: gcc-14 | |
| # - os: macos-14 | |
| # compiler: llvm-19.1.1 | |
| # - os: macos-14 | |
| # build_type: Debug | |
| # - os: macos-10.15 | |
| # compiler: gcc-11 | |
| # - os: macos-10.15 | |
| # compiler: gcc-14 | |
| # - os: macos-10.15 | |
| # compiler: llvm-19.1.1 | |
| # - os: macos-10.15 | |
| # build_type: Debug | |
| # - os: ubuntu-latest | |
| # compiler: llvm-19.1.1 | |
| # # - os: ubuntu-latest | |
| # # developer_mode: ON | |
| # # - os: ubuntu-latest | |
| # # build_type: Debug | |
| # include: | |
| # # # Add appropriate variables for gcov version required. This will intentionally break | |
| # # # if you try to use a compiler that does not have gcov set | |
| # # - compiler: gcc-11 | |
| # # gcov_executable: gcov | |
| # - compiler: gcc-14 | |
| # gcov_executable: gcov-14 | |
| # enable_ipo: On | |
| # # - compiler: llvm-14.0.0 | |
| # # gcov_executable: "llvm-cov gcov" | |
| # - compiler: llvm-19.1.1 | |
| # enable_ipo: Off | |
| # gcov_executable: "llvm-cov gcov" | |
| # - os: macos-latest | |
| # enable_ipo: Off | |
| # # Set up preferred package generators, for given build configurations | |
| # - build_type: Release | |
| # packaging_maintainer_mode: On | |
| # # developer_mode: OFF | |
| # package_generator: TBZ2 | |
| # # - os: macOS-14 | |
| # # build_type: Release | |
| # # developer_mode: OFF | |
| # # package_generator: DMG | |
| # # - os: macOS-13 | |
| # # build_type: Release | |
| # # developer_mode: OFF | |
| # # package_generator: DMG | |
| # - os: ubuntu-latest | |
| # build_type: Release | |
| # developer_mode: OFF | |
| # package_generator: DEB | |
| # # Windows msvc builds | |
| # - os: windows-latest | |
| # compiler: msvc | |
| # generator: "Visual Studio 17 2022" | |
| # build_type: Debug | |
| # packaging_maintainer_mode: On | |
| # enable_ipo: On | |
| # # - os: windows-latest | |
| # # compiler: msvc | |
| # # generator: "Visual Studio 17 2022" | |
| # # build_type: Release | |
| # # packaging_maintainer_mode: On | |
| # # enable_ipo: On | |
| # # - os: windows-latest | |
| # # compiler: msvc | |
| # # generator: "Visual Studio 17 2022" | |
| # # build_type: Debug | |
| # # packaging_maintainer_mode: Off | |
| # - os: windows-latest | |
| # compiler: msvc | |
| # generator: "Visual Studio 17 2022" | |
| # build_type: Release | |
| # packaging_maintainer_mode: Off | |
| # package_generator: ZIP | |
| # # - os: windows-latest | |
| # # compiler: msvc | |
| # # generator: "Visual Studio 17 2022" | |
| # # build_type: Release | |
| # # packaging_maintainer_mode: On | |
| # # enable_ipo: On | |
| # # build_shared: On | |
| # # - os: windows-2022 | |
| # # compiler: msvc | |
| # # generator: "Visual Studio 17 2022" | |
| # # build_type: Release | |
| # # developer_mode: OFF | |
| # # package_generator: ZIP | |
| # # - os: windows-2022 | |
| # # compiler: msvc | |
| # # generator: "Visual Studio 17 2022" | |
| # # build_type: Debug | |
| # # developer_mode: On | |
| # # - os: windows-2022 | |
| # # compiler: msvc | |
| # # generator: "Visual Studio 17 2022" | |
| # # build_type: Release | |
| # # developer_mode: On | |
| # # - os: windows-2022 | |
| # # compiler: msvc | |
| # # generator: "Visual Studio 17 2022" | |
| # # build_type: Debug | |
| # # developer_mode: Off | |
| # # # This exists solely to make sure a non-multiconfig build works | |
| # # - os: ubuntu-latest | |
| # # compiler: gcc-14 | |
| # # generator: "Unix Makefiles" | |
| # # build_type: Debug | |
| # # gcov_executable: gcov-14 | |
| # # packaging_maintainer_mode: On | |
| # # enable_ipo: Off | |
| # # | |
| # # # ubuntu-20.04 runner could get stuck on github ... | |
| # # # # 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 | |
| # # # developer_mode: On | |
| # config: | |
| # - { | |
| # name: "Windows Latest MSVC", artifact: "Windows-MSVC.7z", | |
| # os: windows-latest, | |
| # cc: "cl", cxx: "cl", | |
| # environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
| # tcf: "-D CMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake" | |
| # | |
| # # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/windows/Windows2022-Readme.md | |
| # } | |
| # #- { | |
| # # name: "Windows Latest MinGW", artifact: "Windows-MinGW.7z", | |
| # # os: windows-latest, | |
| # # cc: "gcc", cxx: "g++" | |
| # #} | |
| # - { | |
| # name: "Ubuntu Latest GCC", artifact: "Linux.7z", | |
| # os: ubuntu-latest, | |
| # cc: "gcc-12", cxx: "g++-12" # for 22.04, gcc-10, 11, 12 are valid. | |
| # # cc: "gcc-13", cxx: "g++-13" | |
| # # cc: "gcc-14", cxx: "g++-14" | |
| # | |
| # # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/ubuntu/Ubuntu2204-Readme.md | |
| # # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/ubuntu/Ubuntu2404-Readme.md | |
| # } | |
| # - { | |
| # name: "macOS Latest Arm64", artifact: "macOS.7z", | |
| # os: macos-latest, | |
| # cc: "clang", cxx: "clang++" | |
| # | |
| # # https://github.com/actions/runner-images/blob/macos-14-arm64/20240827.4/images/macos/macos-14-arm64-Readme.md | |
| # # https://github.com/actions/runner-images/releases/tag/macos-14-arm64%2F20240827.4 | |
| # } | |
| # # macOS Latest Intel not support in free plan | |
| # # - { | |
| # # name: "macOS Latest Intel", artifact: "macOS-intel.7z", | |
| # # os: macos-latest-large, | |
| # # cc: "clang", cxx: "clang++" | |
| # # | |
| # # # https://github.com/actions/runner-images | |
| # # } | |
| steps: | |
| - name: Check for llvm version mismatches | |
| if: ${{ contains(matrix.config.compiler, 'llvm') && !contains(matrix.config.compiler, env.CLANG_TIDY_VERSION) }} | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') | |
| # https://github.com/actions/checkout | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: 'recursive' | |
| # fetch-depth: 0 | |
| # ref: my-branch | |
| # - name: Install dependencies | |
| # if: matrix.os == 'ubuntu-latest' | |
| # # if: runner.os == 'Linux' # Linux, Windows, macOS | |
| # run: | | |
| # sudo apt-get update # ensure indexes are up-to-date | |
| # sudo apt-get install -y libboost-dev | |
| - name: Project Name | |
| uses: cardinalby/export-env-action@v2 | |
| with: | |
| envFile: '.github/constants.env' | |
| - name: Set VERSION variable from tag | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "PROJECT: $PROJECT_NAME" | |
| echo "VERSION: $VERSION" | |
| echo "RELEASE TAGNAME: ${{ github.event.release.tag_name }}" | |
| - name: Set VERSION variable from tag | |
| if: ${{ ! startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| if [ -f .version.cmake ]; then | |
| VERSION="v$(cat .version.cmake|grep -Eo 'VERSION \d+\.\d+\.\d+'|awk '{print $2}')" | |
| else | |
| VERSION="$(git describe --tags --abbrev=0 2>/dev/null || echo v0.0.1)" | |
| fi | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "PROJECT: $PROJECT_NAME" | |
| echo "VERSION: $VERSION" | |
| echo "RELEASE TAGNAME: ${{ github.event.release.tag_name }}" | |
| # - name: Install 7zip | |
| # run: | | |
| # if [ "$RUNNER_OS" == "Linux" ]; then | |
| # sudo apt install -y p7zip-full | |
| # elif [ "$RUNNER_OS" == "Windows" ]; then | |
| # # choco install yaml-cpp | |
| # vcpkg install 7zip | |
| # elif [ "$RUNNER_OS" == "Darwin" ]; then | |
| # # brew install p7zip | |
| # true | |
| # elif [ "$RUNNER_OS" == "macOS" ]; then | |
| # # brew install p7zip | |
| # true | |
| # else | |
| # echo "RUNNER OS ($RUNNER_OS) not supported" | |
| # exit 1 | |
| # fi | |
| # shell: bash | |
| - name: Install yaml-cpp | |
| run: | | |
| if [ "$RUNNER_OS" == "Linux" ]; then | |
| sudo apt install -y libyaml-cpp-dev | |
| elif [ "$RUNNER_OS" == "Windows" ]; then | |
| # choco install yaml-cpp | |
| vcpkg install yaml-cpp:x64-windows | |
| elif [ "$RUNNER_OS" == "Darwin" ]; then | |
| brew install yaml-cpp | |
| elif [ "$RUNNER_OS" == "macOS" ]; then | |
| echo "install yaml-cpp in macOS" | |
| brew install yaml-cpp | |
| # cannot work for arm64 macOS: | |
| # ls -la $(brew --prefix yaml-cpp)/ /usr/local/include/yaml-cpp/ /usr/local/lib/libyaml-cpp* | |
| # ls -la $(brew --prefix yaml-cpp)/ /opt/homebrew/include/yaml-cpp/ /opt/homebrew/lib/libyaml-cpp* | |
| else | |
| echo "$RUNNER_OS not supported" | |
| exit 1 | |
| fi | |
| shell: bash | |
| - name: Cache/CCache | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ./build/ | |
| ~/vcpkg | |
| ~/.cache/vcpkg/archives | |
| ${{ env.LOCALAPPDATA }}/vcpkg/archives | |
| ${{ env.APPDATA }}/vcpkg/archives | |
| ${{ env.XDG_CACHE_HOME }}/vcpkg/archives | |
| ~/.cache/ccache | |
| ~/.ccache | |
| ~/.config/ccache | |
| ~/Library/Caches/ccache | |
| ${{ env.LOCALAPPDATA }}/ccache | |
| ${{ env.XDG_CACHE_HOME }}/ccache | |
| key: ${{ runner.os }}-${{ matrix.config.build_type }}-${{ matrix.config.compiler }}-${{ hashFiles('**/CMakeLists.txt', './vcpkg.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.config.build_type }}- | |
| # https://github.com/aminya/setup-cpp | |
| - name: Setup Cpp | |
| uses: aminya/setup-cpp@v1 | |
| with: | |
| # compiler: llvm # llvm, gcc, msvc, apple-clang, vcvarsall | |
| compiler: ${{ matrix.config.compiler }} | |
| vcvarsall: ${{ contains(matrix.config.os, 'windows' )}} | |
| cmake: true # cmake, ninja, meson, make, task, bazel | |
| ninja: true # | |
| # make: false # | |
| conan: true # vcpkg, conan, choco, brew, apt-fast, nala, git, setup-cpp | |
| vcpkg: true # | |
| cppcheck: true # instead of `true`, which chooses the default version, you can pass a specific version. | |
| ccache: true # | |
| clangtidy: ${{ env.CLANG_TIDY_VERSION }} | |
| # clang-tidy: true # clang-tidy, clang-format, cppcheck, cpplint, flawfinder, lizard, infer, cmakelang, cmake-format, cmake-lint | |
| doxygen: true # | |
| graphviz: true # | |
| gcovr: ${{ ! contains(matrix.config.os, 'windows' )}} | |
| opencppcoverage: ${{ contains(matrix.config.os, 'windows' )}} | |
| # gcovr, opencppcoverage, kcov | |
| # python, powershell, sevenzip, tar | |
| # - name: Cleanup Conan system packages (they are not properly cached) | |
| # run: | | |
| # conan remove -f '*/system' | |
| # # https://github.com/marketplace/actions/setup-ccache-action | |
| # # https://github.com/Chocobo1/setup-ccache-action | |
| # - name: Setup ccache | |
| # uses: Chocobo1/setup-ccache-action@v1 | |
| # with: | |
| # update_packager_index: false | |
| - name: container env tests | |
| # if: matrix.os != 'windows-latest' | |
| if: ${{ ! contains(matrix.config.os, 'windows') }} | |
| shell: bash | |
| run: | | |
| echo "RUNNER_OS: $RUNNER_OS" | |
| echo "VERSION: $VERSION" | |
| echo "RELEASE TAGNAME: ${{ github.event.release.tag_name }}" | |
| echo "uname -p (processor): $(uname -p)" | |
| echo "uname -s (kernel name): $(uname -s)" | |
| echo "uname -r (kernel release): $(uname -r)" | |
| echo "uname -v (kernel version): $(uname -v)" | |
| echo "uname -m (machine): $(uname -m)" | |
| if [ "$RUNNER_OS" != "macOS" ]; then | |
| echo "uname -i (hardware platform): $(uname -i)" | |
| fi | |
| echo "uname -o (operation system): $(uname -o)" | |
| if [ "$RUNNER_OS" == "Linux" ]; then | |
| cat /etc/*-release | |
| fi | |
| - name: cmake env tests | |
| # if: matrix.os != 'windows-latest' | |
| # if: ${{ ! contains(matrix.os, 'windows') }} | |
| shell: cmake -P {0} | |
| run: | | |
| message(STATUS "PROCESSOR_ARCHITEW6432 = ${PROCESSOR_ARCHITEW6432}") | |
| message(STATUS "PROCESSOR_ARCHITECTURE = ${PROCESSOR_ARCHITECTURE}") | |
| message(STATUS "CMAKE_APPLE_SILICON_PROCESSOR = ${CMAKE_APPLE_SILICON_PROCESSOR}") | |
| message(STATUS "CMAKE_SYSTEM = ${CMAKE_SYSTEM}") | |
| message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}") | |
| message(STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}") | |
| message(STATUS "CMAKE_SYSTEM_VERSION = ${CMAKE_SYSTEM_VERSION}") | |
| message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR = ${CMAKE_HOST_SYSTEM_PROCESSOR}") | |
| message(STATUS "CMAKE_HOST_SYSTEM_NAME = ${CMAKE_HOST_SYSTEM_NAME}") | |
| message(STATUS "CMAKE_HOST_SYSTEM_VERSION = ${CMAKE_HOST_SYSTEM_VERSION}") | |
| message(STATUS "CMAKE_HOST_APPLE = ${CMAKE_HOST_APPLE}") | |
| message(STATUS "CMAKE_HOST_LINUX = ${CMAKE_HOST_LINUX}") | |
| message(STATUS "CMAKE_HOST_UNIX = ${CMAKE_HOST_UNIX}") | |
| message(STATUS "CMAKE_HOST_WIN32 = ${CMAKE_HOST_WIN32}") | |
| message(STATUS "CMAKE_HOST_SOLARIS = ${CMAKE_HOST_SOLARIS}") | |
| message(STATUS "CMAKE_HOST_BSD = ${CMAKE_HOST_BSD}") | |
| message(STATUS "CMAKE_LIBRARY_ARCHITECTURE = ${CMAKE_LIBRARY_ARCHITECTURE}") | |
| # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage | |
| # has meaningful results | |
| - name: CMake Configure | |
| run: | | |
| # cmake -S . -B ./build -G "${{matrix.config.generator}}" -DCMAKE_BUILD_TYPE:STRING="${{matrix.config.build_type}}" -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.config.developer_mode}} -DENABLE_COVERAGE:BOOL=${{ matrix.config.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }} | |
| cmake -S . -B ./build -G "${{matrix.config.generator}}" -D${{ env.PROJECT_MACRO_NAME }}_ENABLE_IPO=${{matrix.config.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.build_type}} -D${{ env.PROJECT_MACRO_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.config.packaging_maintainer_mode}} -D${{ env.PROJECT_MACRO_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.config.build_type == 'Debug' }} -DPKG_GENERATOR:STRING=${{matrix.config.package_generator}} -DGIT_SHA:STRING=${{ github.sha }} | |
| - name: CMake Build | |
| id: cmake-build | |
| # Execute the build. You can specify a specific target with "--target <NAME>" | |
| run: | | |
| cmake --build ./build --config "${{matrix.config.build_type}}" | |
| - name: CMake CTests - Unix | |
| # Execute the build. You can specify a specific target with "--target <NAME>" | |
| if: runner.os != 'Windows' && matrix.config.gcov_executable != '' && matrix.config.build_type == 'Debug' | |
| id: cmake-ctest | |
| run: | | |
| export CTEST_OUTPUT_ON_FAILURE=ON | |
| cmake -E chdir ./build ctest -V -C "${{matrix.config.build_type}}" | |
| [ -d ./out/coverage ] || mkdir -pv ./out/coverage | |
| cd ./build | |
| gcovr --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.config.gcov_executable }}' | |
| - name: CMake CTests - Windows | |
| if: runner.os == 'Windows' | |
| working-directory: ./build | |
| run: | | |
| OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -V -C "${{matrix.config.build_type}}" | |
| # - name: Unix - Test and coverage | |
| # if: runner.os != 'Windows' | |
| # working-directory: ./build | |
| # # Execute tests defined by the CMake configuration. | |
| # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
| # run: | | |
| # ctest -C ${{matrix.build_type}} | |
| # gcovr -j ${{env.nproc}} --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' | |
| # - name: Windows - Test and coverage | |
| # if: runner.os == 'Windows' | |
| # working-directory: ./build | |
| # run: | | |
| # OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}} | |
| # - name: Run tests | |
| # if: runner.os != 'Windows' | |
| # shell: cmake -P {0} | |
| # run: | | |
| # include(ProcessorCount) | |
| # ProcessorCount(N) | |
| # set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") | |
| # execute_process( | |
| # COMMAND ctest -V -j ${N} | |
| # WORKING_DIRECTORY build | |
| # RESULT_VARIABLE result | |
| # OUTPUT_VARIABLE output | |
| # ERROR_VARIABLE output | |
| # ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE | |
| # ) | |
| # if (NOT result EQUAL 0) | |
| # string(REGEX MATCH "[0-9]+% tests.*[0-9.]+ sec.*$" test_results "${output}") | |
| # string(REPLACE "\n" "%0A" test_results "${test_results}") | |
| # message("::error::${test_results}") | |
| # message(FATAL_ERROR "Running tests failed!") | |
| # endif() | |
| # - name: Unix - Coverage | |
| # if: runner.os != 'Windows' | |
| # working-directory: ./build | |
| # # Execute tests defined by the CMake configuration. | |
| # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
| # run: | | |
| # ctest -C ${{matrix.build_type}} | |
| # gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' | |
| # - name: Windows - Test and coverage | |
| # if: runner.os == 'Windows' | |
| # working-directory: ./build | |
| # run: | | |
| # OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}} | |
| - name: Install Strip | |
| if: ${{ matrix.config.build_type == 'Release' }} | |
| run: cmake --install build --prefix instdir --strip --config "${{matrix.config.build_type}}" | |
| - name: Pack | |
| working-directory: instdir | |
| if: ${{ matrix.config.build_type == 'Release' && matrix.config.package_generator != '' }} | |
| # if: contains(github.ref, 'tags/v') | |
| run: | | |
| # cmake -E tar cfv ../${{ matrix.config.artifact }} --format=7zip . | |
| cpack -V -G ${{matrix.config.package_generator}} -C "${{matrix.config.build_type}}" --config ../build/CPackConfig.cmake | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2.5.0 # pin to v2.2.1 to solve 422 error, see its issue #616 | |
| if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.config.build_type == 'Release' && matrix.config.package_generator != '' }} | |
| env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ github.token }} | |
| with: | |
| generate_release_notes: true | |
| discussion_category_name: Announcements | |
| # tag_name: ${{ github.ref }} | |
| tag_name: ${{ github.event.release.tag_name }} | |
| # release_name: Release ${{ github.ref }} | |
| draft: false | |
| prerelease: false | |
| append_body: true | |
| preserve_order: true | |
| # body_path: relnotes.md | |
| body: ${{ github.event.head_commit.message }} | |
| # body: | | |
| # This release was created by: ${{ github.event.sender.login }} | |
| # Release of ${{ github.ref }}, built from commit ${{ env.SHORT_SHA }}, is now available. | |
| # files: | | |
| # ./cmdr-*.* | |
| # build/*-*${{ matrix.config.build_type }}*-*.* | |
| files: | | |
| build/packages/*${{ matrix.config.artifact }} | |
| # - name: Publish to codecov | |
| # uses: codecov/codecov-action@v2 | |
| # with: | |
| # flags: ${{ runner.os }} | |
| # name: ${{ runner.os }}-coverage | |
| # files: ./build/coverage.xml |