Copy of CI from master to 2020
[gromacs.git] / admin / ci-scripts / build-and-test-py-gmxapi-0.2.sh
blob2bd12b880506bf825e2fd9e24b17826e16ad8226
1 #!/usr/bin/env bash
3 # Build, install, and test the gmxapi 0.2 Python package developed with
4 # GROMACS 2021.
6 # This script assumes an activated Python venv with the
7 # gmxapi dependencies already installed, with `python` resolvable by the shell
8 # to the appropriate Python interpreter.
10 # This script is intended to support automated GROMACS testing infrastructure,
11 # and may be removed without notice.
13 # WARNING: This script assumes OpenMPI mpiexec. Syntax for launch wrappers from
14 # other implementations will need different syntax, and we should get a
15 # MPIRUNNER from the environment, or something.
17 # Make sure the script errors if any commands error.
18 set -ev
20 # Create "sdist" source distribution archive.
21 pushd python_packaging/src
22 # TODO: Remove extraneous environment variable with resolution of #3273
23 # Ref: https://redmine.gromacs.org/issues/3273
24 GMXTOOLCHAINDIR=$INSTALL_DIR/share/cmake/gromacs \
25 python setup.py sdist
26 # TODO: Identify SDIST
28 # Build and install from sdist.
29 # Note that tool chain may be provided differently in GROMACS 2020 and 2021.
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.
39 popd
41 # Run Python unit tests.
42 python -m pytest python_packaging/src/test --junitxml=$PY_UNIT_TEST_XML
43 # TODO: enable MPI tests
44 #if [ -x `which mpiexec` ]; then
45 # PYTHONDONTWRITEBYTECODE=1 \
46 # mpiexec --allow-run-as-root \
47 # --mca opal_warn_on_missing_libcuda 0 \
48 # --mca orte_base_help_aggregate 0 \
49 # -n 2 \
50 # `which python` -m pytest \
51 # -p no:cacheprovider \
52 # $PWD/python_packaging/src/test \
53 # --junitxml=$PY_MPI_UNIT_TEST_XML
54 #fi
56 # Run Python acceptance tests.
57 python -m pytest python_packaging/test --junitxml=$PY_ACCEPTANCE_TEST_XML
58 # TODO: enable MPI tests
59 #if [ -x `which mpiexec` ]; then
60 # PYTHONDONTWRITEBYTECODE=1 \
61 # mpiexec --allow-run-as-root \
62 # --mca opal_warn_on_missing_libcuda 0 \
63 # --mca orte_base_help_aggregate 0 \
64 # -n 2 \
65 # `which python` -m pytest \
66 # -p no:cacheprovider \
67 # $PWD/python_packaging/test \
68 # --junitxml=$PY_MPI_ACCEPTANCE_TEST_XML
69 #fi