Skip to content

Commit 2c453d3

Browse files
committed
Move release logic from YAML to shell scripts
This is a bit more portable ;) Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 73a1452 commit 2c453d3

10 files changed

+313
-579
lines changed

.github/workflows/scancode-release.yml

Lines changed: 20 additions & 229 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
defaults:
2727
run:
2828
shell: bash
29+
2930
strategy:
3031
fail-fast: true
3132

@@ -37,85 +38,32 @@ jobs:
3738
with:
3839
python-version: 3.8
3940

40-
- name: Install requirements and prepare index
41-
run: |
42-
./configure --dev
43-
./scancode --reindex-licenses
44-
45-
- name: Build main wheel
46-
run: |
47-
venv/bin/python setup.py --quiet bdist_wheel
48-
venv/bin/twine check dist/*
41+
- name: Install requirements then build main and mini wheel and sdist
42+
run: etc/release/scancode-create-pypi-dist.sh
4943

5044
- name: Collect built main wheel
5145
uses: actions/upload-artifact@v3
5246
with:
5347
name: main_wheel
54-
path: dist/*
55-
56-
- name: Build main sdist
57-
run: |
58-
rm -rf dist
59-
venv/bin/python setup.py --quiet sdist
60-
venv/bin/twine check dist/*
48+
path: dist/scancode_toolkit-3*.whl
6149

6250
- name: Collect built main sdist
6351
uses: actions/upload-artifact@v3
6452
with:
6553
name: main_sdist
66-
path: dist/*
67-
68-
69-
build_scancode_for_pypi_mini:
70-
name: Build PyPI archives mini
71-
runs-on: ubuntu-20.04
72-
73-
defaults:
74-
run:
75-
shell: bash
76-
strategy:
77-
fail-fast: true
78-
79-
steps:
80-
- uses: actions/checkout@v2
81-
82-
- name: Set up Python
83-
uses: actions/setup-python@v1
84-
with:
85-
python-version: 3.8
86-
87-
- name: Install requirements and prepare index
88-
run: |
89-
./configure --dev
90-
./scancode --reindex-licenses
91-
92-
- name: Build mini wheel
93-
run: |
94-
rm -rf build dist
95-
rm -rf .eggs src/scancode_toolkit.egg-info src/scancode_toolkit_mini.egg-info
96-
cp setup-mini.cfg setup.cfg
97-
venv/bin/python setup.py --quiet bdist_wheel
98-
venv/bin/twine check dist/*
54+
path: dist/scancode-toolkit-3*.tar.gz
9955

10056
- name: Collect built mini wheel
10157
uses: actions/upload-artifact@v3
10258
with:
10359
name: mini_wheel
104-
path: dist/*
105-
106-
- name: Build mini sdist
107-
run: |
108-
rm -rf build dist
109-
rm -rf .eggs src/scancode_toolkit.egg-info src/scancode_toolkit_mini.egg-info
110-
cp setup-mini.cfg setup.cfg
111-
venv/bin/python setup.py --quiet sdist
112-
venv/bin/twine check dist/*
60+
path: dist/scancode_toolkit_mini-3*.whl
11361

11462
- name: Collect built mini sdist
11563
uses: actions/upload-artifact@v3
11664
with:
11765
name: mini_sdist
118-
path: dist/*
66+
path: dist/scancode-toolkit-mini*.tar.gz
11967

12068

12169
build_scancode_for_release_linux:
@@ -145,58 +93,16 @@ jobs:
14593
name: main_wheel
14694
path: dist
14795

148-
- name: Install release requirements
149-
run: |
150-
./configure --rel
151-
15296
- name: Build linux app archive
15397
run: |
154-
operating_system=linux
155-
python_dot_version=3.8
156-
python_version=38
157-
python_exe="python$python_dot_version"
158-
release_dir=scancode-toolkit-$(git describe --tags)
159-
rm -rf $release_dir
160-
mkdir -p $release_dir
161-
echo -n "$python_exe" > $release_dir/PYTHON_EXECUTABLE
162-
git describe --tags > $release_dir/SCANCODE_VERSION
163-
thirdparty_dir=$release_dir/thirdparty
164-
mkdir -p $thirdparty_dir
165-
venv/bin/python etc/scripts/fetch_thirdparty.py \
166-
--requirements=requirements-linux.txt \
167-
--requirements=requirements.txt \
168-
--dest=$thirdparty_dir \
169-
--operating-system=$operating_system \
170-
--python-version=$python_version \
171-
--wheels --use-cached-index
172-
venv/bin/python etc/scripts/fetch_thirdparty.py \
173-
--requirements=requirements-native.txt \
174-
--requirements=requirements-linux.txt \
175-
--wheel-only packagedcode-msitools \
176-
--wheel-only rpm-inspector-rpm \
177-
--wheel-only extractcode-7z \
178-
--wheel-only extractcode-libarchive \
179-
--wheel-only typecode-libmagic \
180-
--dest=$thirdparty_dir \
181-
--sdists --use-cached-index
182-
mkdir -p $release_dir/etc
183-
cp -r etc/thirdparty $release_dir/etc
184-
cp -r \
185-
dist/scancode_*.whl \
186-
scancode extractcode configure \
187-
*.rst \
188-
samples \
189-
*NOTICE *LICENSE *ABOUT \
190-
$release_dir
191-
tarball=scancode-toolkit-$(git describe --tags)_py$python_dot_version-$operating_system.tar.gz
192-
tar -cvzf dist/$tarball $release_dir
193-
rm dist/scancode_*.whl
98+
./configure --rel
99+
etc/release/scancode-create-release-app-linux.sh
194100
195101
- name: Collect built linux app
196102
uses: actions/upload-artifact@v3
197103
with:
198104
name: linux_app
199-
path: dist/*
105+
path: release/*
200106

201107

202108
build_scancode_for_release_macos:
@@ -226,57 +132,16 @@ jobs:
226132
name: main_wheel
227133
path: dist
228134

229-
- name: Install release requirements
230-
run: |
231-
./configure --rel
232-
233135
- name: Build mac app archive
234136
run: |
235-
operating_system=macos
236-
python_dot_version=3.8
237-
python_version=38
238-
python_exe="python3"
239-
release_dir=scancode-toolkit-$(git describe --tags)
240-
rm -rf $release_dir
241-
mkdir -p $release_dir
242-
echo -n "$python_exe" > $release_dir/PYTHON_EXECUTABLE
243-
git describe --tags > $release_dir/SCANCODE_VERSION
244-
thirdparty_dir=$release_dir/thirdparty
245-
mkdir -p $thirdparty_dir
246-
venv/bin/python etc/scripts/fetch_thirdparty.py \
247-
--requirements=requirements.txt \
248-
--dest $thirdparty_dir \
249-
--operating-system=$operating_system \
250-
--python-version=$python_version \
251-
--wheels --use-cached-index
252-
venv/bin/python etc/scripts/fetch_thirdparty.py \
253-
--requirements=requirements-native.txt \
254-
--wheel-only extractcode \
255-
--wheel-only extractcode-7z \
256-
--wheel-only extractcode-libarchive \
257-
--wheel-only typecode-libmagic \
258-
--wheel-only packagedcode-msitools \
259-
--wheel-only rpm-inspector-rpm \
260-
--dest $thirdparty_dir \
261-
--sdists --use-cached-index
262-
mkdir -p $release_dir/etc
263-
cp -r etc/thirdparty $release_dir/etc
264-
cp -r \
265-
dist/scancode_*.whl \
266-
scancode extractcode configure \
267-
*.rst \
268-
samples \
269-
*NOTICE *LICENSE *ABOUT \
270-
$release_dir
271-
tarball=scancode-toolkit-$(git describe --tags)_py$python_dot_version-$operating_system.tar.gz
272-
tar -cvzf dist/$tarball $release_dir
273-
rm dist/scancode_*.whl
137+
./configure --rel
138+
etc/release/scancode-create-release-app-macos.sh
274139
275140
- name: Collect built mac app
276141
uses: actions/upload-artifact@v3
277142
with:
278143
name: macos_app
279-
path: dist/*
144+
path: release/*
280145

281146

282147
build_scancode_for_release_windows:
@@ -305,57 +170,16 @@ jobs:
305170
name: main_wheel
306171
path: dist
307172

308-
- name: Install release requirements
309-
run: |
310-
./configure --rel
311-
312173
- name: Build windows app archive
313174
run: |
314-
operating_system=windows
315-
python_dot_version=3.8
316-
python_version=38
317-
python_exe="py -$python_dot_version"
318-
release_dir=scancode-toolkit-$(git describe --tags)
319-
rm -rf $release_dir
320-
mkdir -p $release_dir
321-
echo -n "$python_exe" > $release_dir/PYTHON_EXECUTABLE
322-
git describe --tags > $release_dir/SCANCODE_VERSION
323-
thirdparty_dir=$release_dir/thirdparty
324-
mkdir -p $thirdparty_dir
325-
venv/bin/python etc/scripts/fetch_thirdparty.py \
326-
--requirements=requirements.txt \
327-
--dest $thirdparty_dir \
328-
--operating-system=$operating_system \
329-
--python-version=$python_version \
330-
--wheels --use-cached-index
331-
venv/bin/python etc/scripts/fetch_thirdparty.py \
332-
--requirements=requirements-native.txt \
333-
--wheel-only extractcode \
334-
--wheel-only extractcode-7z \
335-
--wheel-only extractcode-libarchive \
336-
--wheel-only typecode-libmagic \
337-
--wheel-only packagedcode-msitools \
338-
--wheel-only rpm-inspector-rpm \
339-
--dest $thirdparty_dir \
340-
--sdists --use-cached-index
341-
cp dist/scancode_*.whl $release_dir
342-
mkdir -p $release_dir/etc
343-
cp -r etc/thirdparty $release_dir/etc
344-
cp -r \
345-
scancode.bat extractcode.bat configure.bat \
346-
*.rst \
347-
samples \
348-
*NOTICE *LICENSE *ABOUT \
349-
$release_dir
350-
zipball=scancode-toolkit-$(git describe --tags)_py$python_dot_version-$operating_system.zip
351-
zip -r dist/$zipball $release_dir
352-
rm dist/scancode_*.whl
175+
./configure --rel
176+
etc/release/scancode-create-release-app-windows.sh
353177
354178
- name: Collect built windows app
355179
uses: actions/upload-artifact@v3
356180
with:
357181
name: windows_app
358-
path: dist/*
182+
path: release/*
359183

360184

361185
build_scancode_for_release_source:
@@ -384,49 +208,16 @@ jobs:
384208
name: main_sdist
385209
path: dist
386210

387-
- name: Install release requirements
388-
run: |
389-
./configure --rel
390-
391211
- name: Build source archive with deps
392212
run: |
393-
release_dir=scancode-toolkit-$(git describe --tags)
394-
rm -rf $release_dir
395-
mkdir -p $release_dir
396-
git describe --tags > $release_dir/SCANCODE_VERSION
397-
thirdparty_dir=$release_dir/thirdparty
398-
mkdir -p $thirdparty_dir
399-
venv/bin/python etc/scripts/fetch_thirdparty.py \
400-
--requirements=requirements.txt \
401-
--requirements=requirements-native.txt \
402-
--requirements=requirements-linux.txt \
403-
--wheel-only extractcode \
404-
--wheel-only extractcode-7z \
405-
--wheel-only extractcode-libarchive \
406-
--wheel-only typecode-libmagic \
407-
--wheel-only packagedcode-msitools \
408-
--wheel-only rpm-inspector-rpm \
409-
--dest $thirdparty_dir \
410-
--sdists --use-cached-index
411-
mkdir -p $release_dir/etc
412-
cp -r etc/thirdparty $release_dir/etc
413-
mv dist/*.tar.gz $release_dir
414-
cp -r \
415-
scancode.bat scancode extractcode extractcode.bat configure configure.bat \
416-
*.rst \
417-
docs \
418-
samples \
419-
*NOTICE *LICENSE *ABOUT \
420-
$release_dir
421-
422-
tarball=scancode-toolkit-$(git describe --tags)_sources.tar.gz
423-
tar -cvzf dist/$tarball $release_dir
213+
./configure --rel
214+
etc/release/scancode-create-release-app-sources.sh
424215
425216
- name: Collect built source app tarball
426217
uses: actions/upload-artifact@v3
427218
with:
428219
name: source_app
429-
path: dist/*
220+
path: release/*
430221

431222

432223
smoke_test_install_and_run_pypi_dists_posix:
@@ -684,7 +475,7 @@ jobs:
684475
publish_to_pypi:
685476
name: Publish to PyPI
686477
needs:
687-
- build_scancode_for_pypi_mini
478+
- build_scancode_for_pypi
688479
- smoke_test_install_and_run_pypi_dists_windows
689480
- smoke_test_install_and_run_pypi_dists_posix
690481
- publish_to_gh_release

etc/release/README.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,5 @@ NOTE: These are tested to run ONLY on Linux.
88
Release scripts
99
===============
1010

11-
* **scancode-create-release.sh**: This is the main script to build the release
12-
archives for scancode-toolkit (wheels, sdists, tarball, installers). It may
13-
optional call **scancode-release-tests.sh** to run minimal smoke tests on the
14-
built release archives.
15-
16-
* **test_-*.sh**: various test scripts for installation and release, launched when
17-
running scancode-create-release --test
18-
19-
* TODO: scancode_publish.sh: use this to publish the built releases scancode-toolkit
20-
11+
* **scancode-create-release*.sh**: These are scripts to build the release
12+
archives for scancode-toolkit (wheels, sdists, tarball, installers).
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) nexB Inc. and others. All rights reserved.
4+
# ScanCode is a trademark of nexB Inc.
5+
# SPDX-License-Identifier: Apache-2.0
6+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
7+
# See https://github.com/nexB/scancode-toolkit for support or download.
8+
# See https://aboutcode.org for more information about nexB OSS projects.
9+
#
10+
11+
################################################################################
12+
# ScanCode release build script for PyPI wheels and sdists
13+
################################################################################
14+
15+
set -e
16+
# Un-comment to trace execution
17+
#set -x
18+
19+
./configure --dev
20+
./scancode --reindex-licenses
21+
venv/bin/python setup.py --quiet sdist bdist_wheel
22+
23+
rm -rf build .eggs src/scancode_toolkit.egg-info src/scancode_toolkit_mini.egg-info
24+
cp setup.cfg setup-main.cfg
25+
cp setup-mini.cfg setup.cfg
26+
27+
venv/bin/python setup.py --quiet sdist bdist_wheel
28+
29+
cp setup-main.cfg setup.cfg
30+
rm setup-main.cfg
31+
32+
venv/bin/twine check dist/*
33+
34+
set +e
35+
set +x

0 commit comments

Comments
 (0)