pheon/.github/workflows/packages.yml

123 lines
3.7 KiB
YAML

name: Package artifacts
on:
pull_request:
workflow_dispatch:
push:
tags: ['v*']
permissions:
contents: read
jobs:
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: '3.11'
- run: python -m pip install build
- run: python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: source
path: dist/*.tar.gz
wheels:
needs: sdist
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-15, windows-latest]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: source
path: source-dist
- name: Unpack the source release
shell: bash
run: |
mkdir source-build
tar -xzf source-dist/*.tar.gz -C source-build --strip-components=1
- name: Build and repair Python-independent wheels from the sdist
uses: pypa/cibuildwheel@v4.3.5
with:
package-dir: source-build
env:
CIBW_BUILD: cp311-*
CIBW_SKIP: '*-musllinux_* *-win32'
CIBW_ARCHS: native
CIBW_ENVIRONMENT_LINUX: 'CARGO_HOME=/tmp/pheon-cargo RUSTUP_HOME=/tmp/pheon-rustup PATH=/tmp/pheon-cargo/bin:$PATH'
CIBW_BEFORE_ALL_LINUX: 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable'
CIBW_TEST_EXTRAS: arrow
CIBW_TEST_COMMAND: 'python -I {project}/tools/check_installed.py'
- name: Check wheel ABI tags
shell: python
run: |
from pathlib import Path
wheels = list(Path('wheelhouse').glob('*.whl'))
assert wheels
assert all('-py3-none-' in p.name for p in wheels), wheels
- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}
path: wheelhouse/*.whl
same-wheel:
needs: wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-15, windows-latest]
python: ['3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- uses: actions/download-artifact@v4
with:
name: wheel-${{ matrix.os }}
path: wheelhouse
- name: Install the same artifact on another Python version
shell: bash
run: python -m pip install wheelhouse/*.whl pyarrow
- run: python -I tools/check_installed.py
cli:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-15, windows-latest]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- run: cargo test --release --locked
- run: cargo build --release --locked --bin pheon
- name: Assemble standalone CLI artifact
shell: bash
run: |
mkdir cli-dist
if [ "$RUNNER_OS" = Windows ]; then
cp target/release/pheon.exe cli-dist/
else
cp target/release/pheon cli-dist/
fi
cp LICENSE.md README.md cli-dist/
cp -R contrib docs cli-dist/
- uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.os }}
path: cli-dist/