Skip to content

004: close last backlog — entity velocity + packet-trace test scaffold #36

004: close last backlog — entity velocity + packet-trace test scaffold

004: close last backlog — entity velocity + packet-trace test scaffold #36

Workflow file for this run

name: Wheels (003)
on:
push:
branches: [main, master, "003-*"]
tags: ["v*"]
pull_request:
branches: [main, master]
paths:
- "rust/**"
- "python-ext/**"
- ".github/workflows/wheels.yml"
workflow_dispatch:
# abi3 maturin matrix. One wheel per (OS, arch) covers Python 3.11+
# without rebuild (`abi3-py311` feature in python-ext/Cargo.toml).
#
# macOS targets are intentionally not built. Hosted macOS runners
# (especially the macos-13 Intel pool) sit queued for hours on the
# free plan and stall the whole workflow. Linux + Windows is the
# supported wheel matrix; Mac users can `pip install -e python/` for
# the pure-Python reference or `maturin develop` against the local
# Rust crate.
jobs:
linux-x86_64:
name: Linux x86_64 (manylinux2014)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: PyO3/maturin-action@v1
with:
target: x86_64-unknown-linux-gnu
manylinux: "2014"
args: --release --strip --manifest-path python-ext/Cargo.toml --interpreter python3.11
working-directory: .
- uses: actions/upload-artifact@v4
with:
name: wheel-linux-x86_64
path: target/wheels/*.whl
if-no-files-found: error
linux-aarch64:
name: Linux aarch64 (manylinux2014 cross)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: PyO3/maturin-action@v1
with:
target: aarch64-unknown-linux-gnu
manylinux: "2014"
args: --release --strip --manifest-path python-ext/Cargo.toml --interpreter python3.11
- uses: actions/upload-artifact@v4
with:
name: wheel-linux-aarch64
path: target/wheels/*.whl
if-no-files-found: error
windows-x86_64:
name: Windows x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: PyO3/maturin-action@v1
with:
target: x86_64-pc-windows-msvc
args: --release --strip --manifest-path python-ext/Cargo.toml --interpreter python3.11
- uses: actions/upload-artifact@v4
with:
name: wheel-windows-x86_64
path: target/wheels/*.whl
if-no-files-found: error
# Smoke-install: confirm each wheel installs and imports in a
# clean Python 3.11 venv. Linux + Windows only; macOS is excluded
# at the build level so there is nothing to smoke there.
smoke-test:
name: Wheel smoke (${{ matrix.platform }})
needs: [linux-x86_64, windows-x86_64]
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- platform: linux-x86_64
runs-on: ubuntu-latest
- platform: windows-x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
name: wheel-${{ matrix.platform }}
path: dist
- name: Install wheel + pytest
run: |
python -m pip install --upgrade pip
python -m pip install dist/*.whl pytest pytest-asyncio
shell: bash
- name: Smoke import
run: |
python -c "import minecraft_bot_accel as mb; print(mb.__version__, mb.implementation)"
- name: Install python reference for parity bringup
run: |
pip install -e python/
- name: Run smoke parity tests
run: |
pytest -q tests/python/parity/test_smoke_bringup.py
# Python 3.12 smoke on Linux: the abi3 wheel must accept both
# 3.11 and 3.12 interpreters.
smoke-test-py312:
name: Wheel smoke py3.12 (linux-x86_64)
needs: [linux-x86_64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/download-artifact@v4
with:
name: wheel-linux-x86_64
path: dist
- run: |
python -m pip install --upgrade pip
python -m pip install dist/*.whl pytest pytest-asyncio
pip install -e python/
- run: python -c "import minecraft_bot_accel as mb; assert mb.implementation == 'rust'"
- run: pytest -q tests/python/parity/test_smoke_bringup.py
# Pure-Python `minecraft_bot` distribution: one universal wheel
# (py3-none-any) plus the source tarball, built from python/.
python-sdist-wheel:
name: Pure-Python minecraft_bot sdist + wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build backend
run: python -m pip install --upgrade pip build
- name: Build sdist + wheel from python/
run: python -m build python/ --outdir dist-python
- name: List built artefacts
run: ls -lh dist-python
- name: Smoke install + import
run: |
python -m pip install dist-python/*.whl
python -c "import minecraft_bot; print('python ref', minecraft_bot.__version__, minecraft_bot.implementation)"
- uses: actions/upload-artifact@v4
with:
name: python-ref-dist
path: dist-python/*
if-no-files-found: error
# Rust standalone crate (`minecraft_bot`): packaged source tarball
# via `cargo package`. Distributable via `cargo publish` (manual
# step; the artefact is attached to the release for offline use).
rust-crate-package:
name: Rust crate package (minecraft_bot)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: cargo package
working-directory: rust
run: cargo package --no-verify
- name: List produced artefact
# Workspace builds put cargo package output in the workspace
# root `target/`, not `rust/target/`.
run: ls -lh target/package
- uses: actions/upload-artifact@v4
with:
name: rust-crate
path: target/package/*.crate
if-no-files-found: error
# On a `v*` tag push, collect every artefact and attach to the
# matching GitHub Release. Depends only on the build jobs.
publish-release:
name: Upload wheels to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- linux-x86_64
- linux-aarch64
- windows-x86_64
- python-sdist-wheel
- rust-crate-package
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download accel wheels (3 platforms)
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- name: Download pure-Python sdist + wheel
uses: actions/download-artifact@v4
with:
name: python-ref-dist
path: dist
- name: Download Rust crate package
uses: actions/download-artifact@v4
with:
name: rust-crate
path: dist
- name: List collected artefacts
run: ls -lh dist
- name: Create or update Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
fail_on_unmatched_files: false
files: |
dist/*.whl
dist/*.tar.gz
dist/*.crate
body: |
Distributables for all three artefacts in the workspace.
**`minecraft_bot_accel`** — PyO3 facade over the standalone
Rust framework. Pre-built ABI3 wheels for Linux x86_64,
Linux aarch64, and Windows x86_64. One wheel per
platform; each covers Python 3.11+.
**`minecraft_bot`** — pure-Python reference implementation.
One universal wheel (`py3-none-any`) plus the source
tarball. Zero runtime dependencies; runs on any platform
with Python 3.11+ (including macOS).
**`minecraft_bot` (Rust crate)** — standalone Rust
framework, packaged via `cargo package`. Install from this
tarball via `cargo install --path` or republish to
crates.io.
macOS users: install the pure-Python wheel directly, or
build the accel wheel locally with
`maturin develop --release --manifest-path python-ext/Cargo.toml`.
See [CHANGELOG.md](https://github.com/AlexMelanFromRingo/MinecraftBot/blob/main/CHANGELOG.md) for release notes.