Skip to content

ci: improve checks for OS #1302

ci: improve checks for OS

ci: improve checks for OS #1302

Workflow file for this run

name: Wheel
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
permissions: read-all
jobs:
build_wheels_windows:
name: Build Wheels for Python ${{ matrix.python }} on Windows
strategy:
fail-fast: false
matrix:
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
runs-on: windows-2019
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
allow-prereleases: true
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_64
- name: Set up CMake and Ninja
uses: lukka/get-cmake@latest
- name: Build Wheels
run: |
python -m pip install -U pip
pip install wheel
python -m pip wheel . --no-deps --wheel-dir=dist --verbose
- name: Test Wheels
run: |
pip install pytest
Get-ChildItem ./dist/ -Filter *-win_amd64.whl | ForEach-Object {
pip install $_.FullName
}
pytest python/tests
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: endstone-wheels-windows-python${{ matrix.python }}
path: dist/*-win_amd64.whl
build_wheels_linux:
name: Build Wheels for Python ${{ matrix.python }} on Ubuntu
strategy:
fail-fast: false
matrix:
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
allow-prereleases: true
- name: Set up Clang 15
env:
LLVM_VERSION: 15
run: |
sudo apt-get update -y -q
sudo apt-get install -y -q build-essential lsb-release wget software-properties-common gnupg
sudo wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh ${LLVM_VERSION}
sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100
- name: Set up CMake and Ninja
uses: lukka/get-cmake@latest
- name: Build Wheels
env:
CC: clang
CXX: clang++
run: |
python -m pip install -U pip
pip install wheel
python -m pip wheel . --no-deps --wheel-dir=wheelhouse --verbose
- name: Repair Wheels
run: |
pip install auditwheel setuptools "patchelf>=0.14"
python -m auditwheel --verbose repair --plat manylinux_2_31_x86_64 -w dist wheelhouse/*.whl
- name: Test Wheels
run: |
pip install pytest
pip install dist/*-manylinux_2_31_x86_64.whl
pytest python/tests
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: endstone-wheels-linux-python${{ matrix.python }}
path: dist/*-manylinux_2_31_x86_64.whl
publish:
name: Publish Wheels to PyPI
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [ build_wheels_windows, build_wheels_linux ]
environment: pypi
permissions:
id-token: write
contents: write
steps:
- name: Restore Artifacts
uses: actions/download-artifact@v4
with:
pattern: endstone-wheels-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1