-
Notifications
You must be signed in to change notification settings - Fork 138
139 lines (129 loc) · 4.23 KB
/
Copy pathunit-tests.yml
File metadata and controls
139 lines (129 loc) · 4.23 KB
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
133
134
135
136
137
138
139
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Unit testing
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
merge_group:
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CONDA_PATH: /opt/conda/
BILBY_ALLOW_PARAMETERS_AS_STATE: FALSE
SETUPTOOLS_SCM_IGNORE_DUBIOUS_OWNER: 1
jobs:
build:
name: ${{ matrix.python.name }} unit tests
runs-on: ubuntu-latest
container: ghcr.io/bilby-dev/bilby-python${{ matrix.python.short-version }}:latest
strategy:
fail-fast: false
matrix:
python:
- name: Python 3.11
version: 3.11
short-version: 311
- name: Python 3.12
version: 3.12
short-version: 312
- name: Python 3.13
version: 3.13
short-version: 313
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install package
run: |
# activate env so that conda list shows the correct environment
apt-get update
apt-get install -y gnupg curl
source $CONDA_PATH/bin/activate python${{ matrix.python.short-version }}
conda install -c conda-forge -y liblal!=7.7.0 python-lal!=7.7.0
python -m pip install .
conda list --show-channel-urls
shell: bash
# - name: Run precommits
# run: |
# pre-commit run --all-files --verbose --show-diff-on-failure
- name: Run unit tests
run: |
python -m pytest --cov=bilby --cov-branch --durations 10 -ra --color yes --cov-report=xml --junitxml=pytest.xml
- name: Run sampler tests
run: |
pytest test/integration/sampler_run_test.py --durations 10 -v
- name: Publish coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: python${{ matrix.python.short-version }}
slug: bilby-dev/bilby
- name: Coverage report
run: python -m coverage report --show-missing
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-${{ matrix.python.short-version }}
path: pytest.xml
array-backend:
name: ${{ matrix.python.name }} array backend (${{ matrix.backend.name }})
runs-on: ubuntu-latest
container: ghcr.io/bilby-dev/bilby-python${{ matrix.python.short-version }}:latest
strategy:
fail-fast: false
matrix:
python:
- name: Python 3.13
version: 3.13
short-version: 313
backend:
- name: numpy
install-args: .
- name: jax
install-args: .[jax]
- name: torch
install-args: .
env:
BILBY_ARRAY_API: 1
SCIPY_ARRAY_API: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install package
run: |
# activate env so that conda list shows the correct environment
apt-get update
apt-get install -y gnupg curl
source $CONDA_PATH/bin/activate python${{ matrix.python.short-version }}
conda install -c conda-forge -y liblal!=7.7.0 python-lal!=7.7.0
python -m pip install ${{ matrix.backend.install-args }}
python -m pip install orng
conda list --show-channel-urls
shell: bash
- name: Run array-backend unit tests
run: |
pytest --array-backend ${{ matrix.backend.name }} --durations 10 --junitxml=pytest-array.xml
- name: Publish coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: python${{ matrix.backend.name }}
slug: bilby-dev/bilby
- name: Upload array-backend test results
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-array-${{ matrix.python.short-version }}-${{ matrix.backend.name }}
path: pytest-array.xml