-
Notifications
You must be signed in to change notification settings - Fork 59
210 lines (203 loc) · 5.58 KB
/
python-package.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Builds wheels and libraries used to run tests, uploads them, then runs the standard tests.
name: Python Package
on:
push:
branches:
- "*"
tags:
- "*.*.*"
pull_request:
defaults:
run:
shell: bash
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install MyPy
run: |
pip install mypy
- name: Install Delocate dependencies.
run: |
pip install --requirement test-requirements.txt
pip install --editable .
- name: MyPy
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: mypy
run: mypy --show-column-numbers delocate/
tests:
needs: [pre-commit, mypy]
runs-on: macos-12
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.0"
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Build libs and wheels
# Use a venv from multibuild for this step.
run: |
source multibuild/osx_utils.sh
get_macpython_environment $MB_PYTHON_VERSION venv
make
env:
MB_PYTHON_VERSION: "3.9"
MB_PYTHON_OSX_VER: "10.9"
SOURCE_DATE_EPOCH: "0"
PYTHONHASHSEED: "0"
- name: Upload test data
uses: actions/upload-artifact@v4
with:
name: delocate-tests-data
path: |
delocate/tests/data/
retention-days: 3
if-no-files-found: error
- name: Install test dependencies
run: |
pip install -r test-requirements.txt build
- name: Build delocate
run: |
python -m build
- name: Install delocate
run: |
pip install -e .
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: delocate-wheel
path: dist/delocate-*.whl
retention-days: 3
if-no-files-found: error
compression-level: 0
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: delocate-sdist
path: dist/delocate-*.tar.gz
retention-days: 3
if-no-files-found: error
compression-level: 0
- name: Upload requirements
uses: actions/upload-artifact@v4
with:
name: test-requirements
path: test-requirements.txt
retention-days: 3
if-no-files-found: error
- name: Run tests
run: |
pytest
- name: Collect code coverage data
run: |
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
token: "624762bf-aaf0-4a75-b450-16f5ebece0b1"
- name: Check reproducable test data
run: |
git status
git diff
isolated_tests:
needs: tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: "macos-12"
xcode: "14.0"
python: "3.x"
- os: "macos-13"
xcode: "14.2"
python: "3.x"
- os: "ubuntu-latest"
python: "3.7"
- os: "ubuntu-latest"
python: "3.8"
- os: "ubuntu-latest"
python: "3.9"
- os: "ubuntu-latest"
python: "3.10"
- os: "ubuntu-latest"
python: "3.11"
- os: "ubuntu-latest"
python: "3.12"
- os: "ubuntu-latest"
python: "3.13-dev"
- os: "windows-latest"
python: "3.x"
steps:
- if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- if: runner.os == 'macOS'
name: Check otool version
run: otool --version
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: delocate-wheel
- name: Install delocate
run: |
pip install delocate-*.whl
- name: Download requirements
uses: actions/download-artifact@v4
with:
name: test-requirements
- name: Install test dependencies
run: |
pip install -r test-requirements.txt
- name: Run isolated tests
run: |
pytest --pyargs delocate --log-level DEBUG --doctest-modules
deploy:
needs: isolated_tests
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment:
name: deploy
url: https://pypi.org/project/delocate/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install deployment dependencies
run: pip install twine
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: delocate-wheel
path: dist/
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: delocate-sdist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true