From b364def9457478b395d196654b7a24be51116ebf Mon Sep 17 00:00:00 2001 From: Andreas Schuh Date: Mon, 31 Mar 2025 23:33:08 +0100 Subject: [PATCH] test: Add GitHub Action to run CTest (#368) * test: Remove Travis CI and Appveyor config files * test: Add GitHub Action to run CTest on Ubuntu --- .github/workflows/test.yml | 48 +++++++++++++++++++++++++++ .travis.yml | 20 ----------- appveyor.yml | 68 -------------------------------------- 3 files changed, 48 insertions(+), 88 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2487abf --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,48 @@ +name: Build and Run Tests + +on: + pull_request: + branches: + - master + +concurrency: + group: check-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + test: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + # - macos-latest + # - windows-latest + cmake: + - '4.0' + - '3.31' + fail-fast: false + permissions: + contents: write + steps: + - name: Checkout Project + uses: actions/checkout@v4 + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 + with: + cmake-version: ${{ matrix.cmake }} + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6 + - name: Configure CMake + run: | + cmake -B build -G Ninja \ + -D CMAKE_CXX_COMPILER=clang++ \ + -D CMAKE_BUILD_TYPE=Release \ + -D GFLAGS_BUILD_SHARED_LIBS=ON \ + -D GFLAGS_BUILD_STATIC_LIBS=ON \ + -D GFLAGS_BUILD_TESTING=ON + - name: Build Tests + run: cmake --build build --config Release + - name: Run Tests + run: cd build && ctest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0989c7c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Ubuntu 14.04 Trusty support, to get newer cmake and compilers. -sudo: required -dist: trusty - -language: cpp - -os: - - linux - - osx - -compiler: - - clang - - gcc - -env: - - CONFIG=Release - - CONFIG=Debug - -script: - - mkdir out && cd out && cmake -D CMAKE_BUILD_TYPE=$CONFIG -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON -D GFLAGS_BUILD_TESTING=ON .. && cmake --build . --config $CONFIG && ctest diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index a5110e5..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Configuration for continuous integration service at appveyor.com - -version: '{build}' - -os: Visual Studio 2015 - -environment: - matrix: - - Toolset: v140 - - Toolset: v120 - - Toolset: v110 - - Toolset: v100 - - Toolset: v90 - -platform: - - Win32 - - x64 - -configuration: - - Release - -matrix: - exclude: - - Toolset: v90 - platform: x64 - - Toolset: v100 - platform: x64 - -build: - verbosity: minimal - -before_build: -- ps: | - Write-Output "Configuration: $env:CONFIGURATION" - Write-Output "Platform: $env:PLATFORM" - $generator = switch ($env:TOOLSET) - { - "v140" {"Visual Studio 14 2015"} - "v120" {"Visual Studio 12 2013"} - "v110" {"Visual Studio 11 2012"} - "v100" {"Visual Studio 10 2010"} - "v90" {"Visual Studio 9 2008"} - } - if ($env:PLATFORM -eq "x64") - { - $generator = "$generator Win64" - } - -build_script: -- ps: | - md _build -Force | Out-Null - cd _build - - & cmake -G "$generator" -D CMAKE_CONFIGURATION_TYPES="Debug;Release" -D GFLAGS_BUILD_TESTING=ON -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON .. - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - & cmake --build . --config $env:CONFIGURATION - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - -test_script: -- ps: | - & ctest -C $env:CONFIGURATION --output-on-failure - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - }