Skip to content

Commit

Permalink
Merge pull request #89 from muon-spectroscopy-computational-project/i…
Browse files Browse the repository at this point in the history
…mplement_codecov

Fix macOS OMP tests action and implement codecov
  • Loading branch information
patrick-austin authored Oct 12, 2023
2 parents e57dfd3 + 71f0bd0 commit 26df005
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
branch = True
source = muspinsim
omit = muspinsim/tests/*
17 changes: 16 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,32 @@ jobs:
# Default compiler on macOS doesn't support OpenMP, so force the usage
# of homebrew's llvm see
# https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md
# Even when installed, clang++ may not be able to find the OMP library when installed
# To resolve this, export the environment variables suggested by brew to $GITHUB_ENV
- name: Add optional environment variables
run: |
if [ "$RUNNER_OS" == 'macOS' ]; then
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> "$GITHUB_ENV"
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> "$GITHUB_ENV"
brew info libomp
echo "LDFLAGS=-L/usr/local/opt/libomp/lib" >> "$GITHUB_ENV"
echo "CPPFLAGS=-I/usr/local/opt/libomp/include" >> "$GITHUB_ENV"
fi
shell: bash

- name: Install package with -e
env:
MUSPINSIM_WITH_OPENMP: 1
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
run: pip install -e .
- name: Install package
env:
MUSPINSIM_WITH_OPENMP: 1
if: matrix.python-version != '3.10' || matrix.os != 'ubuntu-latest'
run: pip install .

- name: Test with pytest
run: pytest --pyargs muspinsim
run: pytest --cov --cov-report xml --pyargs muspinsim
- name: Upload to Codecov
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Build Status](https://github.com/muon-spectroscopy-computational-project/muspinsim/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/muon-spectroscopy-computational-project/muspinsim/actions/workflows/test.yml)
[![Codecov](https://codecov.io/gh/muon-spectroscopy-computational-project/muspinsim/branch/main/graph/badge.svg)](https://codecov.io/gh/muon-spectroscopy-computational-project/muspinsim)

# muspinsim

MuSpinSim is a Python software meant to simulate muon spectroscopy experiments. In particular, it simulates the spin dynamics of a system of a muon plus other spins, namely electrons and atomic nuclei. It can simulate various common experimental setups and account for hyperfine, dipolar and quadrupolar couplings. It is also able to fit its simulations
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pycodestyle==2.10.0
pyflakes==3.0.1
pyparsing==3.0.9
pytest==7.2.1
pytest-cov==4.1.0
python-dateutil==2.8.2
PyYAML==6.0
qutip==4.7.1
Expand Down

0 comments on commit 26df005

Please sign in to comment.