-
Notifications
You must be signed in to change notification settings - Fork 5
122 lines (105 loc) · 3.28 KB
/
test_and_deploy.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
# Based on the workflow from https://github.com/biotite-dev/biotite/
# contributed by Daniel Farrell (danpf) and published under the same license
name: "CI & CD"
on:
workflow_dispatch:
pull_request:
release:
types:
- published
env:
CIBW_BUILD: cp39-* cp310-* cp311-*
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_WINDOWS: "x86 AMD64"
# Skip musllinux because it takes too long to compile on GHA
# since it is emulated. (6+ hours)
# *note* most of the build time is actually numpy for musllinux
CIBW_SKIP: "*musllinux* *-manylinux_i686 *-musllinux_i686 *-win32 pp*"
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: pytest {project} --durations=50
CIBW_DEPENDENCY_VERSIONS: "pinned"
# Runtime too long due to architecture emulation
CIBW_TEST_SKIP: "*-macosx_arm64"
jobs:
test-and-build:
name: "Build & Test"
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build & (optionally) test wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v3
with:
name: dist
path: ./wheelhouse/*.whl
if-no-files-found: error
make-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Build source distribution
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.gz
if-no-files-found: error
make-doc:
name: Build documentation
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: hydride
auto-update-conda: true
python-version: '3.11'
- name: Installing dependencies
run: conda install -c conda-forge sphinx cython numpy numpydoc biotite
- name: Building documentation
run: sphinx-build ./doc ./build/doc
- name: Zipping documentation
run: cd .//build; zip -r doc.zip doc; cd ..
- uses: actions/upload-artifact@v3
with:
name: doc
path: build//doc.zip
if-no-files-found: error
upload:
name: Upload to GitHub Releases & PyPI
permissions:
contents: write
needs: [test-and-build, make-sdist, make-doc]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: List distributions to be uploaded
run: ls dist
- name: Upload to GitHub Releases
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
if: github.event_name == 'release' && github.event.action == 'published'
with:
files: |
dist//*
doc//*
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc
if: github.event_name == 'release' && github.event.action == 'published'
with:
password: ${{ secrets.PYPI_TOKEN }}