-
Notifications
You must be signed in to change notification settings - Fork 98
155 lines (131 loc) · 4.65 KB
/
release.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
# Workflow to build and test wheels
# =================================
# This github action gets triggered whenever there is a push to the master branch or a release is created.
# It generates both wheels and distributions files, making sure their contents are correct via unit-testing.
#
# Please note that creating a git tag and pushing it (git tag <>; git push --tags) is not
# sufficient to append the wheels and distribution files to your release.
# You need to generate a new release using github, not git.
#
# Guides
# ------
# cibuildwheel docs:
# * https://cibuildwheel.readthedocs.io/en/stable/options/
# github actions:
# * https://docs.github.com/en/actions
name: Wheel builder
on:
# Manual trigger on github
workflow_dispatch:
inputs:
deploy:
description: "Deploy to PyPI"
required: false
type: boolean
# Bushj
push:
branches:
- master
# Release branches
- "[0-9]+.[0-9]+.X"
env:
package-name: GraKeL
test-cmd: pytest
extra-requires: "wheel"
sdist-version: "3.7"
jobs:
build_wheels:
name: Wheels ${{ matrix.os }}-${{ matrix.py }}
runs-on: ${{ matrix.os }}
# Parellilize as much as possible across github action workers
strategy:
# 1 runner per combination of (os, py)
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
py: ["cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*"] #, "cp312-*"] not yet supported
# All workers independent, don't cancel all if one fails
fail-fast: false
steps:
- uses: actions/checkout@v3
# Let's us build aarch64 on linux
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
# https://cibuildwheel.readthedocs.io/en/1.x/options
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD_FRONTEND: "build"
CIBW_BUILD: ${{ matrix.py }}
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_ARCHS_LINUX: x86_64 aarch64
# No win32 ("x86") for Windows as scipy declared it has stopped releasing wheels
# from 1.8.0 onwards, officially from 1.9.3
CIBW_ARCHS_WINDOWS: AMD64
# Install test requirements and run the test-cmd
CIBW_TEST_EXTRAS: ${{ env.extra-requires }}
# {project} is a special string recognized by CIBW and replaced with the project dir
CIBW_TEST_COMMAND: ${{ env.test-cmd }} {project}
# * Scipy has no wheels released for musllinux and will not build because OpenBLAS is not found
CIBW_SKIP: "*-musllinux*"
# https://cibuildwheel.readthedocs.io/en/stable/options/#test-skip
# * Will avoid testing on emulated architectures (aarch64)
# * Skip trying to test arm64 builds on Intel Macs
CIBW_TEST_SKIP: "*-*linux_aarch64 *-macosx_universal2:arm64 "
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: sdist
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ env.package-name }}
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.sdist-version }}
- name: Build source distribution
run: |
python -m pip install --upgrade pip setuptools wheel build
python -m build -s
echo "sdist_name=$(ls -t dist/${{ env.package-name }}-*.tar.gz | head -n 1)" >> $GITHUB_ENV
- name: Twine check ${{ env.package-name }}
run: |
python -m pip install twine
twine_output=`twine check ${{ env.sdist_name }}`
twine check ${{env.sdist_name}} --strict
- name: Install dist
run: |
python -m pip install ${{ env.sdist_name }}[${{ env.extra-requires }}]
- name: Tests
run: |
${{ env.test-cmd }}
- name: Store artifacts
uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
release_assets:
# Only when manually specified
if: ${{ inputs.deploy }}
name: Upload Release
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: dist
- name: Display structure of downloaded files
run: |
ls -R
mv dist/artifact/* dist/
rm -rf dist/artifact
ls -R
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/