-
-
Notifications
You must be signed in to change notification settings - Fork 405
132 lines (111 loc) · 3.56 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
120
121
122
123
124
125
126
127
128
129
130
131
132
# For more information about TARDIS pipelines, please refer to:
#
# https://tardis-sn.github.io/tardis/development/continuous_integration.html
name: tests
on:
push:
branches:
- master
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
- labeled
workflow_call:
inputs:
pip_git:
description: "Whether or not to install tardis using git"
required: false
type: boolean
default: false
env:
CACHE_NUMBER: 0 # increase to reset cache manually
PYTEST_FLAGS: --tardis-regression-data=${{ github.workspace }}/tardis-regression-data --cov=tardis --cov-report=xml --cov-report=html --cov-append
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
defaults:
run:
shell: bash -l {0}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
tests:
name: ${{ matrix.continuum }} continuum ${{ matrix.os }} ${{ inputs.pip_git && 'pip tests enabled' || '' }}
if: github.repository_owner == 'tardis-sn'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
label: [osx-arm64, linux-64]
continuum: ['not', '']
include:
- label: osx-arm64
os: macos-latest
prefix: /Users/runner/miniconda3/envs/tardis
- label: linux-64
os: ubuntu-latest
prefix: /usr/share/miniconda3/envs/tardis
steps:
- uses: actions/checkout@v4
- name: Setup LFS
uses: ./.github/actions/setup_lfs
- name: Setup environment
uses: ./.github/actions/setup_env
with:
os-label: ${{ matrix.label }}
- name: Install package editable
if: ${{ !inputs.pip_git }}
run: |
pip install -e . --user
- name: Install package git
if: ${{ inputs.pip_git }}
run: |
pip install git+https://github.com/tardis-sn/tardis.git@master
- name: Install qgridnext
if: ${{ !inputs.pip_git }}
run: |
pip install qgridnext
- name: Run tests
run: pytest tardis ${{ env.PYTEST_FLAGS }} -m "${{ matrix.continuum }} continuum"
- name: Regression Data Generation tests
run: pytest tardis ${{ env.PYTEST_FLAGS }} --generate-reference -m "${{ matrix.continuum }} continuum"
if: contains(github.event.pull_request.labels.*.name, 'run-generation-tests') || github.ref == 'refs/heads/master'
- run: mv .coverage .coverage.${{ strategy.job-index }}
- uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.continuum }}-continuum-${{ matrix.os }}
include-hidden-files: true
path: |
.coverage*
!.coveragerc
combine_coverage_reports:
needs: [tests]
if: github.repository_owner == 'tardis-sn'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup_env
with:
os-label: linux-64
# will download all artifacts(in this case all are coverage reports)
- uses: actions/download-artifact@v4
with:
path: .
merge-multiple: true
- name: Combine coverage reports
run: |
coverage combine
coverage xml
coverage html
- name: Print report
run: coverage report
- uses: codecov/codecov-action@v4
if: always()
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true