Skip to content

Release v2.0.3

Release v2.0.3 #518

name: Build JAX Wheels
on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR
concurrency:
group: jax-wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build-jax-sdist:
runs-on: ubuntu-22.04
name: sdist
env:
SPHERICART_NO_LOCAL_DEPS: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: python -m pip install build
- name: Build jax sdist
run: python -m build --sdist ./sphericart-jax --outdir ./dist
- uses: actions/upload-artifact@v4
with:
name: "sphericart-jax-sdist"
path: ./dist/*.tar.gz
- name: upload to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
./dist/*.tar.gz
prerelease: ${{ contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-jax-wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
jax-version:
- "0.6.2"
- "0.7.0"
- "0.7.1"
- "0.7.2"
- "0.8.0"
- "0.8.1"
- "0.8.2"
- "0.8.3"
- "0.9.0"
- "0.9.1"
- "0.9.2"
- "0.10.0"
- "0.10.1"
os: [ubuntu-22.04, macos-14, ubuntu-22.04-arm, windows-2022]
include:
- name: x86_64 Linux
os: ubuntu-22.04
arch: x86_64
- name: x86_64 macOS
os: macos-14
arch: x86_64
- name: arm64 macOS
os: macos-14
arch: arm64
- name: aarch64 Linux
os: ubuntu-22.04-arm
arch: aarch64
- name: x86_64 Windows
os: windows-2022
arch: AMD64
name: "JAX ${{matrix.jax-version}} ${{matrix.os}} ${{matrix.arch}}"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build custom manylinux Docker Image with CUDA
if: startsWith(matrix.os, 'ubuntu-')
run: |
docker build --no-cache \
-t sphericart_manylinux_2_28_"${{ matrix.arch }}" \
scripts/manylinux_2_28_"${{ matrix.arch }}"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build jax wheels
run: python -m cibuildwheel ./sphericart-jax
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_MANYLINUX_X86_64_IMAGE: sphericart_manylinux_2_28_x86_64
CIBW_MANYLINUX_AARCH64_IMAGE: sphericart_manylinux_2_28_aarch64
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair \
-w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
delocate-wheel --ignore-missing-dependencies \
--require-archs {delocate_archs} \
-w {dest_dir} -v {wheel}
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel}
CIBW_ENVIRONMENT: >
SPHERICART_ARCH_NATIVE=OFF
SPHERICART_NO_LOCAL_DEPS=1
SPHERICART_JAX_BUILD_WITH_JAX_VERSION=${{ matrix.jax-version }}.*
- uses: actions/upload-artifact@v4
with:
name: jax-single-version-wheel-${{ matrix.os }}-${{ matrix.arch }}-jax-${{ matrix.jax-version }}
path: ./wheelhouse/*.whl
merge-jax-wheels:
needs: build-jax-wheels
runs-on: ubuntu-22.04
name: merge wheels for ${{ matrix.name }}
strategy:
matrix:
include:
- name: x86_64 Linux
os: ubuntu-22.04
arch: x86_64
- name: arm64 macOS
os: macos-14
arch: arm64
- name: aarch64 Linux
os: ubuntu-22.04-arm
arch: aarch64
- name: x86_64 Windows
os: windows-2022
arch: AMD64
steps:
- uses: actions/checkout@v4
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: jax-single-version-wheel-${{ matrix.os }}-${{ matrix.arch }}-*
merge-multiple: false
path: dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install dependencies
run: python -m pip install twine wheel
- name: merge wheels
run: |
set -euxo pipefail
ls dist/
# collect all jax versions used for the build
REQUIRES_JAX=$(find dist -name "*.whl" -exec unzip -p {} "sphericart_jax-*.dist-info/METADATA" \; | grep "Requires-Dist: jax")
MERGED_JAX_REQUIRE=$(python scripts/create-jax-versions-range.py "$REQUIRES_JAX")
echo MERGED_JAX_REQUIRE=$MERGED_JAX_REQUIRE
# unpack all single jax versions wheels in the same directory
mkdir dist/unpacked
find dist -name "*.whl" -print -exec python -m wheel unpack --dest dist/unpacked/ {} ';'
sed -i "s/Requires-Dist: jax.*/$MERGED_JAX_REQUIRE/" dist/unpacked/sphericart_jax-*/sphericart_jax-*.dist-info/METADATA
echo "\n\n METADATA = \n\n"
cat dist/unpacked/sphericart_jax-*/sphericart_jax-*.dist-info/METADATA
# check the right metadata was added to the file. grep will exit with
# code `1` if the line is not found, which will stop CI
grep "$MERGED_JAX_REQUIRE" dist/unpacked/sphericart_jax-*/sphericart_jax-*.dist-info/METADATA
# repack the directory as a new wheel
mkdir wheelhouse
python -m wheel pack --dest wheelhouse/ dist/unpacked/*
- name: check wheels with twine
run: twine check wheelhouse/*
- uses: actions/upload-artifact@v4
with:
name: sphericart-jax-wheel-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
- name: upload to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
./wheelhouse/*.whl
prerelease: ${{ contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}