Add CI jobs for gmxapi 0.3
authorM. Eric Irrgang <ericirrgang@gmail.com>
Fri, 27 Nov 2020 16:11:05 +0000 (19:11 +0300)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 4 Dec 2020 10:34:45 +0000 (10:34 +0000)
.gitlab-ci.yml
admin/ci-scripts/build-and-test-py-gmxapi-0.3.sh [new file with mode: 0644]
admin/gitlab-ci/python-gmxapi03.gitlab-ci.yml [new file with mode: 0644]

index 665733b4dc71cfe8f68f0f3bb75360a1c93ba53b..14a91b6e8cedb8655469925aa7c9b738ee731f2c 100644 (file)
@@ -44,6 +44,7 @@ include:
   # gmxapi Python package.
   - local: '/admin/gitlab-ci/python-gmxapi01.gitlab-ci.yml'
   - local: '/admin/gitlab-ci/python-gmxapi02.gitlab-ci.yml'
+  - local: '/admin/gitlab-ci/python-gmxapi03.gitlab-ci.yml'
   # Further API validation and usability of sample gmxapi extension package.
   - local: '/admin/gitlab-ci/sample_restraint.gitlab-ci.yml'
   # API regression testing using sample gmxapi extension package.
diff --git a/admin/ci-scripts/build-and-test-py-gmxapi-0.3.sh b/admin/ci-scripts/build-and-test-py-gmxapi-0.3.sh
new file mode 100644 (file)
index 0000000..e33fb3f
--- /dev/null
@@ -0,0 +1,83 @@
+#!/usr/bin/env bash
+#
+# Build, install, and test the gmxapi 0.2 Python package developed with
+# GROMACS 2021.
+#
+# This script assumes an activated Python venv with the
+# gmxapi dependencies already installed, with `python` resolvable by the shell
+# to the appropriate Python interpreter.
+#
+# This script is intended to support automated GROMACS testing infrastructure,
+# and may be removed without notice.
+#
+# WARNING: This script assumes OpenMPI mpiexec. Syntax for launch wrappers from
+# other implementations will need different syntax, and we should get a
+# MPIRUNNER from the environment, or something.
+
+# Make sure the script errors if any commands error.
+set -e
+
+# Create "sdist" source distribution archive.
+pushd python_packaging/src
+  # TODO: Remove extraneous environment variable with resolution of #3273
+  # Ref: https://redmine.gromacs.org/issues/3273
+  GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
+      python setup.py sdist
+  # TODO: Identify SDIST
+
+  # Build and install from sdist.
+  # Note that tool chain may be provided differently in GROMACS 2020 and 2021.
+  GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
+      python -m pip install \
+          --no-cache-dir \
+          --no-deps \
+          --no-index \
+          --no-build-isolation \
+          dist/gmxapi*
+  # TODO: Build and install from $SDIST instead of wildcard.
+
+popd
+
+# Run Python unit tests.
+python -m pytest python_packaging/src/test --junitxml=$PY_UNIT_TEST_XML --threads=2
+
+# Note: Multiple pytest processes getting --junitxml output file argument
+# may cause problems, so we set the option on only one of the launched processes.
+# See also Multiple Instruction Multiple Data Model for OpenMPI mpirun:
+# https://www.open-mpi.org/doc/v3.0/man1/mpiexec.1.php
+PROGRAM=(`which python` -m mpi4py -m pytest \
+        -p no:cacheprovider \
+        $PWD/python_packaging/src/test \
+        --threads=1)
+# shellcheck disable=SC2068
+if [ -x `which mpiexec` ]; then
+    PYTHONDONTWRITEBYTECODE=1 \
+    mpiexec --allow-run-as-root \
+      -x OMP_NUM_THREADS=1 \
+      --mca opal_warn_on_missing_libcuda 0 \
+      --mca orte_base_help_aggregate 0 \
+      -n 1 ${PROGRAM[@]} --junitxml=$PLUGIN_MPI_TEST_XML : \
+      -n 1 ${PROGRAM[@]}
+fi
+
+# Run Python acceptance tests.
+python -m pytest python_packaging/test --junitxml=$PY_ACCEPTANCE_TEST_XML --threads=2
+
+# Note: Multiple pytest processes getting --junitxml output file argument
+# may cause problems, so we set the option on only one of the launched processes.
+# See also Multiple Instruction Multiple Data Model for OpenMPI mpirun:
+# https://www.open-mpi.org/doc/v3.0/man1/mpiexec.1.php
+PROGRAM=(`which python` -m mpi4py -m pytest \
+        -p no:cacheprovider \
+        $PWD/python_packaging/test \
+        --threads=1)
+# shellcheck disable=SC2068
+if [ -x `which mpiexec` ]; then
+    PYTHONDONTWRITEBYTECODE=1 \
+    mpiexec --allow-run-as-root \
+      -x OMP_NUM_THREADS=1 \
+      --mca opal_warn_on_missing_libcuda 0 \
+      --mca orte_base_help_aggregate 0 \
+      -n 1 ${PROGRAM[@]} --junitxml=$PLUGIN_MPI_TEST_XML : \
+      -n 1 ${PROGRAM[@]}
+fi
diff --git a/admin/gitlab-ci/python-gmxapi03.gitlab-ci.yml b/admin/gitlab-ci/python-gmxapi03.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..d88b74f
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Jobs to test gmxapi client (Python) packages
+#
+
+.gmxapi-0.3:gcc-7:gmx2022:
+  extends:
+    - .variables:default
+    - .use-clang:base
+  image: ${CI_REGISTRY}/gromacs/gromacs/ci-ubuntu-18.04-gcc-7
+  stage: test
+  variables:
+    KUBERNETES_CPU_LIMIT: 2
+    KUBERNETES_CPU_REQUEST: 2
+    KUBERNETES_MEMORY_LIMIT: 2Gi
+    KUBERNETES_MEMORY_REQUEST: 2Gi
+    PY_UNIT_TEST_XML: $CI_PROJECT_DIR/py-JUnitTestResults.xml
+    PY_MPI_UNIT_TEST_XML: $CI_PROJECT_DIR/py-mpi-JUnitTestResults.xml
+    PY_ACCEPTANCE_TEST_XML: $CI_PROJECT_DIR/gmxapi-acceptance-JUnitTestResults.xml
+    PY_MPI_ACCEPTANCE_TEST_XML: $CI_PROJECT_DIR/gmxapi-acceptance-mpi-JUnitTestResults.xml
+  script:
+    - source $INSTALL_DIR/bin/GMXRC
+    - source $VENVPATH/bin/activate && INSTALL_DIR=$PWD/$INSTALL_DIR OMP_NUM_THREADS=1 bash admin/ci-scripts/build-and-test-py-gmxapi-0.3.sh
+  artifacts:
+    reports:
+      junit:
+        - $PY_UNIT_TEST_XML
+        - $PY_MPI_UNIT_TEST_XML
+        - $PY_ACCEPTANCE_TEST_XML
+        - $PY_MPI_ACCEPTANCE_TEST_XML
+    when: always
+    expire_in: 1 week
+  tags:
+    - k8s-scilifelab
+  # The dependency means we need to use the same tag restriction as upstream.
+  needs:
+    - job: gromacs:gcc-7:build
+      artifacts: true
+
+gmxapi-0.3:gcc-7:gmx2022:py-3.7.7:
+  extends:
+    - .gmxapi-0.3:gcc-7:gmx2022
+    - .rules:merge-requests:master
+  variables:
+    VENVPATH: "/root/venv/py3.7"
+    PY_VER: "3.7.7"
+
+gmxapi-0.3:gcc-7:gmx2022:py-3.8.2:
+  extends:
+    - .gmxapi-0.3:gcc-7:gmx2022
+    - .rules:merge-requests:master
+  variables:
+    VENVPATH: "/root/venv/py3.8"
+    PY_VER: "3.8.2"