Skip to content

Commit

Permalink
Add ability to pass CMake args (#9)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll authored May 19, 2020
1 parent 0bbce7f commit fea60bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
11 changes: 6 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fea60bd

Please sign in to comment.