Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test-mac #257

Merged
merged 2 commits into from
Jul 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: MacOS Test

on:
push:
pull_request:
schedule:
- cron: '42 4 5,20 * *'


jobs:
Test:
runs-on: macos-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: |
brew update && brew install openblas lapack cmake git gcc
echo "FC=$(which gfortran-11)" >> $GITHUB_ENV
echo "CC=$(which gcc)" >> $GITHUB_ENV
echo "CXX=$(which g++)" >> $GITHUB_ENV


- name: Install openmpi
if: ${{ matrix.MPI == 'openmpi' }}
run: |
brew install openmpi

- name: Install mpich
if: ${{ matrix.MPI == 'mpich' }}
run: |
brew install mpich

- 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
micromamba list
micromamba info

- 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
cd MultiNest/build && rm -rf * && cmake .. && make && cd ../..
ls -l MultiNest/
ls -l MultiNest/lib
echo "LD_LIBRARY_PATH=$HOME/work/PyMultiNest/PyMultiNest/MultiNest/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$HOME/work/PyMultiNest/PyMultiNest/MultiNest/lib:$DYLD_LIBRARY_PATH" >> $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:
sahiljhawar marked this conversation as resolved.
Show resolved Hide resolved
runs-on: macos-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

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
miniforge-version: latest
use-mamba: true
mamba-version: "*"

- name: Install multinest
shell: bash -l {0}
run: |
conda install -c conda-forge --file conda-requirements.txt multinest

- name: Test imports
run: |
python -m pip install .
python -c 'import pymultinest'

- name: Tests
run: |
python pymultinest_demo_minimal.py