Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds wheels for linux/aarch64 #23

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
29 changes: 26 additions & 3 deletions .github/actions/setup_optimizers_linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ inputs:
CHECK_LICENSE:
description: "..."
required: true
ARCH:
description: "..."
required: true
type: choice
default: "X64"
options:
- "X64"
- "ARM64"

runs:
using: "composite"
Expand All @@ -36,28 +44,40 @@ runs:
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-

- if: ${{ steps.cache-installers-linux.outputs.cache-hit != 'true' }}
- if: ${{ steps.cache-installers-linux.outputs.cache-hit != 'true' && inputs.ARCH == 'X64' }}
shell: bash
name: Download Installers
run: |
curl -L -o ~/installers/gurobi.tar.gz https://packages.gurobi.com/11.0/gurobi11.0.0_linux64.tar.gz
curl -L -o ~/installers/copt.tar.gz https://pub.shanshu.ai/download/copt/7.1.4/linux64/CardinalOptimizer-7.1.4-lnx64.tar.gz
curl -L -o ~/installers/mosek.tar.bz2 https://download.mosek.com/stable/10.2.0/mosektoolslinux64x86.tar.bz2

- if: ${{ steps.cache-installers-linux.outputs.cache-hit != 'true' && inputs.ARCH == 'arm64' }}
shell: bash
name: Download Installers
run: |
curl -L -o ~/installers/gurobi.tar.gz https://packages.gurobi.com/11.0/gurobi11.0.3_armlinux64.tar.gz
# TODO fix copt link
curl -L -o ~/installers/copt.tar.gz https://pub.shanshu.ai/download/copt/7.1.4/linuxarm64/CardinalOptimizer-7.1.4-lnxarm64.tar.gz
curl -L -o ~/installers/mosek.tar.bz2 https://download.mosek.com/stable/10.2.3/mosektoolslinuxaarch64.tar.bz2

- name: Setup Gurobi Installation
shell: bash
env:
GUROBI_WLS: ${{ inputs.GUROBI_WLS }}
run: |
tar xfz ~/installers/gurobi.tar.gz -C ~/
ls ~/gurobi1100/linux64
# set environment variables
export GUROBI_HOME="${HOME}/gurobi1100/linux64"
if [[ ${{ inputs.ARCH }} == "ARM64" ]]; then
export GUROBI_HOME="${HOME}/gurobi1100/armlinux64"
fi
echo "GUROBI_HOME=${GUROBI_HOME}" >> $GITHUB_ENV
echo "PATH=${PATH}:${GUROBI_HOME}/bin" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib" >> $GITHUB_ENV
echo $GUROBI_HOME

ls $GUROBI_HOME

# setup license using secrets
echo "$GUROBI_WLS" > ~/gurobi.lic
echo "GRB_LICENSE_FILE=${HOME}/gurobi.lic" >> $GITHUB_ENV
Expand Down Expand Up @@ -99,6 +119,9 @@ runs:
ls ~/mosek
# set environment variables
export MOSEK_10_2_BINDIR="${HOME}/mosek/10.2/tools/platform/linux64x86/bin"
if [[ ${{ inputs.ARCH }} == "ARM64" ]]; then
export MOSEK_10_2_BINDIR="${HOME}/mosek/10.2/tools/platform/linuxaarch64/bin"
fi
echo "MOSEK_10_2_BINDIR=${MOSEK_10_1_BINDIR}" >> $GITHUB_ENV
echo "PATH=${PATH}:${MOSEK_10_2_BINDIR}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MOSEK_10_2_BINDIR}" >> $GITHUB_ENV
Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Build wheels
uses: pypa/[email protected]
env:
# Select wheels
CIBW_BUILD: "*-manylinux_x86_64 *-win_amd64 *-macosx_x86_64 *-macosx_arm64"
CIBW_SKIP: "cp36-* cp37-* pp* cp38-macosx_arm64"
CIBW_ARCHS: "native"
# use manylinux2014
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ENVIRONMENT_MACOS: >
MACOSX_DEPLOYMENT_TARGET=10.14
CIBW_TEST_COMMAND: "python -c \"import pyoptinterface as poi; print(dir(poi))\""
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"

- uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ cmake.build-type = "Release"
PYTHON_VERSION = { env = "PYTHON_VERSION", default = "3.8" }
CMAKE_FIND_DEBUG_MODE = "OFF"
ENABLE_TEST_MAIN = "OFF"

[tool.cibuildwheel]
test-command = 'python -c "import pyoptinterface as poi; print(dir(poi))"'
build = "*-manylinux_x86_64 *-manylinux_aarch64 *-win_amd64 *-macosx_x86_64 *-macosx_arm64"
skip = "cp36-* cp37-* pp* cp38-macosx_arm64"
archs = "native"
manylinux-x86_64-image = "quay.io/pypa/manylinux2014_x86_64"
manylinux-aarch64-image = "quay.io/pypa/manylinux2014_aarch64"
[tool.cibuildwheel.linux]
archs = ["x86_64", "aarch64"]
[tool.cibuildwheel.macos]
environment = { MACOSX_DEPLOYMENT_TARGET = "10.14" }