Skip to content

More testing

More testing #1220

Workflow file for this run

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.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- 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 --ignore-missing-imports
mypy -p examples --ignore-missing-imports
mypy -p tests --ignore-missing-imports
- name: Running pylint
shell: bash -l {0}
run: |
pylint --rcfile tests/pylintrc tests
pylint --rcfile firecrown/models/pylintrc firecrown/models
pylint firecrown/connector
pylint firecrown/*.py
pylint firecrown/likelihood/*.py
pylint firecrown/likelihood/gauss_family/*.py
- name: Running pytest
shell: bash -l {0}
run: python -m pytest -vv
- name: Running example - cosmosis - cosmic-shear
shell: bash -l {0}
run: |
cd examples/cosmicshear
python generate_cosmicshear_data.py
cosmosis cosmicshear.ini
- name: Running example - cosmosis - des-y1-3x2pt
shell: bash -l {0}
run: |
cd examples/des_y1_3x2pt
cosmosis des_y1_3x2pt.ini
- name: Running example - cosmosis - des-y1-3x2pt-PT
shell: bash -l {0}
run: |
cd examples/des_y1_3x2pt
cosmosis des_y1_3x2pt_PT.ini
- name: Running example - cobaya - des-y1-3x2pt
shell: bash -l {0}
run: |
cd examples/des_y1_3x2pt
cobaya-run cobaya_evaluate.yaml
- name: Running example - cobaya - des-y1-3x2pt-PT
shell: bash -l {0}
run: |
cd examples/des_y1_3x2pt
cobaya-run cobaya_evaluate_PT.yaml
- name: Running example - NumCosmo - des-y1-3x2pt
shell: bash -l {0}
run: |
cd examples/des_y1_3x2pt
python numcosmo_run.py
- name: Running example - NumCosmo - des-y1-3x2pt-PT
shell: bash -l {0}
run: |
cd examples/des_y1_3x2pt
python numcosmo_run_PT.py
- name: Running example - cosmosis - srd_sn
shell: bash -l {0}
run: |
cd examples/srd_sn
cosmosis sn_srd.ini
- name: Running example - NumCosmo - srd_sn
shell: bash -l {0}
run: |
cd examples/srd_sn
python numcosmo_run.py
- name: Running example - cosmosis - cluster_number_counts
shell: bash -l {0}
run: |
cd examples/cluster_number_counts
python generate_rich_mean_mass_sacc_data.py
cosmosis cluster_counts_redshift_richness.ini
cosmosis cluster_mean_mass_redshift_richness.ini
cosmosis cluster_counts_mean_mass_redshift_richness.ini
- name: Code coverage
if: ${{ (matrix.os == 'ubuntu') && (matrix.python-version == '3.11') }}
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python -m pip install --no-input coveralls
coverage run --source=firecrown -m pytest tests/
coveralls --service=github