Skip to content

A GitHub action to run unit tests on a repository using CTest

License

Notifications You must be signed in to change notification settings

HorstBaerbel/action-ctest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

action-ctest - A GitHub action to run unit tests on a repository using CTest

License: MIT

Builds a repository using CMake, then runs unit tests using CTest.

If you find a bug or make an improvement your pull requests are appreciated.

License

All of this is under the MIT License.

Usage

Create a new workflow file, e.g. ./github/workflows/test.yml:

# Run unit tests using CTest
name: Tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  checkout-and-check-formatting:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Run unit tests
      uses: HorstBaerbel/action-ctest@1.1
      # These are optional (defaults displayed)
      with:
        sourcedir: '.'
        builddir: 'build'
        cmakeoptions: '--config Release'
        ctestoptions: ''

Parameters (optional), see action.yml

  • sourcedir: Directory with top-level CMakeLists.txt. MUST be realtive to you repository, thus '.' means root of repository.
  • builddir: Directory to run CMake build in, e.g. 'build'. MUST be relative to sourcedir, thus 'build' means 'sourcedir/build'.
  • cmakeoptions: Pass an additional option string to cmake (will call "cmake cmakeoptions sourcedir").
  • ctestoptions: Pass an additional option string to CTest (will call "ctest --output-on-failure ctestoptions"). Add "--debug --extra-verbose" to get more debug output from tests.