Skip to content

Commit

Permalink
Merge pull request #5 from JuliaCI/sf/run_tests
Browse files Browse the repository at this point in the history
Allow overriding testing command
  • Loading branch information
staticfloat authored Jun 16, 2021
2 parents 1d90389 + a2455d0 commit 7805f8e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 21 deletions.
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

0 comments on commit 7805f8e

Please sign in to comment.