1
- name : Build and release
1
+ name : Build and Release
2
+
2
3
on :
3
4
push :
4
5
branches :
@@ -12,46 +13,206 @@ defaults:
12
13
run :
13
14
shell : bash
14
15
16
+ env :
17
+ PACKAGE_NAME : labscript-utils
18
+ SCM_VERSION_SCHEME : release-branch-semver
19
+ SCM_LOCAL_SCHEME : no-local-version
20
+ ANACONDA_USER : labscript-suite
21
+
22
+ # Configuration for a package with compiled extensions:
23
+ # PURE: false
24
+ # NOARCH: false
25
+
26
+ # Configuration for a package with no extensions, but with dependencies that differ by
27
+ # platform or Python version:
28
+ # PURE: true
29
+ # NOARCH: false
30
+
31
+ # Configuration for a package with no extensions and the same dependencies on all
32
+ # platforms and Python versions. For this configuration you should comment out all but
33
+ # the first entry in the job matrix of the build job since multiple platforms are not
34
+ # needed.
35
+ PURE : true
36
+ NOARCH : true
37
+
15
38
jobs :
16
39
build :
17
- name : Build and Release
18
- runs-on : ubuntu-latest
19
- env :
20
- PACKAGE_NAME : labscript-utils
21
- SCM_VERSION_SCHEME : release-branch-semver
22
- SCM_LOCAL_SCHEME : no-local-version
40
+ name : Build
41
+ runs-on : ${{ matrix.os }}
42
+ strategy :
43
+ matrix :
44
+ include :
45
+ - { os: ubuntu-latest, python: 3.8, arch: x64 }
46
+ # - { os: ubuntu-latest, python: 3.7, arch: x64 }
47
+ # - { os: ubuntu-latest, python: 3.6, arch: x64 }
48
+
49
+ # - { os: macos-latest, python: 3.8, arch: x64 }
50
+ # - { os: macos-latest, python: 3.7, arch: x64 }
51
+ # - { os: macos-latest, python: 3.6, arch: x64 }
52
+
53
+ # - { os: windows-latest, python: 3.8, arch: x64 }
54
+ # - { os: windows-latest, python: 3.7, arch: x64 }
55
+ # - { os: windows-latest, python: 3.6, arch: x64 }
56
+
57
+ # - { os: windows-latest, python: 3.8, arch: x86 }
58
+ # - { os: windows-latest, python: 3.7, arch: x86 }
59
+ # - { os: windows-latest, python: 3.6, arch: x86 }
60
+
23
61
if : github.repository == 'labscript-suite/labscript-utils' && (github.event_name != 'create' || github.event.ref_type != 'branch')
24
62
steps :
25
63
- name : Checkout
26
64
uses : actions/checkout@v2
27
- - name : Unshallow
65
+ with :
66
+ fetch-depth : 0
67
+
68
+ - name : Ignore Tags
28
69
if : github.event.ref_type != 'tag'
29
- run : |
30
- git fetch --prune --unshallow
31
- git tag -d $(git tag --points-at HEAD)
70
+ run : git tag -d $(git tag --points-at HEAD)
71
+
32
72
- name : Install Python
33
73
uses : actions/setup-python@v2
34
74
with :
35
- python-version : 3.8
36
- - name : Build Distributions
75
+ python-version : ${{ matrix.python }}
76
+ architecture : ${{ matrix.arch }}
77
+
78
+ - name : Source Distribution
79
+ if : strategy.job-index == 0
37
80
run : |
38
- python -m pip install --upgrade pip setuptools wheel
39
- pip install -U git+https://github.com/pypa/setuptools_scm.git@8e6aa2b5fd42cb257c86e6dbe720eaee6d1e2c9b
40
- python setup.py sdist bdist_wheel
41
- SCM_VERSION=$(python setup.py --version)
42
- echo "::set-env name=SCM_VERSION::$SCM_VERSION"
81
+ python -m pip install --upgrade pip setuptools wheel pep517
82
+ python -m pep517.build -s .
83
+
84
+ - name : Wheel Distribution
85
+ # Impure Linux wheels are built in the manylinux job.
86
+ if : (env.PURE == 'true' && strategy.job-index == 0) || (env.PURE == 'false' && runner.os != 'Linux')
87
+ run : |
88
+ python -m pip install --upgrade pip setuptools wheel pep517
89
+ python -m pep517.build -b .
90
+
91
+ - name : Upload Artifact
92
+ if : strategy.job-index == 0 || (env.PURE == 'false' && runner.os != 'Linux')
93
+ uses : actions/upload-artifact@v2
94
+ with :
95
+ name : dist
96
+ path : ./dist
97
+
98
+ - name : Set Variables for Conda Build
99
+ run : |
100
+ if [ $RUNNER_OS == Windows ] && [ ${{ matrix.arch }} == x64 ]; then
101
+ CONDA_INSTALLER=Miniconda3-latest-Windows-x86_64.exe
102
+ elif [ $RUNNER_OS == Windows ]; then
103
+ CONDA_INSTALLER=Miniconda3-latest-Windows-x86.exe
104
+ elif [ $RUNNER_OS == Linux ]; then
105
+ CONDA_INSTALLER=Miniconda3-latest-Linux-x86_64.sh
106
+ else
107
+ CONDA_INSTALLER=Miniconda3-latest-MacOSX-x86_64.sh
108
+ fi
109
+ if [ $NOARCH == true ]; then
110
+ CONDA_BUILD_ARGS="--noarch"
111
+ else
112
+ CONDA_BUILD_ARGS=""
113
+ fi
114
+ echo "::set-env name=CONDA_INSTALLER::$CONDA_INSTALLER"
115
+ echo "::set-env name=CONDA_BUILD_ARGS::$CONDA_BUILD_ARGS"
116
+
117
+ - name : Conda package (Unix)
118
+ if : runner.os != 'Windows'
119
+ run : |
120
+ curl -LO https://repo.continuum.io/miniconda/$CONDA_INSTALLER
121
+ bash "$CONDA_INSTALLER" -b -p .miniconda
122
+ source .miniconda/etc/profile.d/conda.sh
123
+ conda activate
124
+ conda update -n base -c defaults conda
125
+ conda create -n py${{ matrix.python }} python=${{ matrix.python }}
126
+ conda activate py${{ matrix.python }}
127
+ conda install -c cbillington setuptools-conda
128
+ pip install --upgrade setuptools_scm
129
+ setuptools-conda build $CONDA_BUILD_ARGS .
130
+
131
+ - name : Conda Package (Windows)
132
+ if : runner.os == 'Windows'
133
+ shell : cmd
134
+ run : |
135
+ curl -LO https://repo.continuum.io/miniconda/%CONDA_INSTALLER%
136
+ %CONDA_INSTALLER% /S /D=%CD%\.miniconda && ^
137
+ .miniconda\Scripts\activate && ^
138
+ conda update -n base -c defaults conda && ^
139
+ conda create -n py${{ matrix.python }} python=${{ matrix.python }} && ^
140
+ conda activate py${{ matrix.python }} && ^
141
+ conda install -c cbillington setuptools-conda && ^
142
+ pip install --upgrade setuptools_scm && ^
143
+ setuptools-conda build %CONDA_BUILD_ARGS% .
144
+
145
+ - name : Upload Artifact
146
+ uses : actions/upload-artifact@v2
147
+ with :
148
+ name : conda_packages
149
+ path : ./conda_packages
150
+
151
+
152
+ manylinux :
153
+ name : Build Manylinux
154
+ runs-on : ubuntu-latest
155
+ strategy :
156
+ matrix :
157
+ include :
158
+ - { python: 'cp36-cp36m cp37-cp37m cp38-cp38' }
159
+
160
+ if : github.repository == 'labscript-suite/labscript-utils' && (github.event_name != 'create' || github.event.ref_type != 'branch')
161
+ steps :
162
+ - name : Checkout
163
+ if : env.PURE == 'false'
164
+ uses : actions/checkout@v2
165
+ with :
166
+ fetch-depth : 0
167
+
168
+ - name : Ignore Tags
169
+ if : github.event.ref_type != 'tag' && env.PURE == 'false'
170
+ run : git tag -d $(git tag --points-at HEAD)
171
+
172
+ - name : Build Manylinux Wheels
173
+ if : env.PURE == 'false'
174
+ uses : RalfG/python-wheels-manylinux-build@v0.2.2-manylinux2010_x86_64
175
+ with :
176
+ python-versions : ${{ matrix.python }}
177
+
178
+ - name : Upload Artifact
179
+ if : env.PURE == 'false'
180
+ uses : actions/upload-artifact@v2
181
+ with :
182
+ name : dist
183
+ path : wheelhouse/*manylinux*.whl
184
+
185
+ release :
186
+ name : Release
187
+ runs-on : ubuntu-latest
188
+ needs : [build, manylinux]
189
+ steps :
190
+
191
+ - name : Download Artifact
192
+ uses : actions/download-artifact@v2
193
+ with :
194
+ name : dist
195
+ path : ./dist
196
+
197
+ - name : Download Artifact
198
+ uses : actions/download-artifact@v2
199
+ with :
200
+ name : conda_packages
201
+ path : ./conda_packages
202
+
43
203
- name : Publish on TestPyPI
44
- if : github.event.ref_type == 'tag' || contains(env.SCM_VERSION, 'dev')
45
204
uses : pypa/gh-action-pypi-publish@master
46
205
with :
47
206
user : __token__
48
207
password : ${{ secrets.testpypi }}
49
208
repository_url : https://test.pypi.org/legacy/
209
+
50
210
- name : Get Version Number
51
211
if : github.event.ref_type == 'tag'
52
212
run : |
53
213
VERSION="${GITHUB_REF/refs\/tags\/v/}"
54
214
echo "::set-env name=VERSION::$VERSION"
215
+
55
216
- name : Create GitHub Release
56
217
if : github.event.ref_type == 'tag'
57
218
id : create_release
63
224
release_name : ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
64
225
draft : true
65
226
prerelease : ${{ contains(github.event.ref, 'rc') }}
227
+
66
228
- name : Upload Release Asset
67
229
if : github.event.ref_type == 'tag'
68
230
uses : actions/upload-release-asset@v1
@@ -73,9 +235,41 @@ jobs:
73
235
asset_path : ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
74
236
asset_name : ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
75
237
asset_content_type : application/gzip
238
+
76
239
- name : Publish on PyPI
77
240
if : github.event.ref_type == 'tag'
78
241
uses : pypa/gh-action-pypi-publish@master
79
242
with :
80
243
user : __token__
81
244
password : ${{ secrets.pypi }}
245
+
246
+ - name : Install Miniconda and cloud client
247
+ run : |
248
+ curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
249
+ bash Miniconda3-latest-Linux-x86_64.sh -b -p .miniconda
250
+ source .miniconda/etc/profile.d/conda.sh
251
+ conda activate
252
+ conda install anaconda-client
253
+
254
+ - name : Publish to Anaconda test label
255
+ if : github.event.ref_type != 'tag'
256
+ run : |
257
+ source .miniconda/etc/profile.d/conda.sh
258
+ conda activate
259
+ anaconda \
260
+ --token ${{ secrets.ANACONDA_API_TOKEN }} \
261
+ upload \
262
+ --user $ANACONDA_USER \
263
+ --label test \
264
+ conda_packages/*/*
265
+
266
+ - name : Publish to Anaconda main label
267
+ if : github.event.ref_type == 'tag'
268
+ run : |
269
+ source .miniconda/etc/profile.d/conda.sh
270
+ conda activate
271
+ anaconda \
272
+ --token ${{ secrets.ANACONDA_API_TOKEN }} \
273
+ upload \
274
+ --user $ANACONDA_USER \
275
+ conda_packages/*/*
0 commit comments