tests #414
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For more information about TARDIS pipelines, please refer to: | |
# | |
# https://tardis-sn.github.io/tardis/development/continuous_integration.html | |
name: tests | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
schedule: | |
- cron: '0 0 * * 0' # run at midnight every Sunday | |
concurrency: | |
group: tests-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
XUVTOP: /tmp/chianti | |
CHIANTI_DL_URL: https://download.chiantidatabase.org | |
CHIANTI_DB_VER: CHIANTI_v9.0.1_database.tar.gz | |
PYTEST_FLAGS: --remote-data --runslow --test-db=carsus-db/test_databases/test.db | |
--refdata=carsus-refdata --cov=carsus --cov-report=xml | |
--cov-report=html --arraydiff --arraydiff-reference-path=carsus-refdata/arraydiff | |
NBCONVERT_CMD: jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to html | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
CMFGEN_DL_URL: http://kookaburra.phyast.pitt.edu/hillier/cmfgen_files | |
CMFGEN_DB_VER: atomic_data_15nov16.tar.gz | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
defaults: | |
run: | |
shell: bash -l {0} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Clone tardis-sn/carsus-db | |
uses: actions/checkout@v2 | |
with: | |
repository: tardis-sn/carsus-db | |
path: carsus-db | |
lfs: false # do not pull LFS objects | |
- name: Pull test database | |
run: | | |
cd carsus-db | |
git lfs install --skip-smudge | |
git lfs pull --include="test_databases/test.db" | |
- name: Clone tardis-sn/carsus-refdata | |
uses: actions/checkout@v2 | |
with: | |
repository: tardis-sn/carsus-refdata | |
path: carsus-refdata | |
lfs: true | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ env.XUVTOP }} | |
key: ${{ runner.os }}-${{ env.CHIANTI_DB_VER }} | |
id: chianti-cache | |
- name: Download Chianti database | |
run: | | |
mkdir -p ${{ env.XUVTOP }} | |
wget -q ${{ env.CHIANTI_DL_URL }}/${{ env.CHIANTI_DB_VER }} -O ${{ env.XUVTOP }}/chianti.tar.gz | |
tar -zxf ${{ env.XUVTOP }}/chianti.tar.gz -C ${{ env.XUVTOP }} | |
if: steps.chianti-cache.outputs.cache-hit != 'true' | |
- uses: actions/cache@v2 | |
with: | |
path: /tmp/atomic | |
key: ${{ env.CMFGEN_DB_VER }} | |
id: cmfgen-cache | |
- name: Download CMFGEN database | |
run: | | |
wget -q -U "Mozilla/4.0" ${{ env.CMFGEN_DL_URL }}/${{ env.CMFGEN_DB_VER }} -O /tmp/atomic.tar.gz | |
tar -zxf /tmp/atomic.tar.gz -C /tmp | |
if: steps.cmfgen-cache.outputs.cache-hit != 'true' | |
- name: Setup environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
environment-file: carsus_env3.yml | |
activate-environment: carsus | |
use-mamba: true | |
- name: Install package | |
run: pip install -e . | |
- name: Run tests | |
run: pytest carsus ${{ env.PYTEST_FLAGS }} | |
- name: Run notebooks | |
run: | | |
${{ env.NBCONVERT_CMD }} carsus/io/tests/test_legacy_consistency.ipynb | |
${{ env.NBCONVERT_CMD }} carsus/io/tests/test_output_base.ipynb | |
env: | |
CARSUS_REFDATA: ${{ github.workspace }}/carsus-refdata | |
- name: Upload to Codecov | |
run: bash <(curl -s https://codecov.io/bash) |