-
Notifications
You must be signed in to change notification settings - Fork 10
178 lines (150 loc) · 4.56 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: pedpy-ci
on:
schedule:
# Runs at 2:00 am each day
- cron: '00 2 * * *'
push:
branches:
- main
- rls-*
tags:
- '**'
pull_request:
branches:
- main
- rls-*
jobs:
pre-build-checks:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.10' ]
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -VV
python3 -m site
python3 -m pip install --upgrade pip setuptools wheel build
python3 -m pip install -r requirements.txt
- name: Check format, docstring style, typing, linting
run: |
${{github.workspace}}/scripts/ci.sh
build:
needs: pre-build-checks
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-12, macos-14, windows-latest ]
python-version: [ '3.10' ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -VV
python3 -m site
python3 -m pip install --upgrade pip setuptools wheel build
python3 -m pip install -r requirements.txt
- name: Run pytests
run: |
python3 -m pytest --cov=pedpy --cov-report=xml -vv -s tests
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build wheel
id: build-wheel
if: matrix.os == 'ubuntu-latest'
run: |
python3 -m build
- name: Upload wheel as artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
- name: Upload notebooks and demo files as artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: demos_usage
path: |
notebooks/
test:
needs: build
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-12, macos-14, windows-latest ]
python-version: [ '3.10', '3.11' , '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download notebooks and demo files as artifacts
uses: actions/download-artifact@v4
with:
name: demos_usage
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Install wheel
shell: bash
run: |
python3 -m pip install --upgrade pip jupyter nbconvert nbformat matplotlib
python3 -m pip install dist/*whl
- name: Test if install was successful
run: |
python3 -c "import pedpy; print(f'PedPy {pedpy.__version__} (SHA: {pedpy.__commit_hash__})')"
- name: Run getting started notebook
run: |
jupyter nbconvert --to notebook --execute getting_started.ipynb
- name: Run user guide notebook
run: |
jupyter nbconvert --to notebook --execute user_guide.ipynb
- name: Run fundamental diagram notebook
run: |
jupyter nbconvert --to notebook --execute fundamental_diagram.ipynb
publish:
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags')}}
needs: [ build, test ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.10' ]
runs-on: ${{ matrix.os }}
steps:
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish package to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}