Skip to content

Commit

Permalink
plugin-tests.sh handles being sourced
Browse files Browse the repository at this point in the history
  • Loading branch information
rnro committed Jan 23, 2025
1 parent d8dc444 commit 63dc0bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/matrices/plugin-tests.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"config":[{"name":"Plugin tests (6.0)","swift_version":"6.0","runner":"ubuntu-latest","image":"swift:6.0-jammy","platform":"Linux","setup_command":"apt-get update -y -q && apt-get install -y -q curl protobuf-compiler","command":"curl -s https://raw.githubusercontent.com/rnro/grpc-swift-protobuf/refs/heads/build_plugin_integration_tests/dev/plugin-tests.sh| bash","command_arguments":""},{"name":"Plugin tests (nightly-6.1)","swift_version":"nightly-6.1","runner":"ubuntu-latest","image":"swiftlang/swift:nightly-6.1-jammy","platform":"Linux","setup_command":"apt-get update -y -q && apt-get install -y -q curl protobuf-compiler","command":"curl -s https://raw.githubusercontent.com/rnro/grpc-swift-protobuf/refs/heads/build_plugin_integration_tests/dev/plugin-tests.sh| bash","command_arguments":""},{"name":"Plugin tests (nightly-main)","swift_version":"nightly-main","runner":"ubuntu-latest","image":"swiftlang/swift:nightly-main-jammy","platform":"Linux","setup_command":"apt-get update -y -q && apt-get install -y -q curl protobuf-compiler","command":"curl -s https://raw.githubusercontent.com/rnro/grpc-swift-protobuf/refs/heads/build_plugin_integration_tests/dev/plugin-tests.sh| bash","command_arguments":""}]}
{"config":[{"name":"Plugin tests (6.0)","swift_version":"6.0","runner":"ubuntu-latest","image":"swift:6.0-jammy","platform":"Linux","setup_command":"apt-get update -y -q && apt-get install -y -q curl protobuf-compiler","command":"curl -s https://raw.githubusercontent.com/rnro/grpc-swift-protobuf/refs/heads/build_plugin_integration_tests/dev/plugin-tests.sh| GITHUB_ACTIONS=true bash","command_arguments":""},{"name":"Plugin tests (nightly-6.1)","swift_version":"nightly-6.1","runner":"ubuntu-latest","image":"swiftlang/swift:nightly-6.1-jammy","platform":"Linux","setup_command":"apt-get update -y -q && apt-get install -y -q curl protobuf-compiler","command":"curl -s https://raw.githubusercontent.com/rnro/grpc-swift-protobuf/refs/heads/build_plugin_integration_tests/dev/plugin-tests.sh| GITHUB_ACTIONS=true bash","command_arguments":""},{"name":"Plugin tests (nightly-main)","swift_version":"nightly-main","runner":"ubuntu-latest","image":"swiftlang/swift:nightly-main-jammy","platform":"Linux","setup_command":"apt-get update -y -q && apt-get install -y -q curl protobuf-compiler","command":"curl -s https://raw.githubusercontent.com/rnro/grpc-swift-protobuf/refs/heads/build_plugin_integration_tests/dev/plugin-tests.sh| GITHUB_ACTIONS=true bash","command_arguments":""}]}
13 changes: 10 additions & 3 deletions dev/plugin-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ log() { printf -- "** %s\n" "$*" >&2; }
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
fatal() { error "$@"; exit 1; }

here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ -n ${GITHUB_ACTIONS:=""} ]]; then
# we will have been piped to bash and won't know the location of the script
echo "Running in GitHub Actions"
source_directory="$(pwd)"
else
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source_directory="$(readlink -f "${here}/..")"
fi
tests_directory="${PLUGIN_TESTS_OUTPUT_DIRECTORY:=$(mktemp -d)}"

PLUGIN_TESTS_OUTPUT_DIRECTORY="$tests_directory" "$here/setup-plugin-tests.sh"
PLUGIN_TESTS_DIRECTORY="$tests_directory" "$here/execute-plugin-tests.sh"
PLUGIN_TESTS_OUTPUT_DIRECTORY="$tests_directory" "${source_directory}/dev/setup-plugin-tests.sh"
PLUGIN_TESTS_DIRECTORY="$tests_directory" "${source_directory}/dev/execute-plugin-tests.sh"

0 comments on commit 63dc0bf

Please sign in to comment.