-
Notifications
You must be signed in to change notification settings - Fork 81
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
R dockerized test run gradle target and CI #4625
Changes from all commits
26b3584
f7046fe
6568a65
5ba4a87
1a8ffdf
70b1642
184e923
9e90d53
4ba32b6
37281a0
ef1351c
31a57c5
852bb64
0b6ddaf
cc56455
cce7931
5a880f2
0634eb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
plugins { | ||
id 'com.bmuschko.docker-remote-api' | ||
id 'io.deephaven.project.register' | ||
id 'io.deephaven.deephaven-in-docker' | ||
} | ||
|
||
evaluationDependsOn(':cpp-client') | ||
|
||
configurations { | ||
cpp {} | ||
} | ||
|
||
dependencies { | ||
cpp project(':cpp-client') | ||
} | ||
|
||
def prefix = '/opt/deephaven' | ||
|
||
// start a grpc-api server | ||
String randomSuffix = UUID.randomUUID().toString(); | ||
deephavenDocker { | ||
envVars.set([ | ||
'START_OPTS':'-Xmx512m -DAuthHandlers=io.deephaven.auth.AnonymousAuthenticationHandler' | ||
]) | ||
containerName.set "dh-server-for-r-${randomSuffix}" | ||
networkName.set "r-test-network-${randomSuffix}" | ||
} | ||
|
||
def buildRClient = Docker.registerDockerTask(project, 'rClient') { | ||
// Only tested on x86-64, and we only build dependencies for x86-64 | ||
platform = 'linux/amd64' | ||
|
||
copyIn { | ||
from(layout.projectDirectory) { | ||
include 'r-build.sh' | ||
include 'r-tests.sh' | ||
include 'rdeephaven/DESCRIPTION' | ||
include 'rdeephaven/LICENSE' | ||
include 'rdeephaven/NAMESPACE' | ||
include 'rdeephaven/README.md' | ||
include 'rdeephaven/inst/**' | ||
jcferretti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
include 'rdeephaven/man/**' | ||
include 'rdeephaven/etc/**' | ||
include 'rdeephaven/R/**' | ||
include 'rdeephaven/src/*.cpp' | ||
include 'rdeephaven/src/Makevars' | ||
} | ||
niloc132 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
dockerfile { | ||
from('deephaven/cpp-client:local-build') | ||
// | ||
// Build and install client. | ||
// | ||
runCommand("""mkdir -p \\ | ||
/out \\ | ||
${prefix}/log \\ | ||
${prefix}/bin/rdeephaven \\ | ||
${prefix}/src/rdeephaven/{inst,man,etc,src,R,bin} | ||
""") | ||
copyFile('rdeephaven/DESCRIPTION', "${prefix}/src/rdeephaven/") | ||
copyFile('rdeephaven/LICENSE', "${prefix}/src/rdeephaven/") | ||
copyFile('rdeephaven/NAMESPACE', "${prefix}/src/rdeephaven/") | ||
copyFile('rdeephaven/README.md', "${prefix}/src/rdeephaven/") | ||
copyFile('rdeephaven/inst/', "${prefix}/src/rdeephaven/inst/") | ||
copyFile('rdeephaven/man/', "${prefix}/src/rdeephaven/man/") | ||
copyFile('rdeephaven/etc/', "${prefix}/src/rdeephaven/etc/") | ||
copyFile('rdeephaven/R/', "${prefix}/src/rdeephaven/R/") | ||
copyFile('rdeephaven/src/*.cpp', "${prefix}/src/rdeephaven/src/") | ||
copyFile('rdeephaven/src/Makevars', "${prefix}/src/rdeephaven/src/") | ||
copyFile('r-tests.sh', "${prefix}/bin/rdeephaven") | ||
copyFile('r-build.sh', "${prefix}/bin/rdeephaven") | ||
runCommand("PREFIX=${prefix}; " + | ||
'''set -eux ; \ | ||
cd "${PREFIX}/src/rdeephaven"; \ | ||
. "${PREFIX}/env.sh"; \ | ||
${PREFIX}/bin/rdeephaven/r-build.sh | ||
''') | ||
} | ||
parentContainers = [ project.tasks.getByPath(':cpp-client:cppClient') ] | ||
} | ||
|
||
def testRClient = Docker.registerDockerTask(project, 'testRClient') { | ||
// Only tested on x86-64, and we only build dependencies for x86-64 | ||
platform = 'linux/amd64' | ||
copyIn { | ||
from(layout.projectDirectory) { | ||
include 'r-tests.sh' | ||
include 'rdeephaven/inst/**' | ||
} | ||
} | ||
copyOut { | ||
into layout.buildDirectory.dir('test-results') | ||
} | ||
dockerfile { | ||
from('deephaven/r-client:local-build') | ||
// | ||
// Setup for test run; we should be inheriting other env vars | ||
// like LD_LIBRARY_PATH from the cpp-client image. | ||
// | ||
environmentVariable 'DH_HOST', deephavenDocker.containerName.get() | ||
environmentVariable 'DH_PORT', '10000' | ||
} | ||
containerDependencies.dependsOn = [deephavenDocker.healthyTask] | ||
containerDependencies.finalizedBy = deephavenDocker.endTask | ||
network = deephavenDocker.networkName.get() | ||
parentContainers = [ project.tasks.getByName('rClient') ] | ||
entrypoint = ["${prefix}/bin/rdeephaven/r-tests.sh", '/out/r-test.xml', '/out/r-test.log'] | ||
} | ||
|
||
deephavenDocker.shouldLogIfTaskFails testRClient | ||
tasks.check.dependsOn(testRClient) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.deephaven.project.ProjectType=BASIC |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
for var in DHCPP NCPUS LD_LIBRARY_PATH; do | ||
if [ -z "${!var}" ]; then | ||
echo "$0: Environment variable $var is not set, aborting." 1>&2 | ||
exit 1 | ||
fi | ||
done | ||
|
||
if [ ! -d ./src ] || [ ! -f ./src/Makevars ] || [ ! -d ./R ] || [ ! -f ./DESCRIPTION ]; then | ||
echo "The current directory `pwd` does not look like an R package source directory, aborting." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# Ensure builds are always done from a clean slate. | ||
trap 'rm -f src/*.o src/*.so' 1 2 15 | ||
rm -f src/*.o src/*.so | ||
|
||
MAKE="make -j${NCPUS}" R --no-save --no-restore <<EOF | ||
status = tryCatch( | ||
{ | ||
install.packages(".", repos=NULL, type="source") | ||
0 | ||
}, | ||
error=function(e) 1, | ||
warning=function(w) 2 | ||
) | ||
print(paste0('status=', status)) | ||
quit(save='no', status=status) | ||
EOF | ||
|
||
rm -f src/*.o src/*.so | ||
|
||
exit 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 out.xml out.log" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${DH_PREFIX}" ]; then | ||
echo "$0: Environment variable DH_PREFIX is not set, aborting." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
cd $DH_PREFIX/src/rdeephaven | ||
|
||
OUT_XML="$1" | ||
OUT_LOG="$2" | ||
|
||
R --no-save --no-restore <<EOF >& "${OUT_LOG}" | ||
library('testthat') | ||
options(testthat.output_file = '${OUT_XML}') | ||
status = tryCatch( | ||
{ | ||
test_package('rdeephaven', reporter = 'junit') | ||
0 | ||
}, | ||
error=function(e) 1 | ||
) | ||
print(paste0('status=', status)) | ||
quit(save='no', status=status) | ||
EOF | ||
|
||
exit 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
get_dh_target <- function() { | ||
dh_host = Sys.getenv("DH_HOST") | ||
if (dh_host == '') { | ||
dh_host = "localhost" | ||
} | ||
dh_port = Sys.getenv("DH_PORT") | ||
if (dh_port == '') { | ||
dh_port = 10000 | ||
} | ||
return(paste0(dh_host, ':', dh_port)) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*~ | ||
cmake-build-debug | ||
cmake-build-release | ||
cmake-build-relwithdebinfo |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ if [ "$#" -ne 2 ]; then | |
fi | ||
|
||
if [ -z "${DH_PREFIX}" ]; then | ||
echo "$0: Environment variable DHCPP_PREFIX is not set, aborting." 1>&2 | ||
echo "$0: Environment variable DH_PREFIX is not set, aborting." 1>&2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it because we are installing there now more than just C++, eg, also R and potentially python/cython. |
||
exit 1 | ||
fi | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
io.deephaven.project.ProjectType=DOCKER_REGISTRY | ||
deephaven.registry.imageName=ghcr.io/deephaven/r-client-base:latest | ||
deephaven.registry.imageId=ghcr.io/deephaven/r-client-base@sha256:29cb2969a746cf1f8556b469508a03796297afcfc6fa502622df372ae64d0039 | ||
deephaven.registry.platform=linux/amd64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to remove the cpp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I Devin request I remove earlier in this same review. The C++ build is now using the r-client-base image (which we plan to rename
cpp-clients-fat-base
on the py ticking coming PR).