Skip to content

firecrown-ci

firecrown-ci #1786

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
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 }}
- name: Upload coverage reports to coveralls (legacy)
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