⬆️ Updated catch2 to 3.3
This commit is contained in:
parent
e39895cf6f
commit
d4190e7ba5
113
.github/workflows/main.yml
vendored
113
.github/workflows/main.yml
vendored
@ -1,21 +1,110 @@
|
|||||||
name: Build & Test
|
name: Build
|
||||||
on: [ push, pull_request ]
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-msvc:
|
||||||
name: Testing on ${{ matrix.os }}
|
name: Windows
|
||||||
runs-on: ${{ matrix.os }}
|
env:
|
||||||
strategy:
|
BUILD_TOOLS_PATH: C:\Program Files\Conan\conan
|
||||||
fail-fast: false
|
CONAN_USER_HOME_SHORT: None
|
||||||
matrix:
|
runs-on: windows-latest
|
||||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
steps:
|
||||||
|
- run: echo $env:BUILD_TOOLS_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache conan
|
||||||
|
uses: actions/cache@v3.2.5
|
||||||
|
with:
|
||||||
|
key: conan-win-${{ hashFiles('conanfile.txt') }}
|
||||||
|
path: ~/.conan/
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: choco install conan ninja -y
|
||||||
|
|
||||||
|
- name: Enable Developer Command Prompt
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1.12.1
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
conan config set storage.download_cache="$env:TMP"
|
||||||
|
conan install . -b missing -pr:b=tools/conan-profiles/vs-22-release-ninja -pr=tools/conan-profiles/vs-22-release-ninja
|
||||||
|
cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
|
||||||
|
ninja
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ctest -j2 --output-on-failure
|
||||||
|
|
||||||
|
- name: Clean Conan pkgs
|
||||||
|
run: conan remove "*" -fsb
|
||||||
|
|
||||||
|
build-gcc:
|
||||||
|
name: Linux
|
||||||
|
env:
|
||||||
|
CONAN_SYSREQUIRES_MODE: "enabled"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache conan
|
||||||
|
uses: actions/cache@v3.2.5
|
||||||
|
with:
|
||||||
|
key: conan-linux-${{ hashFiles('conanfile.txt') }}
|
||||||
|
path: ~/.conan/
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-cmake.sh" | sudo bash
|
||||||
|
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
|
||||||
|
sudo apt-get -y install ninja-build
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: cmake -DBUILD_TEST=ON .
|
run: |
|
||||||
|
conan profile new --detect --force default
|
||||||
|
conan profile update conf.tools.cmake.cmaketoolchain:generator="Ninja" default
|
||||||
|
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||||
|
conan install . -s build_type=Release -b missing -pr:b=default
|
||||||
|
cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DBUILD_TEST=ON
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build .
|
run: |
|
||||||
|
ninja
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ctest -C Debug .
|
run: ctest -j2 --output-on-failure
|
||||||
|
|
||||||
|
- name: Clean Conan pkgs
|
||||||
|
run: conan remove "*" -fsb
|
||||||
|
|
||||||
|
build-appleclang:
|
||||||
|
name: MacOS
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache conan
|
||||||
|
uses: actions/cache@v3.2.5
|
||||||
|
with:
|
||||||
|
key: conan-mac-${{ hashFiles('conanfile.txt') }}
|
||||||
|
path: ~/.conan/
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: brew install conan ninja
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
conan profile new --detect --force default
|
||||||
|
conan profile update conf.tools.cmake.cmaketoolchain:generator="Ninja" default
|
||||||
|
conan install . -s build_type=Release -b missing -pr:b=default
|
||||||
|
cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DBUILD_TEST=ON
|
||||||
|
ninja
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ctest -j2 --output-on-failure
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Clean Conan pkgs
|
||||||
|
run: conan remove "*" -fsb
|
63
.github/workflows/sonarcloud.yml
vendored
63
.github/workflows/sonarcloud.yml
vendored
@ -5,49 +5,67 @@ on:
|
|||||||
- master
|
- master
|
||||||
- dev
|
- dev
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [ opened, synchronize, reopened ]
|
types: [opened, synchronize, reopened]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: sonarcloud scan
|
name: sonarcloud scan
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
SONAR_SCANNER_VERSION: 4.7.0.2747
|
CONAN_SYSREQUIRES_MODE: "enabled"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set up JDK 11
|
|
||||||
uses: actions/setup-java@v1
|
- name: Install sonar-scanner and build-wrapper
|
||||||
with:
|
uses: sonarsource/sonarcloud-github-c-cpp@v1
|
||||||
java-version: 11
|
id: sonarscan
|
||||||
|
|
||||||
- name: Download and set up sonar-scanner
|
- name: Download and set up sonar-scanner
|
||||||
env:
|
|
||||||
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $HOME/.sonar
|
|
||||||
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
|
|
||||||
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
|
|
||||||
wget -nv https://cdn.anotherfoxguy.com/sonar-scanner/mofilereader -O run-sonar-scanner
|
wget -nv https://cdn.anotherfoxguy.com/sonar-scanner/mofilereader -O run-sonar-scanner
|
||||||
sudo chmod 777 run-sonar-scanner
|
sudo chmod 777 run-sonar-scanner
|
||||||
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Download and set up build-wrapper
|
- name: Prepare cfamily cache timestamp
|
||||||
env:
|
id: cfamily_cache_timestamp
|
||||||
BUILD_WRAPPER_DOWNLOAD_URL: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
|
shell: cmake -P {0}
|
||||||
run: |
|
run: |
|
||||||
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
|
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
||||||
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
|
message("::set-output name=timestamp::${current_date}")
|
||||||
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
|
|
||||||
|
- name: cfamily cache files
|
||||||
|
uses: actions/cache@v3.2.5
|
||||||
|
with:
|
||||||
|
path: cfamily-cache
|
||||||
|
key: cfamily-cache-${{ steps.cfamily_cache_timestamp.outputs.timestamp }}
|
||||||
|
restore-keys: |
|
||||||
|
cfamily-cache-
|
||||||
|
|
||||||
|
- name: Cache conan
|
||||||
|
uses: actions/cache@v3.2.5
|
||||||
|
with:
|
||||||
|
key: conan-linux-${{ hashFiles('conanfile.txt') }}
|
||||||
|
path: ~/.conan/
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-cmake.sh" | sudo bash
|
||||||
|
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TEST=ON -DENABLE_COVERAGE=ON .
|
run: |
|
||||||
|
conan profile new --detect --force default
|
||||||
|
conan profile update conf.tools.cmake.cmaketoolchain:generator="Ninja" default
|
||||||
|
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||||
|
conan install . -s build_type=Release -b missing -pr:b=default
|
||||||
|
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST=ON -DENABLE_COVERAGE=ON -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
|
||||||
|
|
||||||
- name: Run build-wrapper
|
- name: Run build-wrapper
|
||||||
run: build-wrapper-linux-x86-64 --out-dir bw-output make -j4
|
run: build-wrapper-linux-x86-64 --out-dir bw-output make -j4
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ctest --output-on-failure .
|
continue-on-error: true
|
||||||
|
run: ctest -j2 --output-on-failure
|
||||||
|
|
||||||
- name: Generate coverage
|
- name: Generate coverage
|
||||||
run: make gcov
|
run: make gcov
|
||||||
@ -55,5 +73,8 @@ jobs:
|
|||||||
- name: Run sonar-scanner
|
- name: Run sonar-scanner
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_SCANNER_EXE: /home/runner/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin/sonar-scanner
|
SONAR_SCANNER_EXE: ${{ steps.sonarscan.outputs.sonar-scanner-binary }}
|
||||||
run: ./run-sonar-scanner
|
run: ./run-sonar-scanner
|
||||||
|
|
||||||
|
- name: Clean Conan pkgs
|
||||||
|
run: conan remove "*" -fsb
|
@ -3,10 +3,10 @@
|
|||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
include(CMakeCM)
|
include(CMakeCM)
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
project(moFileReader)
|
project(moFileReader)
|
||||||
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
set(Catch2_FOUND TRUE)
|
|
||||||
|
|
||||||
set(CATCH2_VERSION "v2.13.9")
|
|
||||||
set(CATCH2_INCLUDEDIR "${CMAKE_BINARY_DIR}/catch-${CATCH2_VERSION}")
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CATCH2_INCLUDEDIR}")
|
|
||||||
|
|
||||||
if (NOT EXISTS "${CATCH2_INCLUDEDIR}/catch.hpp")
|
|
||||||
file(MAKE_DIRECTORY "${CATCH2_INCLUDEDIR}")
|
|
||||||
message(STATUS "Downloading catch.hpp from https://github.com/catchorg/Catch2/")
|
|
||||||
file(DOWNLOAD "https://github.com/catchorg/Catch2/releases/download/${CATCH2_VERSION}/catch.hpp" "${CATCH2_INCLUDEDIR}/catch.hpp")
|
|
||||||
file(DOWNLOAD "https://github.com/catchorg/Catch2/releases/download/${CATCH2_VERSION}/catch_reporter_sonarqube.hpp" "${CATCH2_INCLUDEDIR}/catch_reporter_sonarqube.hpp")
|
|
||||||
file(DOWNLOAD "https://cdn.statically.io/gh/catchorg/Catch2/${CATCH2_VERSION}/contrib/Catch.cmake" "${CATCH2_INCLUDEDIR}/Catch.cmake")
|
|
||||||
file(DOWNLOAD "https://cdn.statically.io/gh/catchorg/Catch2/${CATCH2_VERSION}/contrib/CatchAddTests.cmake" "${CATCH2_INCLUDEDIR}/CatchAddTests.cmake")
|
|
||||||
file(DOWNLOAD "https://cdn.statically.io/gh/catchorg/Catch2/${CATCH2_VERSION}/contrib/ParseAndAddCatchTests.cmake" "${CATCH2_INCLUDEDIR}/ParseAndAddCatchTests.cmake")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_library(Catch2::Catch2 INTERFACE IMPORTED)
|
|
||||||
set_target_properties(Catch2::Catch2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CATCH2_INCLUDEDIR}")
|
|
14
conanfile.py
14
conanfile.py
@ -1,14 +0,0 @@
|
|||||||
from conans import ConanFile
|
|
||||||
|
|
||||||
|
|
||||||
class MofilereaderConan(ConanFile):
|
|
||||||
name = "MofileReader"
|
|
||||||
version = "1.1.0"
|
|
||||||
license = "MIT"
|
|
||||||
url = "https://github.com/AnotherFoxGuy/MofileReader/"
|
|
||||||
description = "This API lets you read .mo-Files and use their content just as you would do with GNUs gettext."
|
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
|
||||||
exports_sources = "include*"
|
|
||||||
|
|
||||||
def package(self):
|
|
||||||
self.copy("*.hpp", "include", "include")
|
|
12
conanfile.txt
Normal file
12
conanfile.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[requires]
|
||||||
|
catch2/3.3.1
|
||||||
|
|
||||||
|
[generators]
|
||||||
|
CMakeDeps
|
||||||
|
CMakeToolchain
|
||||||
|
|
||||||
|
[imports]
|
||||||
|
bin, *.dll -> bin @ keep_path=False
|
||||||
|
lib, *.dll -> bin @ keep_path=False
|
||||||
|
lib, *.dylib -> bin @ keep_path=False
|
||||||
|
lib, *.so* -> bin @ keep_path=False
|
@ -1,14 +1,15 @@
|
|||||||
project(moFileReaderTest)
|
project(moFileReaderTest)
|
||||||
|
|
||||||
find_package(Catch2 REQUIRED)
|
find_package(Catch2 REQUIRED)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
include(codecov)
|
include(codecov)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} main.cpp test.cpp link_test.cpp)
|
add_executable(${PROJECT_NAME} test.cpp link_test.cpp)
|
||||||
target_include_directories(moFileReaderTest PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
target_include_directories(moFileReaderTest PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2)
|
target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2WithMain)
|
||||||
catch_discover_tests(${PROJECT_NAME} REPORTER sonarqube OUTPUT_DIR reports)
|
catch_discover_tests(${PROJECT_NAME})
|
||||||
add_coverage(${PROJECT_NAME})
|
add_coverage(${PROJECT_NAME})
|
||||||
coverage_evaluate()
|
coverage_evaluate()
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "catch.hpp"
|
#include <catch2/catch_all.hpp>
|
||||||
#include "moFileReader.hpp"
|
#include "moFileReader.hpp"
|
||||||
|
|
||||||
using namespace moFileLib;
|
using namespace moFileLib;
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#define CATCH_CONFIG_MAIN
|
|
||||||
#include "catch.hpp"
|
|
||||||
#include "catch_reporter_sonarqube.hpp"
|
|
@ -1,4 +1,4 @@
|
|||||||
#include "catch.hpp"
|
#include <catch2/catch_all.hpp>
|
||||||
#include "moFileReader.hpp"
|
#include "moFileReader.hpp"
|
||||||
|
|
||||||
using namespace moFileLib;
|
using namespace moFileLib;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user