diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 59087d8..8c97a25 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -15,7 +15,7 @@ jobs: shell: bash steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 2 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..66c64e1 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,63 @@ +name: linux + +on: + pull_request: + branches: + - develop + - master + push: + branches: + - develop + - master + +jobs: + build: + env: + VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' + strategy: + fail-fast: false + matrix: + os: + - ubuntu-22.04 + cxx: + - g++-11 + - clang++-14 + include: + - cxx: g++-11 + cc: gcc-11 + - cxx: clang++-14 + cc: clang-14 + runs-on: ${{matrix.os}} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Add C++ Problem Matcher + uses: ammaraskar/gcc-problem-matcher@0.2.0 + - name: Install Dependencies + run: | + sudo apt-get -y install ninja-build + - name: Setup NuGet Credentials + shell: bash + run: | + mono `vcpkg fetch nuget | tail -n 1` \ + sources add \ + -source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" \ + -storepasswordincleartext \ + -name "GitHub" \ + -username "BlueQuartzSoftware" \ + -password "${{secrets.GITHUB_TOKEN}}" + mono `vcpkg fetch nuget | tail -n 1` \ + setapikey "${{secrets.GITHUB_TOKEN}}" \ + -source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" + - name: Configure + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + run: | + cmake --preset ci-linux-x64 ${{github.workspace}} + - name: Build + run: | + cmake --build --preset ci-linux-x64 + - name: Test + run: | + ctest --preset ci-linux-x64 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..6803b67 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,66 @@ +name: macos + +on: + pull_request: + branches: + - develop + - master + push: + branches: + - develop + - master + +jobs: + build: + env: + VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' + strategy: + fail-fast: false + matrix: + os: + - macos-14 + - macos-15 + include: + - os: macos-14 + preset: ci-macos-arm64 + - os: macos-15 + preset: ci-macos-arm64 + runs-on: ${{matrix.os}} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup vcpkg + run: | + if [ -z "$VCPKG_INSTALLATION_ROOT" ] || [ ! -d "$VCPKG_INSTALLATION_ROOT" ]; then + git clone https://www.github.com/microsoft/vcpkg && cd vcpkg && ./bootstrap-vcpkg.sh + VCPKG_INSTALLATION_ROOT=${{github.workspace}}/vcpkg + echo "$VCPKG_INSTALLATION_ROOT" >> $GITHUB_PATH + echo "VCPKG_INSTALLATION_ROOT=$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV" + fi + - name: Add C++ Problem Matcher + uses: ammaraskar/gcc-problem-matcher@0.2.0 + - name: Install Dependencies + run: | + brew install ninja mono + - name: Setup NuGet Credentials + shell: bash + run: | + mono `vcpkg fetch nuget | tail -n 1` \ + sources add \ + -source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" \ + -storepasswordincleartext \ + -name "GitHub" \ + -username "BlueQuartzSoftware" \ + -password "${{secrets.GITHUB_TOKEN}}" + mono `vcpkg fetch nuget | tail -n 1` \ + setapikey "${{secrets.GITHUB_TOKEN}}" \ + -source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" + - name: Configure + run: | + cmake --preset ${{matrix.preset}} ${{github.workspace}} + - name: Build + run: | + cmake --build --preset ${{matrix.preset}} + - name: Test + run: | + ctest --preset ${{matrix.preset}} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..06fa06f --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,55 @@ +name: windows + +on: + pull_request: + branches: + - develop + - master + push: + branches: + - develop + - master + +jobs: + build: + env: + VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' + strategy: + fail-fast: false + matrix: + os: + - windows-2022 + toolset: + - v143 + runs-on: ${{matrix.os}} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Add C++ Problem Matcher + uses: ammaraskar/msvc-problem-matcher@0.2.0 + - name: Setup Build Environment + uses: ilammy/msvc-dev-cmd@v1.12.1 + with: + vsversion: 2022 + - name: Setup NuGet Credentials + shell: bash + run: | + `vcpkg fetch nuget | tail -n 1` \ + sources add \ + -source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" \ + -storepasswordincleartext \ + -name "GitHub" \ + -username "BlueQuartzSoftware" \ + -password "${{secrets.GITHUB_TOKEN}}" + `vcpkg fetch nuget | tail -n 1` \ + setapikey "${{secrets.GITHUB_TOKEN}}" \ + -source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" + - name: Configure + run: | + cmake --preset ci-windows-${{matrix.toolset}} ${{github.workspace}} -T ${{matrix.toolset}} + - name: Build + run: | + cmake --build --preset ci-windows-${{matrix.toolset}} + - name: Test + run: | + ctest --preset ci-windows-${{matrix.toolset}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 3630cfa..ae6dc0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,6 +164,7 @@ include(${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/SourceList.cmake) # Build Unit Test # ------------------------------------------------------------------------------ if(EbsdLib_BUILD_TESTS) + enable_testing() include(${EbsdLibProj_SOURCE_DIR}/Source/Test/CMakeLists.txt) endif() diff --git a/CMakePresets.json b/CMakePresets.json index 93c115a..9c0a6f7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -141,9 +141,6 @@ "type": "STRING", "value": "Debug" } - }, - "environment": { - "VCPKG_INSTALLATION_ROOT": "/opt/local/vcpkg" } }, { @@ -160,14 +157,7 @@ "VCPKG_HOST_TRIPLET": { "type": "STRING", "value": "x64-linux-dynamic" - }, - "CMAKE_MAKE_PROGRAM": { - "type": "FILEPATH", - "value": "$env{VCPKG_INSTALLATION_ROOT}/downloads/tools/ninja/1.10.2-linux/ninja" } - }, - "environment": { - "VCPKG_INSTALLATION_ROOT": "/opt/local/vcpkg" } } ], diff --git a/Source/Test/CMakeLists.txt b/Source/Test/CMakeLists.txt index 9da60f9..4ce5822 100644 --- a/Source/Test/CMakeLists.txt +++ b/Source/Test/CMakeLists.txt @@ -52,4 +52,6 @@ if(MSVC) set_source_files_properties(${EbsdLibProj_BINARY_DIR}/EbsdLibUnitTest.cpp PROPERTIES COMPILE_FLAGS /bigobj) endif() +catch_discover_tests(${UNIT_TEST_TARGET} TEST_PREFIX "EbsdLib::") + get_property(EbsdLib_EXTRA_LIBRARY_DIRS GLOBAL PROPERTY EbsdLib_EXTRA_LIBRARY_DIRS)