Skip to content

Pip Nightly

Pip Nightly #26

Workflow file for this run

name: Pip Nightly
on: workflow_dispatch
jobs:
manylinux-nightly:
name: Build manylinux wheels nightly
runs-on: ubuntu-latest
strategy:
matrix:
python:
[
{ version: "3.9", abi: "cp39-cp39" },
]
target: [manylinux_2_28, manylinux2014]
container:
image: quay.io/pypa/${{ matrix.target }}_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 nightly-2022-07-26 --profile minimal -y
- run: source $HOME/.cargo/env && rustup component add rust-src --toolchain nightly-2022-07-26-x86_64-unknown-linux-gnu
- uses: actions/checkout@v3
- name: Update version in Cargo-linux.toml and pyproject.toml
run: |
sed -i '2s/name = ".*"/name = "pywry-nightly"/' Cargo-linux.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1-dev$(date +%Y%m%d)\"/" Cargo-linux.toml
head Cargo-linux.toml
sed -i '2s/name = ".*"/name = "pywry-nightly"/' pyproject.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1.dev$(date +%Y%m%d)\"/" pyproject.toml
head pyproject.toml
sed -i 's/pip install pywry/pip install pywry-nightly/' README.md
# 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 ${{ matrix.target }} -Z build-std=std,panic_abort --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
- name: Update version in Cargo.toml and pyproject.toml
run: |
(Get-Content Cargo.toml) -replace '(?m)^name = ".*" \# Package name', 'name = "pywry-nightly"' | Set-Content Cargo.toml
(Get-Content Cargo.toml) -replace '(?m)^(version = ")(.*)(")', "`$1`$2-dev$(Get-Date -Format "yyyyMMdd")`$3" | Set-Content Cargo.toml
Get-Content Cargo.toml -Head 4
(Get-Content pyproject.toml) -replace '(?m)^name = ".*"', 'name = "pywry-nightly"' | Set-Content pyproject.toml
(Get-Content pyproject.toml) -replace '(?m)^(version = ")(.*)(")', "`$1`$2.dev$(Get-Date -Format "yyyyMMdd")`$3" | Set-Content pyproject.toml
Get-Content pyproject.toml -Head 4
(Get-Content README.md) -replace 'pip install pywry', 'pip install pywry-nightly' | Set-Content README.md
- 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
- name: Update version in Cargo.toml and pyproject.toml
run: |
sed -i '' '2s/name = ".*"/name = "pywry-nightly"/' Cargo.toml
sed -i '' "3s/version = \"\(.*\)\"/version = \"\1-dev$(date +%Y%m%d)\"/" Cargo.toml
head Cargo.toml
sed -i '' '2s/name = ".*"/name = "pywry-nightly"/' pyproject.toml
sed -i '' "3s/version = \"\(.*\)\"/version = \"\1.dev$(date +%Y%m%d)\"/" pyproject.toml
head pyproject.toml
sed -i '' 's/pip install pywry/pip install pywry-nightly/' README.md
- 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: Update version in Cargo.toml and pyproject.toml
run: |
rm Cargo.toml && rm Cargo.lock
mv Cargo-linux.toml Cargo.toml && mv Cargo-linux.lock Cargo.lock
sed -i '2s/name = ".*"/name = "pywry-nightly"/' Cargo.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1-dev$(date +%Y%m%d)\"/" Cargo.toml
head Cargo.toml
sed -i '2s/name = ".*"/name = "pywry-nightly"/' pyproject.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1.dev$(date +%Y%m%d)\"/" pyproject.toml
head pyproject.toml
sed -i 's/pip install pywry/pip install pywry-nightly/' README.md
- 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, sdist, manylinux-nightly]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.NIGHTLY_PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *