Skip to content

Pip

Pip #339

Workflow file for this run

name: Pip
on: workflow_dispatch
jobs:
manylinux_2_28:
name: Build manylinux_2_28 wheels
runs-on: ubuntu-latest
strategy:
matrix:
python: [{ version: "3.9", abi: "cp39-cp39" }]
container:
image: quay.io/pypa/manylinux_2_28_x86_64
options: --user root
steps:
# Insert steps here to install you other dependencies.
# Note that you're running inside of AlmaLinux 8, not ubuntu
- name: Setup necessary packages
run: |
dnf update -y
dnf install -y \
gtk3-devel \
webkit2gtk3-devel \
openssl-devel \
curl \
wget \
squashfs-tools \
make \
file
- name: Setup dev tools
run: |
yum groupinstall -y "Development Tools"
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable --profile minimal -y
- run: source $HOME/.cargo/env && rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu
- uses: actions/checkout@v3
# We remove the Cargo.toml and Cargo.lock files and replace them with
# Cargo-linux.toml and Cargo-linux.lock files, which are configured to build for linux.
- name: Build
run: |
source $HOME/.cargo/env
rm Cargo.toml && rm Cargo.lock
mv Cargo-linux.toml Cargo.toml && mv Cargo-linux.lock Cargo.lock
for PYBIN in /opt/python/${{ matrix.python.abi }}/bin; do
"${PYBIN}/pip" install --upgrade pip wheel auditwheel setuptools-rust toml maturin
"${PYBIN}/maturin" pep517 build-wheel --compatibility manylinux_2_28 --target=x86_64-unknown-linux-gnu --out dist --find-interpreter
done
# Try to install and test importing the package
- name: Test Build
run: |
source $HOME/.cargo/env
for PYBIN in /opt/python/${{ matrix.python.abi }}/bin; do
"${PYBIN}/pip" install --force-reinstall dist/pywry*.whl
"${PYBIN}/python" -c 'from pywry import PyWry; PyWry(); import platform; print(platform.python_version());'
done
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist --target universal2-apple-darwin --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Replace Cargo.toml with Cargo-linux.toml for sdist
run: |
rm Cargo.toml && rm Cargo.lock
mv Cargo-linux.toml Cargo.toml && mv Cargo-linux.lock Cargo.lock
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
release:
name: Release
runs-on: ubuntu-latest
needs: [macos, windows, manylinux_2_28, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *