Skip to content

⬆️ deps: Update Rust crate tokio to v1.41.1 #150

⬆️ deps: Update Rust crate tokio to v1.41.1

⬆️ deps: Update Rust crate tokio to v1.41.1 #150

name: Build and Release
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
merge_group:
workflow_dispatch:
permissions:
contents: read
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
name: Ubuntu, ${{ matrix.target }}, Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: auto
# Refer to https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145
before-script-linux: |
# If we're running on rhel centos, install needed packages.
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
# If we're running on i686 we need to symlink libatomic
# in order to build openssl with -latomic flag.
if [[ ! -d "/usr/lib64" ]]; then
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
fi
else
# If we're running on debian-based system.
apt update -y && apt-get install -y libssl-dev openssl pkg-config
fi
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-ubuntu-${{ matrix.target }}-${{ matrix.python-version }}
path: dist
windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.12"]
target: [x64, x86]
name: Windows, ${{ matrix.target }}, Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}-${{ matrix.python-version }}
path: dist
macos:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.12"]
target: [x86_64, aarch64]
name: macOS, ${{ matrix.target }}, Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}-${{ matrix.python-version }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
publish-pypi:
runs-on: ubuntu-latest
name: Publish to PyPI
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-github-releases:
runs-on: ubuntu-latest
name: Publish to GitHub Releases
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Get tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Publish to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
files: dist/*
tag_name: ${{ env.RELEASE_VERSION }}
publish-crates-io:
runs-on: ubuntu-latest
name: Publish to Crates.io
if: "startsWith(github.ref, 'refs/tags/')"
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Publish to Crates.io
uses: katyo/publish-crates@v2
id: publish-crates
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}