Skip to content

0.10.9

0.10.9 #141

Workflow file for this run

name: Python package build and publish
on:
release:
types: [created]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up Python (Windows)
if: matrix.os == 'windows-latest'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Add Rust to PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install pip
pip install cibuildwheel maturin twine cython
- name: Build wheels on Ubuntu
if: matrix.os == 'ubuntu-latest'
env:
CIBW_ARCHS: x86_64
# Install Rust inside the manylinux container.
CIBW_BEFORE_BUILD: "curl https://sh.rustup.rs -sSf | sh -s -- -y"
# Make sure Rust tools are on the PATH for the build.
CIBW_ENVIRONMENT: "PATH=/root/.cargo/bin:$PATH"
RUST_SUBPACKAGE_PATH: datamodel/rs_parsers
CIBW_BUILD: "cp3{10,11,12,13}-*" # Build for Python 3.10, 3.11, 3.12, 3.13
run: |
pip install --upgrade pip==25.0
pip install cibuildwheel
cibuildwheel --platform linux --output-dir dist
- name: Build wheels on Windows
if: matrix.os == 'windows-latest'
run: |
pip install cibuildwheel maturin
cibuildwheel --output-dir dist
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*.whl
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4.1.7
with:
path: dist
- name: Move wheel files to 'dist' directory
run: |
find dist -name '*.whl' -exec mv {} dist \;
- name: Build sdist
run: |
pip install build
python -m build --sdist --outdir dist
- name: Check for wheel types
id: check_wheels
run: |
echo "Checking for wheel types..."
if ls dist/*-manylinux*.whl 1> /dev/null 2>&1; then
echo "Found manylinux wheels."
echo "HAS_MANYLINUX_WHEELS=true" >> $GITHUB_ENV
fi
if ls dist/*-win_*.whl 1> /dev/null 2>&1; then
echo "Found Windows wheels."
echo "HAS_WINDOWS_WHEELS=true" >> $GITHUB_ENV
fi
- name: List files in dist
run: ls -l dist
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install twine
run: pip install twine
- name: Publish wheels and sdist to Production PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYTHON_DATAMODEL_PYPI_API_TOKEN }}
run: twine upload dist/*.whl dist/*.tar.gz || true