Skip to content

v0.0.99

v0.0.99 #45

name: Deploy package to PyPI
on:
release:
types: [published]
jobs:
build-source:
name: Build source package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update version in pyproject.toml from current git tag
run: |
sed -i "s/0\\.0\\.0\\.dev0/${GITHUB_REF_NAME/v/}/g" pyproject.toml
- uses: actions/setup-python@v4
with:
python-version: 3.13
- name: Build package
run: |
pip install build
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: source
path: ./dist
build-linux-non-arm7l:
name: Build Linux wheels (all but arm7l)
runs-on: ubuntu-latest
strategy:
matrix:
image:
- "manylinux2014_x86_64"
- "musllinux_1_1_x86_64"
- "manylinux2014_aarch64"
- "musllinux_1_1_aarch64"
folder:
- "cp37-cp37m"
- "cp38-cp38"
- "cp39-cp39"
- "cp310-cp310"
- "cp311-cp311"
- "cp312-cp312"
- "cp313-cp313"
steps:
- uses: actions/checkout@v4
- name: Update version in pyproject.toml from current git tag
run: |
sed -i "s/0\\.0\\.0\\.dev0/${GITHUB_REF_NAME/v/}/g" pyproject.toml
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build packages
run: >-
docker run --rm -v ${{ github.workspace }}:/app quay.io/pypa/${{ matrix.image }} bash -c '
cd /app &&
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y &&
. "$HOME/.cargo/env" &&
/opt/python/${{ matrix.folder }}/bin/python -m build --wheel
auditwheel repair $(ls dist/*.whl) &&
rm dist/*.whl &&
cp wheelhouse/*.whl dist
'
- uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.image }}-$${{ matrix.folder }}
path: ./dist
build-linux-arm7l:
# Installing rust via rustup isn't supported on arm7l: it's a "Tier 2 target without host tools"
# But we can install it using the distribution's system package manager, in this case apk
name: Build Linux wheels (arm7l)
runs-on: ubuntu-latest
strategy:
matrix:
image:
- "musllinux_1_2_armv7l"
folder:
- "cp37-cp37m"
- "cp38-cp38"
- "cp39-cp39"
- "cp310-cp310"
- "cp311-cp311"
- "cp312-cp312"
- "cp313-cp313"
steps:
- uses: actions/checkout@v4
- name: Update version in pyproject.toml from current git tag
run: |
sed -i "s/0\\.0\\.0\\.dev0/${GITHUB_REF_NAME/v/}/g" pyproject.toml
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm
- name: Build packages
run: >-
docker run --rm -v ${{ github.workspace }}:/app quay.io/pypa/${{ matrix.image }} bash -c '
cd /app &&
apk add rust cargo &&
/opt/python/${{ matrix.folder }}/bin/python -m build --wheel &&
auditwheel repair $(ls dist/*.whl) &&
rm dist/*.whl &&
cp wheelhouse/*.whl dist
'
- uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.image }}-$${{ matrix.folder }}
path: ./dist
build-macos:
name: Build macOS wheels
strategy:
matrix:
os:
- "macos-12"
- "macos-13"
- "macos-14" # ARM
python-version:
- "3.7.1"
- "3.8.10"
- "3.9.13"
- "3.10.11"
- "3.11.9"
- "3.12.6"
- "3.13.0"
exclude:
- python-version: "3.7.1"
os: "macos-14"
runs-on: '${{ matrix.os }}'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '${{ matrix.python-version }}'
- name: Update version in pyproject.toml from current git tag
run: |
sed -i "" "s/0\\.0\\.0\\.dev0/${GITHUB_REF_NAME/v/}/g" pyproject.toml
- name: Build package
run: |
pip install build
python -m build --wheel
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: ./dist
build-windows:
name: Build Windows wheels
strategy:
matrix:
os:
- "windows-2019"
python-version:
- "3.7.1"
- "3.8.0"
- "3.9.0"
- "3.10.0"
- "3.11.0"
- "3.12.0"
- "3.13.0"
runs-on: '${{ matrix.os }}'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '${{ matrix.python-version }}'
- name: Update version in pyproject.toml from current git tag
run: |
(Get-Content pyproject.toml).Replace('0.0.0.dev0', ($Env:GITHUB_REF_NAME).Replace('v', '')) | Set-Content pyproject.toml
- name: Build package
run: |
pip install build
python -m build --wheel
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: ./dist
deploy:
needs:
- build-source
- build-linux-non-arm7l
- build-linux-arm7l
- build-macos
- build-windows
environment:
name: pypi
url: https://pypi.org/project/stream-unzip/
name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: ./dist
# The "merge-multiple" option of download-artifact seems to cause corruption when there are
# multiple files of the same name, which happens because in some different macOS versions
# make the exact same Python package. So we avoid that and do a manual move of packages
# to the top level for upload
- name: Move packages to top level
run: |
find ./dist -mindepth 2 -type f -exec mv -t ./dist -i '{}' +
rm -R -- ./dist/*/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: ./dist/