Test code functionality #257
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
name: Test code functionality | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
schedule: | |
- cron: "0 2 * * 5" | |
jobs: | |
tests: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 90 | |
strategy: | |
matrix: | |
mpi: [ 'yes', 'no' ] | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] | |
mpi4py-version: [ 3.1.5 ] | |
netcdf4-python-version: [ 1.6.2 ] | |
muspectre-version: [ 0.26.4 ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Set up python3 ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies and extension module | |
run: | | |
set -x | |
sudo apt-get update -qy | |
sudo apt-get install -y python3-dev python3-venv libfftw3-dev libopenblas-dev | |
python3 -m venv venv | |
source venv/bin/activate | |
python3 -m pip install --upgrade pip | |
python3 -m pip install flit numpy pip-tools setuptools wheel | |
if [ "${{ matrix.mpi }}" == "yes" ]; then | |
# We now need to recompile some modules to link with native MPI | |
sudo apt-get install openmpi-bin libopenmpi-dev libfftw3-mpi-dev libhdf5-mpi-dev libpnetcdf-dev libnetcdf-pnetcdf-dev | |
# Install mpi4py first (because netCDF4 depends on it) | |
export NETCDF4_DIR=/usr/lib/x86_64-linux-gnu/netcdf/pnetcdf | |
export CC=mpicc | |
python3 -m pip install -v --no-binary mpi4py mpi4py==${{ matrix.mpi4py-version }} | |
else | |
sudo apt-get install libhdf5-dev libnetcdf-dev | |
fi | |
python3 -m pip install -v cython | |
python3 -m pip install -v --no-build-isolation --no-binary netCDF4 netCDF4==${{ matrix.netcdf4-python-version }} | |
# We need to force compilation of muSpectre; otherwise it will download a binary wheel which has no FFTW | |
# support, but we need this for the half-complex tests | |
python3 -m pip install -v --no-binary muSpectre muSpectre==${{ matrix.muspectre-version }} | |
python3 -m pip install -v .[test] | |
# Check that NetCDF install was not overriden | |
python3 .check_netcdf_capabilities.py ${{ matrix.mpi }} | |
python3 .check_mufft_capabilities.py ${{ matrix.mpi }} | |
- name: Test with pytest | |
run: | | |
source venv/bin/activate | |
if [ "${{ matrix.mpi }}" == "yes" ]; then | |
python3 run-tests.py --no-build --verbose --full-trace | |
else | |
python3 -m pytest --verbose --full-trace -s | |
fi |