Skip to content

Commit

Permalink
Merge 826689a into edee052
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkwiecien committed Aug 8, 2023
2 parents edee052 + 826689a commit 4ca368b
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 123 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
FORCE_COLOR: 3
CONDA_ENV: ./environment.yml

jobs:

lint:
name: Run Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run black
uses: psf/black@stable

- name: Run flake8
uses: py-actions/flake8@v2
with:
path: "tjpcov tests"

tests:
needs: lint
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}

defaults:
run:
# IMPORTANT: this is needed to make sure that the conda environment is auto activated
shell: bash -el {0}

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.11"]
runs-on: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up mamba
uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
python-version: ${{ matrix.python-version }}
show-channel-urls: true
auto-update-conda: true
use-mamba: true
activate-environment: tjpcov
miniforge-version: latest
miniforge-variant: Mambaforge

- name: Cache Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT

- name: Check for cached environment
uses: actions/cache@v3
id: cache
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ${{env.CONDA}}/envs
key:
${{runner.os}}.${{runner.arch}}.mamba-py.${{matrix.python-version}}.${{hashFiles('pyproject.toml')}}.${{hashFiles('environment.yml')}}.${{steps.get-date.outputs.today}}.${{env.CACHE_NUMBER}}

- name: Install environment packages
if: steps.cache.outputs.cache-hit != 'true'
run: |
export MAMBA_NO_BANNER=1
mamba env update --file ${{ env.CONDA_ENV }}
- name: Install TJPCov
run: |
pip install .[nmt] --no-deps
- name: Install mpi4py into cache
# If this is cached, re-add mpi4py
if: steps.cache.outputs.cache-hit == 'true'
run: |
mamba install -y openmpi
pip install -U mpi4py --no-cache-dir --no-deps
- name: Run Tests
run: coverage run --source=tjpcov -m pytest tests/test_covariance_clusters.py

# - name: Run MPI Tests (OpenMPI)
# run: |
# mpiexec -n 2 pytest -vv tests/test_mpi.py

# mamba remove -y openmpi
# pip uninstall -y mpi4py

# - name: Run MPI Tests (mpich)
# run: |
# mamba install -y mpich
# pip install -U mpi4py --no-cache-dir --no-deps

# mpiexec -n 2 pytest -vv tests/test_mpi.py

# mamba remove -y mpich
# pip uninstall -y mpi4py

- name: Publish code coverage
if: ${{ (runner.os == 'Linux') && (matrix.python-version == '3.11') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
16 changes: 0 additions & 16 deletions .github/workflows/lint.yml

This file was deleted.

95 changes: 0 additions & 95 deletions .github/workflows/test.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[![PyPI version](https://badge.fury.io/py/tjpcov.svg)](https://badge.fury.io/py/tjpcov)
[![Coverage Status](https://coveralls.io/repos/github/LSSTDESC/TJPCov/badge.svg?branch=master)](https://coveralls.io/github/LSSTDESC/TJPCov?branch=master)
[![Documentation Status](https://readthedocs.org/projects/tjpcov/badge/?version=latest)](https://tjpcov.readthedocs.io/en/latest/?badge=latest)


# TJPCov

TJPCov is a general covariance calculator interface to be used within LSST DESC.
Expand Down
27 changes: 18 additions & 9 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
name: tjpcov # minimum environment for tjpcov development
name: tjpcov
channels:
- conda-forge
- defaults
dependencies:
- python>=3.8
- mpi4py
- pip
- numpy
- wheel
- black
- flake8
- pytest
- pytest-rerunfailures
- coveralls
- numpy
- scipy
- pyyaml
- pyccl >= 2.5.0, < 2.8.0
- sacc>=0.8
- namaster
# tjpcov is only available at the moment through PyPi
- pip:
# Installing TJPcov in two steps to avoid making NaMaster installation to
# fail due to (https://github.com/LSSTDESC/NaMaster/issues/138)
- tjpcov[full]
- camb
- Jinja2
- healpy
- h5py
- openmpi
- mpi4py

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ dependencies = [
"numpy",
"Jinja2",
"pyyaml",
"pytest",
"pytest-rerunfailures",
"pyccl>=2.5.0,<2.8.0",
"pyccl >= 2.5.0, < 2.8.0",
"sacc>=0.8",
"camb",
"healpy",
Expand Down

0 comments on commit 4ca368b

Please sign in to comment.