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.
All of this is under the MIT License.
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: ''
- 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.