Skip to content

Wheels

Wheels #233

Workflow file for this run

# Workflow to build
name: Wheels
on:
schedule:
# Nightly build at midnight.
- cron: "0 0 */1 * *"
push:
branches:
- "**"
# Release branches
- "[0-9]+.[0-9]+.[0-9]"
pull_request:
branches:
- "**"
- "[0-9]+.[0-9]+.[0-9]"
# Manual run
workflow_dispatch:
jobs:
# Check whether to build the wheels and the source tarball
check_build_trigger:
name: Check build trigger
runs-on: ubuntu-latest
if: github.repository == 'LibRapid/librapid'
outputs:
build: ${{ steps.check_build_trigger.outputs.build }}
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- id: check_build_trigger
name: Check build trigger
run: bash build_tools/check_build_trigger.sh
# Ensure all tests pass on Linux
run_linux_tests:
name: Run Linux Tests
runs-on: ubuntu-latest
needs: check_build_trigger
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
# Download an OpenBLAS build
- name: Download OpenBLAS Build
uses: dawidd6/action-download-artifact@v2
with:
workflow: build-openblas.yaml
workflow_conclusion: success
name: OpenBLAS on ubuntu-latest
path: src/librapid/openblas_install
- name: Build LibRapid
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_USE_MULTIPREC=on
cmake --build . --config Release
ctest -C Release -VV
env:
LIBRAPID_NO_ARCH: yes
# Ensure all tests pass on MacOS (GCC)
run_macos_tests:
name: Run MacOS Tests (GCC)
runs-on: macos-latest
needs: check_build_trigger
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
# Download an OpenBLAS build
- name: Download OpenBLAS Build
uses: dawidd6/action-download-artifact@v2
with:
workflow: build-openblas.yaml
workflow_conclusion: success
name: OpenBLAS on macos-latest
path: src/librapid/openblas_install
- name: Build LibRapid
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_USE_MULTIPREC=on
cmake --build . --config Release
ctest -C Release -VV
env:
CC: gcc-11
CXX: g++-11
LIBRAPID_NO_ARCH: yes
# Ensure all tests pass on Windows
run_windows_tests:
name: Run Windows Tests
runs-on: windows-latest
needs: check_build_trigger
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ steps.extract_branch.outputs.branch }}
# - name: Set Up WSL
# uses: Vampire/setup-wsl@v1.2.0
- name: Set Up Miniconda
uses: conda-incubator/setup-miniconda@v2.1.1
- name: Set Up Visual Studio shell
uses: egor-tensin/vs-shell@v2
- name: Install Conda things
run: |
conda config --add channels conda-forge --force
conda config --set auto_update_conda false
conda install --yes --quiet clangdev cmake ninja flang=11.0.1
# Download an OpenBLAS build
- name: Download OpenBLAS Build
uses: dawidd6/action-download-artifact@v2
with:
workflow: build-openblas.yaml
workflow_conclusion: success
name: OpenBLAS on windows-latest
path: src/librapid/openblas_install
- name: Build LibRapid
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_USE_MULTIPREC=on
cmake --build . --config Release
ctest -C Release -VV
env:
LIBRAPID_NO_ARCH: yes
# Build the wheels for Linux, Windows and macOS for CPython 3.7 and newer
build_wheels:
name: Build wheel for ${{ matrix.cppp }}${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
runs-on: ${{ matrix.os }}
needs: [run_linux_tests, run_macos_tests, run_windows_tests]
if: needs.check_build_trigger.outputs.build
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
include:
# Window 64 bit
- os: windows-latest
python: 37
bitness: 64
platform_id: win_amd64
use_openblas: true
cppp: "cp"
- os: windows-latest
python: 38
bitness: 64
platform_id: win_amd64
use_openblas: true
cppp: "cp"
- os: windows-latest
python: 39
bitness: 64
platform_id: win_amd64
use_openblas: true
cppp: "cp"
- os: windows-latest
python: 310
bitness: 64
platform_id: win_amd64
use_openblas: true
cppp: "cp"
# Window 32 bit
- os: windows-latest
python: 37
bitness: 32
platform_id: win32
use_openblas: false
cppp: "cp"
- os: windows-latest
python: 38
bitness: 32
platform_id: win32
use_openblas: false
cppp: "cp"
- os: windows-latest
python: 39
bitness: 32
platform_id: win32
use_openblas: false
cppp: "cp"
# Linux 64 bit manylinux2014
- os: ubuntu-latest
python: 37
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
use_openblas: true
cppp: "cp"
- os: ubuntu-latest
python: 38
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
use_openblas: true
cppp: "cp"
- os: ubuntu-latest
python: 39
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
use_openblas: true
cppp: "cp"
- os: ubuntu-latest
python: 310
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
use_openblas: true
cppp: "cp"
# MacOS x86_64
- os: macos-latest
python: 37
bitness: 64
platform_id: macosx_x86_64
use_openblas: true
cppp: "cp"
- os: macos-latest
python: 38
bitness: 64
platform_id: macosx_x86_64
use_openblas: true
cppp: "cp"
- os: macos-latest
python: 39
bitness: 64
platform_id: macosx_x86_64
use_openblas: true
cppp: "cp"
- os: macos-latest
python: 310
bitness: 64
platform_id: macosx_x86_64
use_openblas: true
cppp: "cp"
# PyPy on Windows
- os: windows-latest
python: 37
bitness: 64
platform_id: win_amd64
use_openblas: true
cppp: "pp"
- os: windows-latest
python: 38
bitness: 64
platform_id: win_amd64
use_openblas: true
cppp: "pp"
- os: windows-latest
python: 39
bitness: 64
platform_id: win_amd64
use_openblas: true
cppp: "pp"
# PyPy on MacOS
- os: macos-latest
python: 37
bitness: 64
platform_id: macosx_x86_64
use_openblas: true
cppp: "pp"
- os: macos-latest
python: 38
bitness: 64
platform_id: macosx_x86_64
use_openblas: true
cppp: "pp"
- os: macos-latest
python: 39
bitness: 64
platform_id: macosx_x86_64
use_openblas: true
cppp: "pp"
# PyPy on Linux
- os: ubuntu-latest
python: 37
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
use_openblas: true
cppp: "pp"
- os: ubuntu-latest
python: 38
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
use_openblas: true
cppp: "pp"
- os: ubuntu-latest
python: 39
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
use_openblas: true
cppp: "pp"
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Requirements
run: pip install -r requirements.txt
- name: Clone OpenBLAS Build
if: ${{ matrix.use_openblas }}
uses: dawidd6/action-download-artifact@v2
with:
workflow: build-openblas.yaml
workflow_conclusion: success
name: OpenBLAS on ${{ matrix.os }}
path: src/librapid/openblas_install
- name: Build Wheels
if: runner.os == 'macOS'
env:
CIBW_BUILD: ${{ matrix.cppp }}${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_PYPY_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_BUILD_VERBOSITY: 1
CC: gcc-11
CXX: g++-11
CMAKE_BUILD_PARALLEL_LEVEL: 1
LIBRAPID_CI_BUILD: true
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: Build Wheels
if: runner.os != 'macOS'
env:
CIBW_BUILD: ${{ matrix.cppp }}${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_PYPY_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_BUILD_VERBOSITY: 1
CMAKE_BUILD_PARALLEL_LEVEL: 1
LIBRAPID_CI_BUILD: true
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: Store Artifacts
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
# To uncomment: remove hash -- no space after!!!
# # Build the wheels for Linux and Windows with CUDA support
# build_wheels_cuda:
# name: Build wheel for ${{ matrix.cppp }}${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}-cuda${{ matrix.cuda_version }}
# runs-on: ${{ matrix.os }}
# needs: [run_linux_tests, run_macos_tests, run_windows_tests]
# if: needs.check_build_trigger.outputs.build
#
# strategy:
# # Ensure that a wheel builder finishes even if another fails
# fail-fast: false
# matrix:
# include:
# # Window 64 bit
# - os: windows-latest
# python: 37
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.4.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 37
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.5.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 37
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.6.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 37
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.7.0"
# use_openblas: true
# cppp: "cp"
#
# - os: windows-latest
# python: 38
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.4.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 38
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.5.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 38
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.6.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 38
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.7.0"
# use_openblas: true
# cppp: "cp"
#
# - os: windows-latest
# python: 39
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.4.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 39
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.5.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 39
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.6.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 39
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.7.0"
# use_openblas: true
# cppp: "cp"
#
# - os: windows-latest
# python: 310
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.4.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 310
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.5.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 310
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.6.0"
# use_openblas: true
# cppp: "cp"
# - os: windows-latest
# python: 310
# bitness: 64
# platform_id: win_amd64
# cuda_version: "11.7.0"
# use_openblas: true
# cppp: "cp"
#
# steps:
# - name: Checkout LibRapid
# uses: actions/checkout@v3
# with:
# submodules: recursive
#
# - name: Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.9" # update once build dependencies are available
#
# - name: Install Requirements
# run: pip install -r requirements.txt
#
# - name: Clone OpenBLAS Build
# if: ${{ matrix.use_openblas }}
# uses: dawidd6/action-download-artifact@v2
# with:
# workflow: build-openblas.yaml
# workflow_conclusion: success
# name: OpenBLAS on ${{ matrix.os }}
# path: src/librapid/openblas_install
#
# - name: Install CUDA-Toolkit
# uses: Jimver/cuda-toolkit@v0.2.8
# with:
# cuda: ${{ matrix.cuda_version }}
#
# - name: Build Wheels
# env:
# CIBW_BUILD: ${{ matrix.cppp }}${{ matrix.python }}-${{ matrix.platform_id }}
# CIBW_ARCHS: all
# CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
# CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
# CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux_image }}
# CIBW_MANYLINUX_PYPY_I686_IMAGE: ${{ matrix.manylinux_image }}
# CIBW_TEST_SKIP: "*-macosx_arm64"
# CIBW_BUILD_VERBOSITY: 1
# CMAKE_BUILD_PARALLEL_LEVEL: 1
# LIBRAPID_CUDA_WHEEL: ${{ matrix.cuda_version }}
# LIBRAPID_CI_BUILD: true
#
# run: |
# python -m pip install cibuildwheel
# python -m cibuildwheel --output-dir wheelhouse
#
# - name: Store Artifacts
# uses: actions/upload-artifact@v3
# with:
# path: wheelhouse/*.whl
# Build the source distribution under Linux
build_sdist:
name: Source Distribution
runs-on: ubuntu-latest
needs: [run_linux_tests, run_macos_tests, run_windows_tests]
if: needs.check_build_trigger.outputs.build
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # update once build dependencies are available
- name: Install Requirements
run: pip install -r requirements.txt
- name: Build Source Distribution
run: |
python setup.py sdist
twine check dist/*.tar.gz
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
# Upload the wheels and the source distribution
upload_artifacts:
name: Upload to PyPi
runs-on: ubuntu-latest
# needs: [build_wheels, build_wheels_cuda, build_sdist]
needs: [build_wheels, build_sdist]
# The artifacts cannot be uploaded on PRs
if: github.event_name != 'pull_request'
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: dist
- name: Setup Python
uses: actions/setup-python@v4
- name: Install Requirements
run: pip install -r requirements.txt
- name: Upload Artifacts
continue-on-error: true
run: |
ls dist
twine upload --skip-existing dist/artifact/* -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }}