Skip to content

Test

Test #72

Workflow file for this run

name: Test
on:
push:
pull_request:
schedule:
- cron: '42 4 5,20 * *'
jobs:
Test:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3]
MPI: ['mpich', 'openmpi', 'no']
defaults:
run:
# this is needed, because otherwise conda env is not available
shell: bash -leo pipefail {0} {0}
steps:
- name: Install build dependencies
run: |
sudo apt-get update && sudo apt-get -y --no-install-recommends install -y -qq libblas{3,-dev} liblapack{3,-dev} libatlas-base-dev cmake build-essential git gfortran
- name: Install openmpi
if: ${{ matrix.MPI == 'openmpi' }}
run: |
sudo apt-get install -qq openmpi-bin libopenmpi-dev python3-mpi4py
update-alternatives --list mpi|grep "${{ matrix.MPI }}" | xargs -rt sudo update-alternatives --set mpi
update-alternatives --list mpirun|grep "${{ matrix.MPI }}" | xargs -rt sudo update-alternatives --set mpirun
- name: Install mpich
if: ${{ matrix.MPI == 'mpich' }}
run: |
sudo apt-get install -qq mpich libmpich-dev python3-mpi4py
update-alternatives --list mpi|grep "${{ matrix.MPI }}" | xargs -rt sudo update-alternatives --set mpi
update-alternatives --list mpirun|grep "${{ matrix.MPI }}" | xargs -rt sudo update-alternatives --set mpirun
- uses: actions/checkout@v2
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: test
cache-environment: false
cache-downloads: true
- name: Install python dependencies
run: |
micromamba install -c conda-forge --file conda-requirements.txt python=${{ matrix.python-version }} corner coveralls pytest toml
pip install git+https://github.com/JohannesBuchner/coverage-lcov@feature-coverage7
#sed --in-place -e 's,"report_include",,g' -e 's,"report_omit",,g' /usr/share/miniconda/envs/*/lib/python*/site-packages/coverage_lcov/converter.py
conda list
conda info -a
- name: install mpi4py
if: ${{ matrix.MPI != 'no' }}
run: |
pip install --user mpi4py
python -c 'import mpi4py'
- name: Install MultiNest
run: |
git clone https://github.com/JohannesBuchner/MultiNest
mkdir -p MultiNest/build; pushd MultiNest/build; cmake .. && make && popd
test -e MultiNest/lib/libmultinest.so
echo LD_LIBRARY_PATH=MultiNest/lib/:${LD_LIBRARY_PATH} >> $GITHUB_ENV
echo RDMAV_FORK_SAFE=1 >> $GITHUB_ENV
- name: Install PyMultiNest
run: |
python -m pip install .
- name: Test imports
run: |
python -c 'import pymultinest'
rm -rf chains/
- name: No-MPI tests
if: ${{ matrix.MPI == 'no' }}
run: |
# do not test pycuba, it is broken
rm tests/pycuba_test.py
coverage run -m pytest
coverage report
coverage-lcov
python pymultinest_demo_minimal.py
python pymultinest_demo.py
- name: MPI tests
if: ${{ matrix.MPI == 'openmpi' }}
run: |
mpiexec -np 4 --oversubscribe python pymultinest_demo_minimal.py
mpiexec -np 4 --oversubscribe python pymultinest_demo.py
- name: MPI tests
if: ${{ matrix.MPI == 'mpich' }}
run: |
mpiexec -np 4 python pymultinest_demo_minimal.py
mpiexec -np 4 python pymultinest_demo.py
- name: Long filename test
run: |
python tests/pymultinest_long_name_test.py;
- name: Marginal scripts test
run: |
python multinest_marginals.py chains/3-
python multinest_marginals_corner.py chains/3-
- name: Coveralls Finished
uses: coverallsapp/github-action@master
if: ${{ matrix.MPI == 'no' }}
with:
path-to-lcov: lcov.info
github-token: ${{ secrets.github_token }}
flag-name: MPI-${{ matrix.MPI }}
CondaTest:
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
# this is needed, because otherwise conda env is not available
shell: bash -leo pipefail {0} {0}
steps:
- uses: actions/checkout@v2
- uses: mamba-org/setup-micromamba@v1
with:
cache-environment: false
cache-downloads: true
environment-name: test
environment-file: conda-requirements.txt
- name: Install dependencies
run: micromamba install -c conda-forge --quiet multinest
- name: Test imports
run: |
python -m pip install .
python -c 'import pymultinest'
- name: Tests
run: |
python pymultinest_demo_minimal.py