Merge pull request #3701 from nexB/release-prep-v32.1.0 #70
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create ScanCode release archives, then test and publish to GH and PyPI | |
# This is executed automatically on a tag | |
# | |
# Summary of the steps: | |
# - Build wheel and sdist for the "main" scancode, then build these for the "mini" flavor | |
# - test each wheel and sdist on every possible OS x Python version combinations | |
# - Build release app archives, one for each of linux, windows, macos on Python 3.8 | |
# - test each on its target OS and Python version | |
# - Create gh-release and upload app archives to release | |
# - Upload all wheels and sdist to PyPI | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*.*.*" | |
permissions: {} | |
jobs: | |
build_scancode_wheel_for_pypi: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Build PyPI wheels | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python on ${{ matrix.pyver }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Install requirements then build main and mini wheel | |
run: etc/release/scancode-create-pypi-wheel.sh | |
- name: Collect built wheels for ${{ matrix.pyver }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels-${{ matrix.pyver }} | |
path: dist/*.whl | |
build_scancode_sdist_for_pypi: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Build PyPI sdist archives | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install requirements then build main and mini sdist | |
run: etc/release/scancode-create-pypi-sdist.sh | |
- name: Collect built sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdists | |
path: dist/*.tar.gz | |
build_scancode_for_release_linux: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Build app Release for linux | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python on ${{ matrix.pyver }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Build linux app archive | |
run: etc/release/scancode-create-release-app-linux.sh ${{ matrix.pyver }} | |
- name: Collect built linux app for python ${{ matrix.pyver }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux_app_py_${{ matrix.pyver }} | |
path: release/* | |
build_scancode_for_release_macos: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Build app Release for mac | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python on ${{ matrix.pyver }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Build mac app archive | |
run: etc/release/scancode-create-release-app-macos.sh ${{ matrix.pyver }} | |
- name: Collect built mac app for python ${{ matrix.pyver }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos_app_py_${{ matrix.pyver }} | |
path: release/* | |
build_scancode_for_release_windows: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Build app Release for windows | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python on ${{ matrix.pyver }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Build windows app archive | |
run: etc/release/scancode-create-release-app-windows.sh ${{ matrix.pyver }} | |
- name: Collect built windows app for python ${{ matrix.pyver }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows_app_py_${{ matrix.pyver }} | |
path: release/* | |
build_scancode_for_release_source: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Build app source | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Build source archive with deps | |
run: etc/release/scancode-create-release-app-sources.sh | |
- name: Collect built source app tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: source_app | |
path: release/* | |
smoke_test_install_and_run_pypi_wheels_on_posix: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Test PyPI wheels on linux and mac | |
needs: | |
- build_scancode_wheel_for_pypi | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-22.04, ubuntu-22.04, macos-11, macos-12] | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.pyver }} on ${{ matrix.os }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Download wheels artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels-${{ matrix.pyver }} | |
path: dist | |
- name: test install wheels | |
run: | | |
echo "license: gpl-2.0" > some.file | |
rm -rf venv; \ | |
python -m venv venv | |
venv/bin/python -m pip install --upgrade pip wheel setuptools | |
for f in `find dist -type f -name "*${{ matrix.pyver }}*"`; \ | |
do \ | |
venv/bin/python -m pip install --force-reinstall "$f[full]" ; \ | |
venv/bin/scancode -clipeu --json-pp - some.file ; \ | |
done | |
smoke_test_install_and_run_pypi_wheels_on_windows: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Test PyPI wheels on Windows | |
needs: | |
- build_scancode_wheel_for_pypi | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [windows-2019, windows-2022] | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.pyver }} on ${{ matrix.os }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Download wheels artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels-${{ matrix.pyver }} | |
path: dist | |
- name: test install wheel | |
run: | | |
echo "license: gpl-2.0" > some.file | |
python -m venv venv | |
venv/Scripts/python.exe -m pip install --upgrade pip | |
for f in `find dist -type f -name "*${{ matrix.pyver }}*"`; \ | |
do \ | |
venv/Scripts/python.exe -m pip install --force-reinstall "$f[full]" ; \ | |
venv/Scripts/scancode -clipeu --json-pp - some.file ; \ | |
done | |
smoke_test_install_and_run_app_archives_on_linux: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Test app on ${{ matrix.os }} | |
needs: | |
- build_scancode_for_release_linux | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-22.04, ubuntu-22.04] | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.pyver }} on ${{ matrix.os }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Download a single artifact linux_app_py_${{ matrix.pyver }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux_app_py_${{ matrix.pyver }} | |
path: dist | |
- name: test install app archive | |
run: | | |
for f in `find dist -type f -name "*.tar.gz"`; \ | |
do \ | |
python etc/release/scancode_release_tests.py $f; \ | |
done | |
smoke_test_install_and_run_app_archives_on_macos: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Test app on ${{ matrix.os }} | |
needs: | |
- build_scancode_for_release_macos | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [macos-11, macos-12] | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.pyver }} on ${{ matrix.os }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Download a single artifact macos_app_py_${{ matrix.pyver }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos_app_py_${{ matrix.pyver }} | |
path: dist | |
- name: test install app archive | |
run: | | |
for f in `find dist -type f -name "*.tar.gz"`; \ | |
do \ | |
python etc/release/scancode_release_tests.py $f; \ | |
done | |
smoke_test_install_and_run_app_archives_on_windows: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
name: Test app on ${{ matrix.os }} | |
needs: | |
- build_scancode_for_release_windows | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: cmd | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [windows-2019, windows-2022] | |
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.pyver }} on ${{ matrix.os }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Download a single artifact windows_app_py_${{ matrix.pyver }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows_app_py_${{ matrix.pyver }} | |
path: dist | |
- name: test install app archive | |
run: | | |
for %%F in (dist/*.zip) do python etc/release/scancode_release_tests.py dist/%%F | |
publish_to_gh_release: | |
permissions: | |
contents: write # to create GitHub release (softprops/action-gh-release) | |
name: Publish to GH Release | |
needs: | |
- smoke_test_install_and_run_app_archives_on_linux | |
- smoke_test_install_and_run_app_archives_on_windows | |
- smoke_test_install_and_run_app_archives_on_macos | |
- build_scancode_for_release_source | |
- build_scancode_for_release_windows | |
- build_scancode_for_release_linux | |
- build_scancode_for_release_macos | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Download a single artifact source_app | |
uses: actions/download-artifact@v3 | |
with: | |
name: source_app | |
path: dist | |
- name: Download a single artifact macos_app for python 3.8 | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos_app_py_3.8 | |
path: dist | |
- name: Download a single artifact macos_app for python 3.9 | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos_app_py_3.9 | |
path: dist | |
- name: Download a single artifact macos_app for python 3.10 | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos_app_py_3.10 | |
path: dist | |
- name: Download a single artifact macos_app for python 3.11 | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos_app_py_3.11 | |
path: dist | |
- name: Download a single artifact macos_app for python 3.12 | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos_app_py_3.12 | |
path: dist | |
- name: Download a single artifact linux_app for python 3.8 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux_app_py_3.8 | |
path: dist | |
- name: Download a single artifact linux_app for python 3.9 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux_app_py_3.9 | |
path: dist | |
- name: Download a single artifact linux_app for python 3.10 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux_app_py_3.10 | |
path: dist | |
- name: Download a single artifact linux_app for python 3.11 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux_app_py_3.11 | |
path: dist | |
- name: Download a single artifact linux_app for python 3.12 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux_app_py_3.12 | |
path: dist | |
- name: Download a single artifact windows_app for python 3.8 | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows_app_py_3.8 | |
path: dist | |
- name: Download a single artifact windows_app for python 3.9 | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows_app_py_3.9 | |
path: dist | |
- name: Download a single artifact windows_app for python 3.10 | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows_app_py_3.10 | |
path: dist | |
- name: Download a single artifact windows_app for python 3.11 | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows_app_py_3.11 | |
path: dist | |
- name: Download a single artifact windows_app for python 3.12 | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows_app_py_3.12 | |
path: dist | |
- name: Mock GH release | |
run: | | |
ls -al dist | |
- name: Create release and publish archives | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: dist/* | |
publish_to_pypi: | |
name: Publish to PyPI | |
needs: | |
- build_scancode_wheel_for_pypi | |
- build_scancode_sdist_for_pypi | |
- smoke_test_install_and_run_pypi_wheels_on_windows | |
- smoke_test_install_and_run_pypi_wheels_on_posix | |
- publish_to_gh_release | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
dist_names: ["wheels-3.8", "wheels-3.9", "wheels-3.10", "wheels-3.11", "wheels-3.12", sdists] | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Download a single artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ matrix.dist_names }} | |
path: dist | |
- name: Mock PyPI upload | |
run: | | |
ls -al dist | |
- name: Publish distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |