forked from hyperspy/hyperspy
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (126 loc) · 4.17 KB
/
release.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
name: Release
# This workflow builds the wheels "on tag".
# If run from the hyperspy/hyperspy repository, the wheels will be uploaded to pypi ;
# otherwise, the wheels will be available as a github artifact.
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
create_release:
permissions:
contents: write
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
build_wheels:
name: Wheels on ${{ matrix.os }}/py${{ matrix.python-version }}
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: ${{ matrix.python-version }}
- name: What OS and Python version
run: |
uname -a
python --version
which python
- name: install build and twine
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build wheels
run: |
python -m build
- name: Display content dist folder
run: |
ls dist/
- name: Install and test distribution
env:
MPLBACKEND: agg
run: |
pip install --pre --find-links dist hyperspy[tests]
pytest --pyargs hyperspy
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl
- name: Publish wheels to PyPI
if: github.repository_owner == 'hyperspy'
env:
# Github secret set in the hyperspy/hyperspy repository
# Not available from fork or pull request
# Secrets are not passed to workflows that are triggered by a pull request from a fork
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*.whl --verbose
build_wheels_linux:
name: Wheels on ubuntu-latest
needs: create_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: install twine
run: |
python -m pip install twine
- name: Build source distribution
run: |
pip install build
python -m build --sdist
- name: Build manylinux Python wheels
uses: RalfG/[email protected]
with:
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
build-requirements: 'cython'
- name: Display content dist folder
run: |
ls dist/
- name: Install and test distribution
env:
MPLBACKEND: agg
run: |
pip install --pre --find-links dist hyperspy[tests]
pytest --pyargs hyperspy
- uses: actions/upload-artifact@v3
with:
path: |
./dist/*-manylinux*.whl
./sdist/*.tar.gz
- name: Publish wheels to PyPI
if: github.repository_owner == 'hyperspy'
env:
# Github secret set in the hyperspy/hyperspy repository
# Not available from fork or pull request
# Secrets are not passed to workflows that are triggered by a pull request from a fork
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*-manylinux*.whl --verbose
twine upload dist/*.tar.gz --verbose