forked from labscript-suite/runviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
279 lines (242 loc) · 9.14 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Build and Release
on:
push:
branches:
- master
- maintenance/*
create:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
defaults:
run:
shell: bash
env:
PACKAGE_NAME: runviewer
SCM_VERSION_SCHEME: release-branch-semver
SCM_LOCAL_SCHEME: no-local-version
ANACONDA_USER: labscript-suite
# Configuration for a package with compiled extensions:
# PURE: false
# NOARCH: false
# Configuration for a package with no extensions, but with dependencies that differ by
# platform or Python version:
# PURE: true
# NOARCH: false
# Configuration for a package with no extensions and the same dependencies on all
# platforms and Python versions. For this configuration you should comment out all but
# the first entry in the job matrix of the build job since multiple platforms are not
# needed.
PURE: true
NOARCH: true
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- { os: ubuntu-latest, python: 3.8, arch: x64 }
#- { os: ubuntu-latest, python: 3.9, arch: x64 }
#- { os: ubuntu-latest, python: 3.7, arch: x64 }
#- { os: ubuntu-latest, python: 3.6, arch: x64 }
#- { os: macos-latest, python: 3.9, arch: x64 }
#- { os: macos-latest, python: 3.8, arch: x64 }
#- { os: macos-latest, python: 3.7, arch: x64 }
#- { os: macos-latest, python: 3.6, arch: x64 }
#- { os: windows-latest, python: 3.9, arch: x64 }
#- { os: windows-latest, python: 3.8, arch: x64 }
#- { os: windows-latest, python: 3.7, arch: x64 }
#- { os: windows-latest, python: 3.6, arch: x64 }
#- { os: windows-latest, python: 3.9, arch: x86 }
#- { os: windows-latest, python: 3.8, arch: x86 }
#- { os: windows-latest, python: 3.7, arch: x86 }
#- { os: windows-latest, python: 3.6, arch: x86 }
if: github.repository == 'labscript-suite/runviewer' && (github.event_name != 'create' || github.event.ref_type != 'branch')
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Ignore Tags
if: github.event.ref_type != 'tag'
run: git tag -d $(git tag --points-at HEAD)
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
- name: Source Distribution
if: strategy.job-index == 0
run: |
python -m pip install --upgrade pip setuptools wheel pep517
python -m pep517.build -s .
- name: Wheel Distribution
# Impure Linux wheels are built in the manylinux job.
if: (env.PURE == 'true' && strategy.job-index == 0) || (env.PURE == 'false' && runner.os != 'Linux')
run: |
python -m pip install --upgrade pip setuptools wheel pep517
python -m pep517.build -b .
- name: Upload Artifact
if: strategy.job-index == 0 || (env.PURE == 'false' && runner.os != 'Linux')
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist
- name: Set Variables for Conda Build
run: |
if [ $RUNNER_OS == Windows ] && [ ${{ matrix.arch }} == x64 ]; then
CONDA_INSTALLER=Miniconda3-latest-Windows-x86_64.exe
elif [ $RUNNER_OS == Windows ]; then
CONDA_INSTALLER=Miniconda3-latest-Windows-x86.exe
elif [ $RUNNER_OS == Linux ]; then
CONDA_INSTALLER=Miniconda3-latest-Linux-x86_64.sh
else
CONDA_INSTALLER=Miniconda3-latest-MacOSX-x86_64.sh
fi
if [ $NOARCH == true ]; then
CONDA_BUILD_ARGS="--noarch"
else
CONDA_BUILD_ARGS=""
fi
echo "CONDA_INSTALLER=$CONDA_INSTALLER" >> $GITHUB_ENV
echo "CONDA_BUILD_ARGS=$CONDA_BUILD_ARGS" >> $GITHUB_ENV
- name: Conda package (Unix)
if: runner.os != 'Windows'
run: |
curl -LO https://repo.continuum.io/miniconda/$CONDA_INSTALLER
bash "$CONDA_INSTALLER" -b -p .miniconda
source .miniconda/etc/profile.d/conda.sh
conda activate
conda update -n base -c defaults conda
conda create -n py${{ matrix.python }} python=${{ matrix.python }}
conda activate py${{ matrix.python }}
conda install -c cbillington setuptools-conda
pip install --upgrade setuptools_scm
setuptools-conda build $CONDA_BUILD_ARGS .
- name: Conda Package (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
curl -LO https://repo.continuum.io/miniconda/%CONDA_INSTALLER%
%CONDA_INSTALLER% /S /D=%CD%\.miniconda && ^
.miniconda\Scripts\activate && ^
conda update -n base -c defaults conda && ^
conda create -n py${{ matrix.python }} python=${{ matrix.python }} && ^
conda activate py${{ matrix.python }} && ^
conda install -c cbillington setuptools-conda && ^
pip install --upgrade setuptools_scm && ^
setuptools-conda build %CONDA_BUILD_ARGS% .
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: conda_packages
path: ./conda_packages
manylinux:
name: Build Manylinux
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { python: 'cp36-cp36m cp37-cp37m cp38-cp38' }
if: github.repository == 'labscript-suite/runviewer' && (github.event_name != 'create' || github.event.ref_type != 'branch')
steps:
- name: Checkout
if: env.PURE == 'false'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Ignore Tags
if: github.event.ref_type != 'tag' && env.PURE == 'false'
run: git tag -d $(git tag --points-at HEAD)
- name: Build Manylinux Wheels
if: env.PURE == 'false'
uses: RalfG/python-wheels-manylinux-build@v0.2.2-manylinux2010_x86_64
with:
python-versions: ${{ matrix.python }}
- name: Upload Artifact
if: env.PURE == 'false'
uses: actions/upload-artifact@v2
with:
name: dist
path: wheelhouse/*manylinux*.whl
release:
name: Release
runs-on: ubuntu-latest
needs: [build, manylinux]
steps:
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: dist
path: ./dist
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: conda_packages
path: ./conda_packages
- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.testpypi }}
repository_url: https://test.pypi.org/legacy/
- name: Get Version Number
if: github.event.ref_type == 'tag'
run: |
VERSION="${GITHUB_REF/refs\/tags\/v/}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create GitHub Release
if: github.event.ref_type == 'tag'
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.ref }}
release_name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
draft: true
prerelease: ${{ contains(github.event.ref, 'rc') }}
- name: Upload Release Asset
if: github.event.ref_type == 'tag'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip
- name: Publish on PyPI
if: github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi }}
- name: Install Miniconda and cloud client
run: |
curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p .miniconda
source .miniconda/etc/profile.d/conda.sh
conda activate
conda install anaconda-client
- name: Publish to Anaconda test label
if: github.event.ref_type != 'tag'
run: |
source .miniconda/etc/profile.d/conda.sh
conda activate
anaconda \
--token ${{ secrets.ANACONDA_API_TOKEN }} \
upload \
--user $ANACONDA_USER \
--label test \
conda_packages/*/*
- name: Publish to Anaconda main label
if: github.event.ref_type == 'tag'
run: |
source .miniconda/etc/profile.d/conda.sh
conda activate
anaconda \
--token ${{ secrets.ANACONDA_API_TOKEN }} \
upload \
--user $ANACONDA_USER \
conda_packages/*/*