Skip to content

Add support for multiple test runtimes #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
37 changes: 26 additions & 11 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 @@ -28,7 +28,7 @@ inputs:

runs:
using: composite
steps:
steps:
- name: Build tests
shell: bash
run: |
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