Skip to content

release: 0.4.1

release: 0.4.1 #22

Workflow file for this run

name: Build and publish wheels
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: x86_64
- os: macos-14
platform: macos
arch: arm64
- os: windows-latest
platform: windows
arch: AMD64
runs-on: ${{ matrix.os }}
env:
RAYFORCE_GITHUB: "https://github.com/RayforceDB/rayforce.git"
MACOSX_DEPLOYMENT_TARGET: "11.0"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
pip install cibuildwheel
- name: Cache cibuildwheel
uses: actions/cache@v4
with:
path: .cibw
key: cibw-${{ runner.os }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('pyproject.toml', 'setup.cfg', 'setup.py', 'requirements*.txt') }}
restore-keys: |
cibw-${{ runner.os }}-${{ matrix.platform }}-${{ matrix.arch }}-
- name: Build wheels (Linux/macOS)
if: matrix.platform != 'windows'
env:
CIBW_BUILD: "cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*"
CIBW_ARCHS: "auto64"
CIBW_BEFORE_BUILD: "bash {project}/scripts/prepare_build.sh"
CIBW_TEST_SKIP: "*"
CIBW_ENVIRONMENT: "RAYFORCE_GITHUB=https://github.com/RayforceDB/rayforce.git"
CIBW_MACOS_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET=11.0"
CIBW_CACHE_PATH: ".cibw"
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_28_x86_64:latest"
CIBW_BEFORE_ALL_LINUX: "yum install -y git gcc clang gcc-c++ make"
run: |
if [ "${{ matrix.platform }}" = "linux" ]; then
cibuildwheel --platform linux --archs x86_64 --output-dir wheelhouse
else
cibuildwheel --platform macos --archs arm64 --output-dir wheelhouse
fi
- name: Build wheels (Windows)
if: matrix.platform == 'windows'
env:
CIBW_BUILD: "cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "*-win32"
CIBW_ARCHS: "AMD64"
CIBW_BEFORE_BUILD: "bash {project}/scripts/prepare_build.sh"
CIBW_TEST_SKIP: "*"
CIBW_ENVIRONMENT: "RAYFORCE_GITHUB=https://github.com/RayforceDB/rayforce.git"
CIBW_CACHE_PATH: ".cibw"
run: |
cibuildwheel --platform windows --archs AMD64 --output-dir wheelhouse
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform }}-${{ matrix.arch }}
path: wheelhouse/*.whl
retention-days: 1
test_wheels:
name: Test wheels on ${{ matrix.os }} Python ${{ matrix.python-version }}
needs: build_wheels
strategy:
matrix:
include:
- os: ubuntu-latest
python-version: '3.11'
platform: linux
arch: x86_64
- os: ubuntu-latest
python-version: '3.12'
platform: linux
arch: x86_64
- os: ubuntu-latest
python-version: '3.13'
platform: linux
arch: x86_64
- os: ubuntu-latest
python-version: '3.14'
platform: linux
arch: x86_64
- os: macos-14
python-version: '3.11'
platform: macos
arch: arm64
- os: macos-14
python-version: '3.12'
platform: macos
arch: arm64
- os: macos-14
python-version: '3.13'
platform: macos
arch: arm64
- os: macos-14
python-version: '3.14'
platform: macos
arch: arm64
- os: windows-latest
python-version: '3.11'
platform: windows
arch: AMD64
- os: windows-latest
python-version: '3.12'
platform: windows
arch: AMD64
- os: windows-latest
python-version: '3.13'
platform: windows
arch: AMD64
- os: windows-latest
python-version: '3.14'
platform: windows
arch: AMD64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Download wheel artifacts
uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.platform }}-${{ matrix.arch }}
path: wheels
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pandas>=2.0.0 polars>=0.19.0 websockets pyarrow
- name: Remove local rayforce package (Linux/macOS)
if: matrix.platform != 'windows'
run: |
# Remove local rayforce directory to ensure we test against installed wheel
rm -rf rayforce/__pycache__
rm -rf rayforce/*.so rayforce/*.dylib rayforce/*.dll
rm -rf rayforce/plugins/*.so rayforce/plugins/*.dylib rayforce/plugins/*.dll
# Move rayforce directory out of Python path temporarily
if [ -d "rayforce" ]; then
mv rayforce rayforce.local
fi
- name: Remove local rayforce package (Windows)
if: matrix.platform == 'windows'
shell: pwsh
run: |
# Remove local rayforce directory to ensure we test against installed wheel
if (Test-Path "rayforce/__pycache__") { Remove-Item -Recurse -Force "rayforce/__pycache__" }
Get-ChildItem -Path "rayforce" -Filter "*.pyd" -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem -Path "rayforce" -Filter "*.dll" -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem -Path "rayforce/plugins" -Filter "*.pyd" -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem -Path "rayforce/plugins" -Filter "*.dll" -ErrorAction SilentlyContinue | Remove-Item -Force
# Move rayforce directory out of Python path temporarily
if (Test-Path "rayforce") {
Rename-Item -Path "rayforce" -NewName "rayforce.local"
}
- name: Install and test wheel (Linux/macOS)
if: matrix.platform != 'windows'
run: |
PYVER=$(echo '${{ matrix.python-version }}' | tr -d '.')
WHEEL_FILE=$(find wheels -name "*cp${PYVER}*.whl" | head -1)
if [ -z "$WHEEL_FILE" ]; then
echo "Error: No wheel file found for Python ${{ matrix.python-version }}"
find wheels -name "*.whl" || echo "No wheel files found"
exit 1
fi
echo "Installing wheel: $WHEEL_FILE"
pip install "$WHEEL_FILE" --force-reinstall --no-deps
python -m pytest -x -vv tests/
- name: Install and test wheel (Windows)
if: matrix.platform == 'windows'
shell: pwsh
run: |
$pyver = '${{ matrix.python-version }}' -replace '\.',''
$wheelFile = Get-ChildItem -Path wheels -Filter "*cp${pyver}*win*.whl" | Select-Object -First 1
if (-not $wheelFile) {
Write-Error "No wheel file found for Python ${{ matrix.python-version }}"
Get-ChildItem -Path wheels -Filter "*.whl"
exit 1
}
Write-Host "Installing wheel: $($wheelFile.FullName)"
pip install $wheelFile.FullName --force-reinstall --no-deps
python -m pytest -x -vv tests/
publish:
name: Publish to PyPI
needs: test_wheels
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write
contents: read
environment:
name: pypi
url: https://pypi.org/p/rayforce-py
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
path: wheels
- name: Prepare distribution directory
run: |
mkdir -p dist
find wheels -name "*.whl" -exec cp {} dist/ \;
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Extracted version: ${VERSION}"
- name: Announce release on Zulip
if: success()
env:
ZULIP_BOT_TOKEN: ${{ secrets.ZULIP_RELEASES_BOT_TOKEN }}
run: |
chmod +x scripts/announce-release.sh
./scripts/announce-release.sh "${{ steps.version.outputs.version }}" "${{ secrets.ZULIP_RELEASES_BOT_TOKEN }}"