From 83dfc554f24e019766408566fda09959446cba2e Mon Sep 17 00:00:00 2001 From: Greg Lin Date: Wed, 10 Aug 2022 18:53:42 -0500 Subject: [PATCH] Use quick install script to test R builds --- test/docker-compose.yml | 40 ++++++++++++++++------------------------ test/test-apt.sh | 27 +++++++++++++++++++++++++++ test/test-centos.sh | 25 ------------------------- test/test-deb.sh | 25 ------------------------- test/test-opensuse.sh | 23 ----------------------- test/test-r.sh | 4 ++-- test/test-rhel.sh | 26 -------------------------- test/test-yum.sh | 32 ++++++++++++++++++++++++++++++++ test/test-zypper.sh | 26 ++++++++++++++++++++++++++ 9 files changed, 103 insertions(+), 125 deletions(-) create mode 100755 test/test-apt.sh delete mode 100755 test/test-centos.sh delete mode 100755 test/test-deb.sh delete mode 100755 test/test-opensuse.sh delete mode 100755 test/test-rhel.sh create mode 100755 test/test-yum.sh create mode 100755 test/test-zypper.sh diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 91ea366..57215bd 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -3,73 +3,65 @@ version: '2.0' services: ubuntu-1804: image: ubuntu:bionic - command: /test/test-deb.sh + command: /r-builds/test/test-apt.sh environment: - OS_IDENTIFIER=ubuntu-1804 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds ubuntu-2004: image: ubuntu:focal - command: /test/test-deb.sh + command: /r-builds/test/test-apt.sh environment: - OS_IDENTIFIER=ubuntu-2004 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds ubuntu-2204: image: ubuntu:jammy - command: /test/test-deb.sh + command: /r-builds/test/test-apt.sh environment: - OS_IDENTIFIER=ubuntu-2204 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds debian-11: image: debian:bullseye - command: /test/test-deb.sh + command: /r-builds/test/test-apt.sh environment: - OS_IDENTIFIER=debian-11 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds debian-10: image: debian:buster - command: /test/test-deb.sh + command: /r-builds/test/test-apt.sh environment: - OS_IDENTIFIER=debian-10 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds centos-7: image: centos:centos7 - command: /test/test-centos.sh + command: /r-builds/test/test-yum.sh environment: - OS_IDENTIFIER=centos-7 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds centos-8: image: rockylinux:8 - command: /test/test-centos.sh + command: /r-builds/test/test-yum.sh environment: - OS_IDENTIFIER=centos-8 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds opensuse-153: image: opensuse/leap:15.3 - command: /test/test-opensuse.sh + command: /r-builds/test/test-zypper.sh environment: - OS_IDENTIFIER=opensuse-153 - R_VERSION=${R_VERSION} volumes: - - ./:/test - - ../builder/integration/tmp:/packages + - ../:/r-builds diff --git a/test/test-apt.sh b/test/test-apt.sh new file mode 100755 index 0000000..56a8012 --- /dev/null +++ b/test/test-apt.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -ex + +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +# Install quick install script prerequisites +if ! command -v curl > /dev/null 2>&1; then + apt update -qq + apt install -y curl +fi + +# Run the quick install script. Use a locally built file if present, otherwise from the CDN. +tmpdir=$(mktemp -d) +cp -r "${SCRIPT_DIR}/../builder/integration/tmp/${OS_IDENTIFIER}/." "$tmpdir" > /dev/null 2>&1 || true +(cd "$tmpdir" && SCRIPT_ACTION=install R_VERSION="${R_VERSION}" RUN_UNATTENDED=1 "${SCRIPT_DIR}/../install.sh") + +# Show DEB info +apt show "r-${R_VERSION}" + +"${SCRIPT_DIR}/test-r.sh" + +apt remove -y "r-${R_VERSION}" + +if [ -d "/opt/R/${R_VERSION}" ]; then + echo "Failed to uninstall completely" + exit 1 +fi diff --git a/test/test-centos.sh b/test/test-centos.sh deleted file mode 100755 index 3cee256..0000000 --- a/test/test-centos.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -set -ex - -PKG_FILE=/packages/${OS_IDENTIFIER}/R-${R_VERSION}-1-1.x86_64.rpm - -if [ ! -f ${PKG_FILE} ]; then - echo "No package found, skipping tests" - exit 0 -fi - -yum -y -q update -yum -y install epel-release -yum -y install ${PKG_FILE} - -# Show rpm info -rpm -qi R-${R_VERSION} - -/test/test-r.sh - -yum -y remove R-${R_VERSION} - -if [ -d /opt/R/${R_VERSION} ]; then - echo "Failed to uninstall completely" - exit 1 -fi diff --git a/test/test-deb.sh b/test/test-deb.sh deleted file mode 100755 index b4ee24b..0000000 --- a/test/test-deb.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -set -ex - -PKG_FILE=/packages/${OS_IDENTIFIER}/r-${R_VERSION}_1_amd64.deb - -if [ ! -f ${PKG_FILE} ]; then - echo "No package found, skipping tests" - exit 0 -fi - -export DEBIAN_FRONTEND=noninteractive -apt-get update -qq -apt-get install -f -y ${PKG_FILE} - -# Show deb info -apt-cache show r-${R_VERSION} - -/test/test-r.sh - -apt-get remove -y r-${R_VERSION} - -if [ -d /opt/R/${R_VERSION} ]; then - echo "Failed to uninstall completely" - exit 1 -fi diff --git a/test/test-opensuse.sh b/test/test-opensuse.sh deleted file mode 100755 index 174b9c5..0000000 --- a/test/test-opensuse.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -set -ex - -PKG_FILE=/packages/${OS_IDENTIFIER}/R-${R_VERSION}-1-1.x86_64.rpm - -if [ ! -f ${PKG_FILE} ]; then - echo "No package found, skipping tests" - exit 0 -fi - -zypper --non-interactive --no-gpg-checks install ${PKG_FILE} - -# Show rpm info -rpm -qi R-${R_VERSION} - -/test/test-r.sh - -zypper --non-interactive remove R-${R_VERSION} - -if [ -d /opt/R/${R_VERSION} ]; then - echo "Failed to uninstall completely" - exit 1 -fi diff --git a/test/test-r.sh b/test/test-r.sh index 628acce..8783716 100755 --- a/test/test-r.sh +++ b/test/test-r.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -ex -DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" R_HOME=/opt/R/${R_VERSION}/lib/R "${R_HOME}/bin/R" --version @@ -15,4 +15,4 @@ gfortran --version # List shared library dependencies (e.g. BLAS/LAPACK) LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${R_HOME}/lib ldd "${R_HOME}/lib/libR.so" -DIR=${DIR} "${R_HOME}/bin/Rscript" /test/test.R +DIR=$SCRIPT_DIR "${R_HOME}/bin/Rscript" "${SCRIPT_DIR}/test.R" diff --git a/test/test-rhel.sh b/test/test-rhel.sh deleted file mode 100755 index c2c7918..0000000 --- a/test/test-rhel.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -PKG_FILE=/packages/${OS_IDENTIFIER}/R-${R_VERSION}-1-1.x86_64.rpm - -if [ ! -f ${PKG_FILE} ]; then - echo "No package found, skipping tests" - exit 0 -fi - -dnf -y install dnf-plugins-core -dnf config-manager --set-enabled crb -dnf -y install epel-release -dnf -y install ${PKG_FILE} - -# Show rpm info -rpm -qi R-${R_VERSION} - -/test/test-r.sh - -dnf -y remove R-${R_VERSION} - -if [ -d /opt/R/${R_VERSION} ]; then - echo "Failed to uninstall completely" - exit 1 -fi diff --git a/test/test-yum.sh b/test/test-yum.sh new file mode 100755 index 0000000..93a0e13 --- /dev/null +++ b/test/test-yum.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -ex + +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +if command -v dnf > /dev/null 2>&1; then + YUM=dnf +else + YUM=yum +fi + +# Install quick install script prerequisites +if ! command -v curl > /dev/null 2>&1; then + $YUM install -y curl +fi + +# Run the quick install script. Use a locally built file if present, otherwise from the CDN. +tmpdir=$(mktemp -d) +cp -r "${SCRIPT_DIR}/../builder/integration/tmp/${OS_IDENTIFIER}/." "$tmpdir" > /dev/null 2>&1 || true +(cd "$tmpdir" && SCRIPT_ACTION=install R_VERSION="${R_VERSION}" RUN_UNATTENDED=1 "${SCRIPT_DIR}/../install.sh") + +# Show rpm info +rpm -qi "R-${R_VERSION}" + +"${SCRIPT_DIR}/test-r.sh" + +$YUM -y remove "R-${R_VERSION}" + +if [ -d "/opt/R/${R_VERSION}" ]; then + echo "Failed to uninstall completely" + exit 1 +fi diff --git a/test/test-zypper.sh b/test/test-zypper.sh new file mode 100755 index 0000000..7b15c18 --- /dev/null +++ b/test/test-zypper.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -ex + +SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +# Install quick install script prerequisites +if ! command -v curl > /dev/null 2>&1; then + zypper --non-interactive install curl +fi + +# Run the quick install script. Use a locally built file if present, otherwise from the CDN. +tmpdir=$(mktemp -d) +cp -r "${SCRIPT_DIR}/../builder/integration/tmp/${OS_IDENTIFIER}/." "$tmpdir" > /dev/null 2>&1 || true +(cd "$tmpdir" && SCRIPT_ACTION=install R_VERSION="${R_VERSION}" RUN_UNATTENDED=1 "${SCRIPT_DIR}/../install.sh") + +# Show RPM info +rpm -qi "R-${R_VERSION}" + +"${SCRIPT_DIR}/test-r.sh" + +zypper --non-interactive remove "R-${R_VERSION}" + +if [ -d "/opt/R/${R_VERSION}" ]; then + echo "Failed to uninstall completely" + exit 1 +fi