-
Notifications
You must be signed in to change notification settings - Fork 12
130 lines (125 loc) · 3.91 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
name: tiffslide ci
on:
push:
branches:
- main
tags:
- v*.*.*
pull_request: {}
jobs:
# RUN PYTEST ON TIFFSLIDE SOURCE
tests:
name: pytest ${{ matrix.os }}::py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 5
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.10"
- os: ubuntu-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "3.8"
steps:
- name: Checkout TiffSlide
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install TiffSlide
run: python -m pip install -e .[dev]
- name: Cache tiffslide/tests/data
uses: actions/cache@v3
with:
path: tiffslide/tests/data
key: downloaded-slides
- name: Run Tests
run: pytest --cov=./tiffslide tiffslide
# RUN MYPY STATIC TYPE ANALYSIS ON TIFFSLIDE SOURCE
typing:
name: mypy type analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Run mypy
run: |
mypy --install-types --non-interactive --python-version=3.8 tiffslide
# DEPLOY TIFFSLIDE 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
python -m pip install wheel "setuptools_scm>=6.2" build
# 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 -m setuptools_scm | 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 build .
# push all versions on master to test.pypi.org
- name: Publish package to TestPyPI
continue-on-error: true
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
# DEPLOY TIFFSLIDE 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
python -m pip install build
- name: Build a binary wheel and a source tarball
run: |
python -m build .
# push all tagged versions to pypi.org
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}