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