Skip to content

Fix tests requiring astropy parts #736

Fix tests requiring astropy parts

Fix tests requiring astropy parts #736

Workflow file for this run

# For more information about TARDIS pipelines, please refer to:
#
# https://tardis-sn.github.io/tardis/contributing/development/continuous_integration.html
name: tests
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
schedule:
- cron: '0 0 * * 0' # run at midnight every Sunday
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
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 --refdata=carsus-refdata
--cov=carsus --cov-report=xml --cov-report=html
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:
if: github.repository_owner == 'tardis-sn'
strategy:
matrix:
pip: [true, false]
label: [osx-64, linux-64]
include:
- label: osx-64
os: macos-latest
- label: linux-64
os: ubuntu-latest
runs-on: ${{ matrix.os }}
name: ${{ matrix.label }}
steps:
- uses: actions/checkout@v4
- name: Clone tardis-sn/carsus-refdata
uses: actions/checkout@v4
with:
repository: tardis-sn/carsus-refdata
path: carsus-refdata
lfs: true
- uses: actions/cache@v4
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@v4
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: Download Lock File
run: wget -q https://raw.githubusercontent.com/tardis-sn/tardis/master/conda-${{ matrix.label }}.lock
if: matrix.pip == true
- name: Generate Cache Key
run: |
file_hash=$(cat conda-${{ matrix.label}}.lock | shasum -a 256 | cut -d' ' -f1)
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}"
id: cache-environment-key
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda-${{ matrix.label }}.lock
cache-environment-key: ${{ steps.cache-environment-key.outputs.file_hash }}
cache-downloads-key: ${{ steps.cache-environment-key.outputs.file_hash }}
environment-name: tardis
cache-environment: true
cache-downloads: true
- name: Install package
run: pip install -e .
- name: Run tests
run: pytest carsus ${{ env.PYTEST_FLAGS }}
- name: Upload to Codecov
run: bash <(curl -s https://codecov.io/bash)