forked from bayesflow-org/bayesflow
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (91 loc) · 2.5 KB
/
tests.yaml
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
name: Tests
on:
pull_request:
push:
branches:
- master
- dev
- streamlined-backend
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yaml
python-version: "3.10"
- name: Show Environment Info
run: |
conda info
conda list
conda config --show-sources
conda config --show
printenv | sort
- name: Run Linter
run: |
ruff check --config pyproject.toml --verbose
- name: Run Formatter
run: |
ruff format --check --config pyproject.toml --verbose
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11"]
backend: ["jax", "tensorflow", "torch"]
defaults:
run:
shell: bash -el {0}
env:
KERAS_BACKEND: ${{ matrix.backend }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yaml
python-version: ${{ matrix.python-version }}
- name: Install JAX
if: ${{ matrix.backend == 'jax' }}
run: |
pip install -U jax
- name: Install NumPy
if: ${{ matrix.backend == 'numpy' }}
run: |
conda install numpy
- name: Install Tensorflow
if: ${{ matrix.backend == 'tensorflow' }}
run: |
pip install -U tensorflow
- name: Install PyTorch
if: ${{ matrix.backend == 'torch' }}
run: |
conda install pytorch torchvision torchaudio cpuonly -c pytorch
- name: Show Environment Info
run: |
conda info
conda list
conda config --show-sources
conda config --show
printenv | sort
conda env export
- name: Run Tests
run: |
pytest
- name: Create Coverage Report
run: |
coverage xml
- name: Upload Coverage Reports to CodeCov
uses: codecov/codecov-action@v4
with:
# do not use the files attribute here, otherwise the reports are not merged correctly
token: ${{ secrets.CODECOV_TOKEN }}