Copy of CI from master to 2020
[gromacs.git] / admin / ci-scripts / build-and-test-sample_restraint-2021.sh
blob72aec86e203ce89672e07e16ed3434200a5c6c63
1 #!/usr/bin/env bash
3 # Build and test the sample_restraint package distributed with GROMACS 2021.
5 # This script is intended to support automated GROMACS testing infrastructure,
6 # and may be removed without notice.
8 # WARNING: This script assumes OpenMPI mpiexec. Syntax for launch wrappers from
9 # other implementations will need different syntax, and we should get a
10 # MPIRUNNER from the environment, or something.
12 # Make sure the script errors if any commands error.
13 set -ev
15 source $VENVPATH/bin/activate
17 # Create "sdist" source distribution archive.
18 pushd python_packaging/src
19 # TODO: Remove extraneous environment variable with resolution of #3273
20 # Ref: https://redmine.gromacs.org/issues/3273
21 GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
22 python setup.py sdist
23 # TODO: Identify SDIST
25 # Build and install from sdist.
26 # Note that tool chain may be provided differently in GROMACS 2020 and 2021.
27 # TODO: How should we distinguish the target branch?
28 # if [ "2020" -eq "$GROMACS_VERSION" ]; then
29 if [ 1 ]; then
30 GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
31 python -m pip install \
32 --no-cache-dir \
33 --no-deps \
34 --no-index \
35 --no-build-isolation \
36 dist/gmxapi*
37 # TODO: Build and install from $SDIST instead of wildcard.
38 # TODO: How should we distinguish the target branch?
39 # elif [ "2021" -eq "$GROMACS_VERSION" ]; then
40 # GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
41 # python -m pip install \
42 # --no-cache-dir \
43 # --no-deps \
44 # --no-index \
45 # --no-build-isolation \
46 # dist/gmxapi*
47 # TODO: Build and install from $SDIST instead of wildcard.
48 else
49 echo "Logic error in GROMACS version handling."
50 exit 1
52 popd
54 . $INSTALL_DIR/bin/GMXRC
55 pushd python_packaging/sample_restraint
56 mkdir build
57 pushd build
58 # TODO: Update with respect to https://redmine.gromacs.org/issues/3133
59 cmake .. \
60 -DDOWNLOAD_GOOGLETEST=ON \
61 -DGMXAPI_EXTENSION_DOWNLOAD_PYBIND=ON
62 make
64 make test
65 #TODO: Can we get ctest JUnitXML output here?
67 make install
68 popd
70 python -m pytest $PWD/tests --junitxml=$PLUGIN_TEST_XML
71 # TODO: enable MPI tests
72 # if [ -x `which mpiexec` ]; then
73 # PYTHONDONTWRITEBYTECODE=1 \
74 # mpiexec --allow-run-as-root \
75 # --mca opal_warn_on_missing_libcuda 0 \
76 # --mca orte_base_help_aggregate 0 \
77 # -n 2 \
78 # `which python` -m pytest \
79 # -p no:cacheprovider \
80 # $PWD/tests \
81 # --junitxml=$PLUGIN_MPI_TEST_XML
82 # fi
83 popd