Skip to content
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

Allow overriding testing command #5

Merged
merged 1 commit into from
Jun 16, 2021
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
33 changes: 21 additions & 12 deletions hooks/command
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
#!/bin/bash
source $(dirname ${BASH_SOURCE})/common

echo "+++ :julia: Running tests"
julia ${bugreport_args} --project=${project} -e "
using Pkg
# Use default julia test running harness
if [[ "${run_tests}" == "true" ]]; then
echo "+++ :julia: Running tests"
julia ${bugreport_args} --project=${project} -e "
using Pkg

# We never update the registry when running tests, we assume if you wanted this done, you'd do it in the pre-command
Pkg.UPDATED_REGISTRY_THIS_SESSION[] = true
# We never update the registry when running tests, we assume if you wanted this done, you'd do it in the pre-command
Pkg.UPDATED_REGISTRY_THIS_SESSION[] = true

# In the event that you might need to fetch test-only dependencies that are private,
# we set Pkg to use SSH for cloning non-PkgServer-served packages here as well
${USE_SSH_BLOCK}
# In the event that you might need to fetch test-only dependencies that are private,
# we set Pkg to use SSH for cloning non-PkgServer-served packages here as well
${USE_SSH_BLOCK}

Pkg.test(; coverage=$coverage,
julia_args=\`$julia_args\`,
test_args=\`$test_args\`)
"
Pkg.test(; coverage=$coverage,
julia_args=\`$julia_args\`,
test_args=\`$test_args\`)
"
fi

# If there is a `commands` block specified in the YAML, run that as well
if [[ -n "${BUILDKITE_COMMAND}" ]]; then
echo "+++ Running yaml-provided user commands"
eval "${BUILDKITE_COMMAND}"
fi
3 changes: 2 additions & 1 deletion hooks/common
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ julia_args=${BUILDKITE_PLUGIN_JULIA_TEST_JULIA_ARGS:-""}
test_args=${BUILDKITE_PLUGIN_JULIA_TEST_TEST_ARGS:-""}
project=${BUILDKITE_PLUGIN_JULIA_TEST_PROJECT:-.}
upload_rr_trace=${BUILDKITE_PLUGIN_JULIA_TEST_UPLOAD_RR_TRACE:-never}
run_tests=${BUILDKITE_PLUGIN_JULIA_TEST_RUN_TESTS:-true}

CACHE_DIR=${BUILDKITE_PLUGIN_JULIA_CACHE_DIR:-${HOME}/.cache/julia-test-buildkite-plugin}
export _RR_TRACE_DIR=${CACHE_DIR}/rr_traces/${BUILDKITE_BUILD_ID}
Expand Down Expand Up @@ -52,4 +53,4 @@ fi
bugreport_args=""
if [[ "${upload_rr_trace}" != "never" ]]; then
bugreport_args="--bug-report=rr-local --"
fi
fi
36 changes: 28 additions & 8 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,40 @@ author: https://github.com/maleadt
requirements: [julia]
configuration:
properties:
coverage:
type: boolean
julia_args:
type: string
test_args:
type: string
use_ssh:
## Runtime testing options
# Whether to actually run the Julia test suite (defaults to `true`)
run_tests:
type: boolean
# Sets the project path to be tested, defaults to `"."`
project:
type: string
# Whether to run within `rr` and upload a trace, takes one of the following options:
# - "never": `rr` is never used (this is the default)
# - "always": `rr` is used and a trace is unconditionally uploaded
# - "error": `rr` is used and a trace is uploaded only if testing fails.
upload_rr_trace:
type: string

## Project instantiation options
# Whether to update the registry before instantiating, defaults to `"true"`.
update_registry:
type: boolean
# Extra registries to add before instantiating as a comma-separated list
extra_registries:
type: string
upload_rr_trace:
# Use SSH when instantiating the projects (runs `Pkg.setprotocol!(protocol="ssh")`), defaults to `false`
use_ssh:
type: boolean

## Kwargs that get passed to `Pkg.test()`
# Whether to upload coverage (passes `coverage` to `Pkg.test()`), defaults to `true`
coverage:
type: boolean
# Extra julia args (passes `julia_args` to `Pkg.test()`), defaults to `""`
julia_args:
type: string
# Extra test args (passes `test_args` to `Pkg.test()`), defaults to `""`
test_args:
type: string

additionalProperties: false