diff --git a/README.md b/README.md index e144a10..2a8d57b 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ The top-level directory for build output. **Default**: `extras/test/build` -### `runtime-path` +### `runtime-paths` -Path of the runtime binary generated by building the tests. +YAML format list of paths to runtime binaries generated by building the tests. -**Default**: `extras/test/build/bin/unit-test-binary` +**Default**: `"- extras/test/build/bin/unit-test-binary"` ### `coverage-exclude-paths` diff --git a/action.yml b/action.yml index 2e9ae37..134b6ec 100644 --- a/action.yml +++ b/action.yml @@ -10,10 +10,10 @@ inputs: description: Path of the top-level folder for build output. required: true default: ${{ github.workspace }}/extras/test/build - runtime-path: - description: Path of the runtime binary generated by building the tests. + runtime-paths: + description: YAML format list of paths to runtime binaries generated by building the tests. required: true - default: ${{ github.workspace }}/extras/test/build/bin/unit-test-binary + default: "- ${{ github.workspace }}/extras/test/build/bin/unit-test-binary" coverage-exclude-paths: description: YAML format list of paths to remove from coverage data. required: true @@ -28,7 +28,7 @@ inputs: runs: using: composite - steps: + steps: - name: Build tests shell: bash run: | @@ -39,6 +39,11 @@ runs: make --directory="${{ inputs.build-path }}" echo "::endgroup::" + - name: Install yq + shell: bash + run: | + sudo snap install yq > /dev/null + - name: Install Valgrind shell: bash run: | @@ -47,14 +52,24 @@ runs: - name: Run tests shell: bash run: | - echo "::group::Run ${{ inputs.runtime-path }} with Valgrind" - valgrind --tool=memcheck --leak-check=yes --error-exitcode=1 "${{ inputs.runtime-path }}" - echo "::endgroup::" + if [[ -n "${{ inputs.runtime-path }}" ]]; then + echo "::warning::The runtime-path input is deprecated. Please use runtime-paths instead." + RUNTIME_PATHS="${{ inputs.runtime-path }}" + else + RUNTIME_PATHS="${{ inputs.runtime-paths }}" + fi - - name: Install yq - shell: bash - run: | - sudo snap install yq > /dev/null + EXIT_STATUS=0 + set +o errexit + while IFS='' read -r runtimePath && [[ -n "$runtimePath" ]]; do + echo "::group::Run $runtimePath with Valgrind" + if ! valgrind --tool=memcheck --leak-check=yes --error-exitcode=1 "$runtimePath"; then + EXIT_STATUS=1 + echo "::error file=$runtimePath::While running $runtimePath" + fi + echo "::endgroup::" + done <<<"$(echo "$RUNTIME_PATHS" | yq read - [*])" + exit $EXIT_STATUS - name: Parse coverage-exclude-paths input id: parse-coverage-exclude-paths