-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (79 loc) · 3.07 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Author - Stuart McAlpine - [email protected] - Jan 2023
name: DESC Legacy Blinding for Cosmosis
# How does the workflow get triggered?
on:
# Triggers when push/pull-request made to the main branch.
pull_request:
branches:
- main
push:
branches:
- main
- develop
# List of jobs for this workflow.
jobs:
# Our pytest job.
legacy_blinding-pytest:
# Our strategy lists the OS and Python versions we want to test on.
# Needed to activate miniconda environment.
defaults:
run:
shell: bash -l {0}
strategy:
# Don't quit all jobs if only one job fails.
fail-fast: false
matrix:
python-version: ["3.9"]
os: [ubuntu-20.04, macos-latest]
include:
- os: ubuntu-20.04
INSTALL_DEPS: sudo apt-get update && sudo apt-get -y install gfortran-7 swig libopenmpi-dev openmpi-bin libopenblas-dev && sudo ln -s `which gfortran-7` /usr/local/bin/gfortran
- os: macos-latest
INSTALL_DEPS: brew update-reset && HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gcc swig libomp open-mpi openblas && if [ ! -f /usr/local/bin/gfortran ]; then ln -s /usr/local/bin/gfortran-$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1) /usr/local/bin/gfortran; fi
# What operating system is this job running on?
runs-on: ${{ matrix.os }}
# Our CI steps for this job.
steps:
# Check out this repository code.
- name: Check out repository code
uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: cosmosis-env
channels: conda-forge
miniforge-variant: Mambaforge
miniforge-version: latest
python-version: ${{ matrix.pyversion }}
- name: Install dependencies with conda
shell: bash -l {0}
run: mamba install -c conda-forge "cosmosis>=2.5" cosmosis-build-standard-library pytest
# - name: Source cosmosis
# # Install Python.
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: ${{ matrix.INSTALL_DEPS }}
- name: Setup cosmosis standard library
shell: bash -l {0}
run: |
source cosmosis-configure
cosmosis-build-standard-library -i
# Install our package.
- name: Install legacy_blinding
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install .
# Perform the unit test and outputs a coverage report
- name: Test with pytest
shell: bash -l {0}
run: |
source cosmosis-configure
pytest --cov=blind_2pt_cosmosis --cov-report=xml ./tests
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}