-
Notifications
You must be signed in to change notification settings - Fork 117
151 lines (141 loc) · 3.97 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
name: Build
on:
push:
# pull_request:
# branches:
# - master
release:
types:
- created
# schedule:
# - cron: "0 7 * * 1"
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
test:
runs-on: ubuntu-latest
# Runs can be slow, so don't use resources unless we mean to publish
if: github.repository == 'DigitalSlideArchive/HistomicsTK' && ( startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' )
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: |
pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tox
env:
PYTEST_ADDOPTS: "--durations=0 -vv"
run: |
tox
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: nikeee/setup-pandoc@v1
- name: Install tox
run: |
pip install --upgrade pip
pip install tox
- name: Run tox for lint and docs
run: |
tox -e lint,docs
- uses: actions/upload-artifact@v4
with:
name: docs
path: ./docs/_build
build_wheels:
name: Wheels for ${{ matrix.python }} / ${{ matrix.buildplat[0] }} / ${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
# Don't build external PRs.
if: github.repository == 'DigitalSlideArchive/HistomicsTK'
strategy:
matrix:
# See matplotlib for some of the rationale of this
buildplat:
- [ubuntu-latest, "x86_64 aarch64"]
- [macos-latest, "x86_64 arm64"]
- [windows-latest, auto64]
python: ["cp38", "cp39", "cp310", "cp311", "cp312", "cp313"]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git status && git tag --list && pwd
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python }}-*
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_ARCHS: ${{ matrix.buildplat[1] }}
MACOSX_DEPLOYMENT_TARGET: "10.12"
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*.tar.gz
# Still on Circle-CI
# - docker
# - publish-docker
# - docs-deploy
test-release:
runs-on: ubuntu-latest
needs:
- lint
- build_wheels
- make_sdist
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: dist-*
merge-multiple: true
- name: List dist directory
run: ls dist
release:
runs-on: ubuntu-latest
needs:
- test
- lint
- build_wheels
- make_sdist
if: github.repository == 'DigitalSlideArchive/HistomicsTK' && ( startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' )
environment:
name: pypi
url: https://pypi.org/p/histomicstk
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: dist-*
merge-multiple: true
- name: List dist directory
run: ls dist
- uses: pypa/gh-action-pypi-publish@release/v1