-
Notifications
You must be signed in to change notification settings - Fork 7
111 lines (105 loc) · 3.58 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: firecrown-ci
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
schedule:
- cron: '47 1 * * *'
jobs:
firecrown-miniforge:
name: Firecrown (${{ matrix.os }}, python-${{ matrix.python-version }}, Miniforge)
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "macos"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Setup miniforge
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: firecrown_developer
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
show-channel-urls: true
use-mamba: true
- name: Cache date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key: miniforge-${{ runner.os }}--${{ runner.arch }}--python-${{ matrix.python-version }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER }}
env:
CACHE_NUMBER: 0
id: cache
- name: Update environment
run: |
conda env update -q -v -n firecrown_developer -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Setting up Firecrown
shell: bash -l {0}
run: |
export FIRECROWN_DIR=${PWD}
conda env config vars set FIRECROWN_DIR=${FIRECROWN_DIR}
conda activate firecrown_developer
pip install --no-deps -e .
- name: Setting up CosmoSIS
shell: bash -l {0}
run: |
source ${CONDA_PREFIX}/bin/cosmosis-configure
pushd ${CONDA_PREFIX}
cosmosis-build-standard-library
export CSL_DIR=${PWD}/cosmosis-standard-library
conda env config vars set CSL_DIR=${CSL_DIR}
conda activate firecrown_developer
if: steps.cache.outputs.cache-hit != 'true'
- name: Setting up Cobaya
shell: bash -l {0}
run: python -m pip install cobaya
if: steps.cache.outputs.cache-hit != 'true'
- name: Ensure clear Jupyter Notebooks
uses: ResearchSoftwareActions/EnsureCleanNotebooksAction@1.1
- name: Running black check
shell: bash -l {0}
run: |
black --check firecrown
black --check tests
black --check examples
- name: Running flake8
shell: bash -l {0}
run: |
flake8 firecrown
flake8 examples
flake8 tests
- name: Running mypy
shell: bash -l {0}
run: |
mypy -p firecrown
mypy -p examples
mypy -p tests
- name: Running pylint
shell: bash -l {0}
run: |
pylint firecrown
pylint --rcfile tests/pylintrc tests
pylint --rcfile firecrown/models/pylintrc firecrown/models
- name: Running unit tests
shell: bash -l {0}
run: python -m pytest -vv --runslow --cov firecrown --cov-report xml
- name: Running integration tests
shell: bash -l {0}
run: python -m pytest -vv -s --integration tests/integration
- name: Upload coverage reports to Codecov
if: ${{ (matrix.os == 'ubuntu') && (matrix.python-version == '3.11') }}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}