Skip to content

PyO3

PyO3 #243

Workflow file for this run

name: PyO3
# Controls when the action will run.
on:
workflow_dispatch:
pull_request:
branches: [ main ]
paths:
- '.github/workflows/pyo3.yml'
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "0 2 * * 0"
jobs:
pyo3:
name: PyO3 ${{ matrix.os }}/${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python_version: [pypy-3.10-nightly, pypy-3.11-nightly]
timeout-minutes: 20
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python_version }}
- name: Checkout PyO3
uses: actions/[email protected]
with:
repository: PyO3/pyo3
path: pyo3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
# needed to correctly format errors, see #1865
components: rust-src
# NB only builds PyO3's Rust library and tests, can't run these, because
# PyPy doesn't support a Py_Initialize API to call PyPy from Rust
# executables.
#
# These jobs just serve as a check that PyO3 is able to link against PyPy
# symbols as expected.
- name: Build PyO3 Rust lib and tests - no features
shell: bash
run: |
cd pyo3
cargo build --lib --tests
env:
# Necessary to force PyO3 to allow building against PyPy despite no
# Py_Initialize API
PYO3_CI: 1
- name: Build PyO3 Rust lib and tests - with features
shell: bash
run: |
cd pyo3
cargo build --lib --tests --features=full
env:
# Necessary to force PyO3 to allow building against PyPy despite no
# Py_Initialize API
PYO3_CI: 1
# In the future, might want to also try using the "abi3" feature once PyPy
# supports the Python stable API.
- name: Prepare required packages
run: |
python -m pip install -U pip nox
# Build some extension modules using PyO3 and test them using PyPy.
- name: Test PyO3 examples
shell: bash
run: |
cd pyo3
nox -s test-py
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/pyo3/target