fix: make sure pyo3 runtime is initialized before all others (#1063) #129
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow can be triggered on tags push (automatic release) or manually on any branch. | |
# | |
# - When triggered on tags push, it will build and publishes a new version including docs. | |
# - When triggered manually, it's a dry-run: only build, without publishing anything. | |
name: Release CocoIndex | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
jobs: | |
create-versioned-toml: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./.github/scripts/update_version.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Cargo.toml | |
path: Cargo.toml | |
generate-3p-notices: | |
runs-on: ubuntu-latest | |
needs: [create-versioned-toml] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Cargo.toml | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-binstall | |
- name: Install cargo-about | |
run: cargo binstall -y cargo-about | |
- name: Generate THIRD_PARTY_NOTICES.html | |
run: cargo about generate -o THIRD_PARTY_NOTICES.html about.hbs | |
- name: Upload THIRD_PARTY_NOTICES.html artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: THIRD_PARTY_NOTICES.html | |
path: THIRD_PARTY_NOTICES.html | |
build: | |
runs-on: ${{ matrix.platform.runner }} | |
needs: [create-versioned-toml, generate-3p-notices] | |
strategy: | |
matrix: | |
platform: | |
- { os: linux, runner: ubuntu-latest, target: x86_64, container: "ghcr.io/rust-cross/manylinux_2_28-cross:x86_64" } | |
- { os: linux, runner: ubuntu-24.04-arm, target: aarch64, container: "ghcr.io/rust-cross/manylinux_2_28-cross:aarch64" } | |
- { os: macos, runner: macos-latest, target: aarch64 } | |
- { os: macos, runner: macos-13, target: x86_64 } | |
- { os: windows, runner: windows-latest, target: x64 } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Cargo.toml | |
- uses: actions/download-artifact@v4 | |
with: | |
name: THIRD_PARTY_NOTICES.html | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.13 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist | |
sccache: 'true' | |
manylinux: auto | |
container: ${{ matrix.platform.container }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.platform.os }}-${{ matrix.platform.target }} | |
path: dist | |
test-abi3: | |
runs-on: ubuntu-24.04 | |
needs: build | |
strategy: | |
matrix: | |
py: ["3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheels-linux-x86_64 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py }} | |
- run: python -V | |
- run: pip install --find-links=./ cocoindex | |
- run: python -c "import cocoindex, sys; print('import ok on', sys.version)" | |
sdist: | |
runs-on: ubuntu-latest | |
needs: [create-versioned-toml, generate-3p-notices] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Cargo.toml | |
- uses: actions/download-artifact@v4 | |
with: | |
name: THIRD_PARTY_NOTICES.html | |
- 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 | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [create-versioned-toml, build, test-abi3, sdist, generate-3p-notices] | |
permissions: | |
# Use to sign the release artifacts | |
id-token: write | |
# Used to upload release artifacts | |
contents: write | |
# Used to generate artifact attestation | |
attestations: write | |
environment: release | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Cargo.toml | |
- uses: actions/download-artifact@v4 | |
with: | |
name: THIRD_PARTY_NOTICES.html | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: wheels-* | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: 'wheels-*/*' | |
- name: Publish to PyPI | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: upload | |
args: --non-interactive --skip-existing wheels-*/* | |
release-docs: | |
name: Release Docs | |
needs: [release] | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: ./.github/workflows/_docs_release.yml | |
secrets: inherit |