-
Notifications
You must be signed in to change notification settings - Fork 3
146 lines (135 loc) · 4.19 KB
/
ci.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: CI
on:
push:
branches:
- 'main'
pull_request:
jobs:
code-style:
name: Code Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'formatting-requirements.txt'
- name: Install formatting dependencies
id: fmt-deps
run: pip install -r formatting-requirements.txt
- name: Check code style with `black`
run: black --check --diff .
- name: Check import order with `isort`
run: isort --check --diff .
if: success() || steps.fmt-deps.outcome == 'success'
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: |
pyproject.toml
probnum/pyproject.toml
tests/requirements.txt
linting-requirements.txt
- name: Install probnum from submodule
working-directory: ./probnum
# The git fetch is needed because probnum reads its version information from the SCM
run: |
git fetch --tags --unshallow
pip install .
- name: Install linting dependencies
id: lint-deps
run: |
pip install ".[plotting]"
pip install -r tests/requirements.txt
pip install -r linting-requirements.txt
- name: Lint code with `pylint`
run: pylint src --jobs 0
- name: Lint tests with `pylint`
run: pylint tests/**/*.py --disable="redefined-outer-name"
if: success() || steps.lint-deps.outcome == 'success'
tests:
name: Tests
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
probnum/pyproject.toml
tests/requirements.txt
- name: Install probnum from submodule
working-directory: ./probnum
# The git fetch is needed because probnum reads its version information from the SCM
run: |
git fetch --tags --unshallow
pip install .
- name: Install test dependencies
run: |
pip install .
pip install -r tests/requirements.txt
- name: Run tests with `pytest`
run: pytest
experiments:
name: Experiments
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up LaTeX
run: |
sudo apt-get update
sudo apt-get install $(cat probnum/apt.txt)
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
probnum/pyproject.toml
experiments/requirements.txt
.github/workflows/experiment-requirements.txt
- name: Install probnum from submodule
working-directory: ./probnum
# The git fetch is needed because probnum reads its version information from the SCM
run: |
git fetch --tags --unshallow
pip install .
- name: Install experiment dependencies
run: |
pip install .
pip install -r experiments/requirements.txt
pip install -r .github/workflows/experiment-requirements.txt
- name: Run all experiment notebooks with `nbconvert`
run: |
for file in $(find -wholename "./experiments/*.ipynb")
do
echo "Running ${file}..."
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.kernel_name=python3 $file
done