forked from tardis-sn/carsus
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (97 loc) · 3.42 KB
/
tests.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
111
112
113
114
115
116
117
118
119
# 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: 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 --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@v4
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'
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda-lock.yml
init-shell: bash
cache-environment: true
cache-downloads: true
environment-name: carsus
- 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)