From efcfd441d352e075c7959e5d9c79e9d7fb86da4c Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 19 May 2020 08:16:36 -0500 Subject: [PATCH] Add ability to pass CMake args Signed-off-by: Michael Carroll --- README.md | 7 +++++++ action.yml | 5 +++++ entrypoint.sh | 11 ++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d2b37ce..6de819a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ jobs: apt-dependencies: '' codecov-token: ${{ secrets.CODECOV_TOKEN }} script-before-cmake: before_cmake.sh + cmake-args: '-DBUILD_TESTING=1' script-between-cmake-make: between_cmake_make.sh script-after-make: after_make.sh script-after-make-test: after_make_test.sh @@ -47,3 +48,9 @@ Create a secret on the repository with Codecov's token, called `CODECOV_TOKEN`. ### Custom scripts The `script-`s are optional hooks that you can run at specific times of the build. + +### Custom CMake Arguments + +The `cmake-args` can be used to pass additional CMake arguments to the build. +If building with codecov is enabled, it is not possible to override the build type, +which will always be `CMAKE_BUILD_TYPE=coverage`. diff --git a/action.yml b/action.yml index d682a28..2bb83ae 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,10 @@ inputs: description: 'Bash script to be run before cmake inside the build folder' required: false default: '' + cmake-args: + description: 'Additional CMake arguments to use when building package under test' + required: false + default: '' script-between-cmake-make: description: 'Bash script to be run after cmake and before make inside the build folder' required: false @@ -36,6 +40,7 @@ runs: - ${{ inputs.apt-dependencies }} - ${{ inputs.codecov-token }} - ${{ inputs.script-before-cmake }} + - ${{ inputs.cmake-args }} - ${{ inputs.script-between-cmake-make }} - ${{ inputs.script-after-make }} - ${{ inputs.script-after-make-test }} diff --git a/entrypoint.sh b/entrypoint.sh index 3a9380a..31a7aee 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,9 +5,10 @@ set -x APT_DEPENDENCIES=$1 CODECOV_TOKEN=$2 SCRIPT_BEFORE_CMAKE=$3 -SCRIPT_BETWEEN_CMAKE_MAKE=$4 -SCRIPT_AFTER_MAKE=$5 -SCRIPT_AFTER_MAKE_TEST=$6 +CMAKE_ARGS=$4 +SCRIPT_BETWEEN_CMAKE_MAKE=$5 +SCRIPT_AFTER_MAKE=$6 +SCRIPT_AFTER_MAKE_TEST=$7 cd $GITHUB_WORKSPACE @@ -58,9 +59,9 @@ if [ ! -z "$SCRIPT_BEFORE_CMAKE" ] ; then fi if [ ! -z "$CODECOV_TOKEN" ] ; then - cmake .. -DCMAKE_BUILD_TYPE=coverage + cmake .. $CMAKE_ARGS -DCMAKE_BUILD_TYPE=coverage else - cmake .. + cmake .. $CMAKE_ARGS fi echo "SCRIPT_BETWEEN_CMAKE_MAKE"