Skip to content

Build and test wheels #18

Build and test wheels

Build and test wheels #18

Workflow file for this run

name: Build and test wheels
on:
workflow_dispatch:
push:
tags:
- v*
jobs:
tests:
strategy:
fail-fast: false
matrix:
python-version:
- 3.9
# - "3.10"
- 3.11
# - 3.12
- 3.13
# - pypy-3.9
# - pypy-3.10
# - pypy-3.11
os:
- ubuntu-latest
- macos-latest
- windows-latest
exclude:
- os: macos-latest
python-version: 'pypy-3.9'
- os: macos-latest
python-version: 'pypy-3.10'
- os: macos-latest
python-version: 'pypy-3.11'
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} @ ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# architecture: x64
- name: Linux install LZO
if: runner.os == 'Linux'
run: sudo apt install liblzo2-dev
- name: macos install LZO
if: runner.os == 'macOS'
run: |
echo "$RUNNER_OS uses included lzo source"
echo PWD: `pwd`
echo LS lzo
ls -l lzo-2.10/
echo LS lzo include
ls -l lzo-2.10/include/
cd lzo-2.10
./configure --enable-shared --disable-dependency-tracking --prefix=`pwd`
make
make test &> test_results
make install
cd ..
ls -l lzo-2.10/
find ./lzo-2.10/ -name "*lzo2*"
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.1
with:
msbuild-architecture: x64
- name: Setup LZO Windows
if: runner.os == 'Windows'
run: |
pwd
cd lzo-2.10
mkdir build
cd build
cmake ..
pwd
- name: build LZO Windows
if: runner.os == 'Windows'
working-directory: .\lzo-2.10\build
run: msbuild lzo_static_lib.vcxproj -p:Configuration=Release -p:Platform=x64 -p:OutDir=..\
- run: pip install -e ./
- run: pip install pytest build
- run: pytest --doctest-modules tests/
- run: ls -l
if: runner.os != 'Windows'
- run: python -m build
wheels:
needs: [tests,]
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-12]
arch: ["x86_64", "arm64"]
include:
- os: windows-2019
arch: win_amd64
- os: windows-2019
arch: win32
- os: ubuntu-20.04
arch: i686
- os: ubuntu-20.04
arch: aarch64
- os: ubuntu-20.04
arch: ppc64le
- os: ubuntu-20.04
arch: s390x
exclude:
- os: windows-2019
arch: "x86_64"
- os: windows-2019
arch: "arm64"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
# - name: Build and test wheels
# uses: pypa/cibuildwheel@v2.16.2
# env:
# CIBW_BUILD: "*${{ matrix.arch }}"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.0.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
env:
CIBW_SOME_OPTION: "*${{ matrix.arch }}"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ matrix.arch }}
path: wheelhouse/*.whl
if-no-files-found: error
sdist:
needs: [tests,]
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build sdist
run: |
sudo apt install liblzo2-dev
python -m pip install -U pip
python -m pip install -U build
python -m build -s
- name: Test sdist
run : python -m pip install dist/*.gz
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*
if-no-files-found: error
publish:
name: Publish builds on PyPI
runs-on: ubuntu-latest
needs: [sdist, wheels]
if: ${{ always() && (needs.sdist.result == 'success' || needs.wheels.result == 'success') }}
environment:
name: release
url: https://test.pypi.org/p/python-lzo
permissions:
id-token: write
steps:
- name: Download builds
uses: actions/download-artifact@v4.1.7
with:
path: dist
- name: Organise
working-directory: dist
run: |
mv **/*.whl .
mv **/*.gz .
find . -type d -delete
- name: Display structure of downloaded files
run: ls -R
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
repository-url: https://test.pypi.org/legacy/