Skip to content

Commit

Permalink
Add support for multiple test runtimes
Browse files Browse the repository at this point in the history
The `runtime-paths` input can now be used to provide a YAML format list of paths to runtimes when multiple are generated.

The previous `runtime-path` input can still be used as usual. A deprecation warning will be shown in the log when this
input is used.

The default behavior is unchanged.
  • Loading branch information
per1234 committed Nov 3, 2020
1 parent e4b852b commit 540f4d5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
35 changes: 25 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand Down

0 comments on commit 540f4d5

Please sign in to comment.