forked from nbauernfeind/deephaven-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
R dockerized test run gradle target and CI (deephaven#4625)
* Draft. * Shaping up; cpp-client build image step now works; R test run fails but containers created. * Almost there... missing xml2 package in R for junit reporter. * Update gradle.properties * Updated r-client-base tag. * Fix issues with right image. * Make R tests configurable for host:port. * Moving away from MAKEFLAGS into MAKE env var for R builds * Now it works * New r-client-base image. * Refactored the build code, separated image building, handle errors inside R with proper exit status. * R's install.packages only gives a warning on compilation failure... sigh. * Followup to James/Colin review comments on dependsOn. * Followup to the followup to the followup to review comments (ref dependsOn). * Followup to review comments. * Followup to review comments: remove references to cpp-client-base from deephaven-core repo.
- Loading branch information
1 parent
0a65346
commit 39c5951
Showing
18 changed files
with
238 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/**' | ||
include 'rdeephaven/man/**' | ||
include 'rdeephaven/etc/**' | ||
include 'rdeephaven/R/**' | ||
include 'rdeephaven/src/*.cpp' | ||
include 'rdeephaven/src/Makevars' | ||
} | ||
} | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.deephaven.project.ProjectType=BASIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*~ | ||
cmake-build-debug | ||
cmake-build-release | ||
cmake-build-relwithdebinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.