-
Notifications
You must be signed in to change notification settings - Fork 18
172 lines (166 loc) · 4.89 KB
/
run_pytests.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
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
name: paquo ci
on:
push:
branches:
- main
tags: v[0-9]+.[0-9]+.[0-9]+
pull_request: {}
env:
QUPATH_VERSION: 0.5.0
jobs:
# RUN PYTEST ON PAQUO SOURCE
tests:
name: pytest ${{ matrix.os }}::py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 8
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.12"]
include:
# we'll test the python support on ubuntu
- os: ubuntu-latest
python-version: '3.11'
- os: ubuntu-latest
python-version: '3.12'
- os: ubuntu-latest
python-version: '3.9'
- os: ubuntu-latest
python-version: '3.8'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install paquo
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Restore qupath cache
uses: actions/cache@v3
env:
CACHE_NUMBER: 0
with:
path: ./qupath/download
key: ${{ runner.os }}-qupath-v${{ env.CACHE_NUMBER }}
- name: Install qupath and set PAQUO_QUPATH_DIR
shell: bash
run: |
python -c "import os; os.makedirs('qupath/download', exist_ok=True)"
python -c "import os; os.makedirs('qupath/apps', exist_ok=True)"
python -m paquo get_qupath --install-path ./qupath/apps --download-path ./qupath/download ${{ env.QUPATH_VERSION }} | grep -v "^#" | sed "s/^/PAQUO_QUPATH_DIR=/" >> $GITHUB_ENV
- name: Test with pytest
run: |
pytest --cov=./paquo --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: paquo
# RUN MYPY STATIC TYPE ANALYSIS ON PAQUO SOURCE
typing:
name: mypy type analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
pip install ome_types || true
- name: Run mypy
run: |
mypy paquo
# DEPLOY PAQUO TO TEST.PYPI ON SUCCESS
testdeploy:
needs: [tests, typing]
name: deploy to test.pypi
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install pep517
run: >-
python -m
pip install
pep517
--user
# we'll have to remove local_scheme for pushes to test.pypi pep440
- name: Get version without local_scheme
id: non_local_version
run: |
python setup.py --version | awk -F+ '{print "::set-output name=version::"$1}'
- name: Build a binary wheel and a source tarball
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.non_local_version.outputs.version }}
run: >-
python -m
pep517.build
--source
--binary
--out-dir dist/
.
# push all versions on master to test.pypi.org
- name: Publish package to TestPyPI
continue-on-error: true
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
# DEPLOY PAQUO TO PYPI ON SUCCESS
deploy:
needs: [tests, typing]
name: deploy to pypi
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install pep517
run: >-
python -m
pip install
pep517
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
pep517.build
--source
--binary
--out-dir dist/
.
# push all tagged versions to pypi.org
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}