Skip to content

Commit 476faf2

Browse files
authored
Merge branch 'cvxgrp:master' into master
2 parents c73b116 + a3333e3 commit 476faf2

2 files changed

Lines changed: 47 additions & 68 deletions

File tree

.github/workflows/build.yml

Lines changed: 44 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
os: [ ubuntu-20.04, macos-12, windows-2022 ]
28-
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
27+
os: [ ubuntu-24.04, macos-12, windows-2022 ]
28+
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
2929

3030
env:
3131
PYTHON_VERSION: ${{ matrix.python-version }}
@@ -40,16 +40,7 @@ jobs:
4040
- name: Install
4141
# scipy and numpy versions are chosen to match cvxpy
4242
run: |
43-
if [[ "$PYTHON_VERSION" == "3.8" ]]; then
44-
conda install scipy=1.5 numpy=1.17 mkl scs pytest pip
45-
elif [[ "$PYTHON_VERSION" == "3.9" ]]; then
46-
conda install scipy=1.5 numpy=1.19 mkl scs pytest pip
47-
elif [[ "$PYTHON_VERSION" == "3.10" ]]; then
48-
conda install scipy=1.7 numpy=1.21 mkl scs pytest pip
49-
elif [[ "$PYTHON_VERSION" == "3.11" ]]; then
50-
conda install scipy=1.9.3 numpy=1.23.4 mkl scs pytest pip
51-
fi
52-
pip install cvxpy
43+
pip install cvxpy pytest
5344
python -m pip install .
5445
5546
- name: Test
@@ -58,71 +49,57 @@ jobs:
5849
rm -rf build/
5950
6051
build_wheels:
61-
needs: build
62-
if: ${{github.event_name == 'push'}}
52+
name: Build wheels on ${{ matrix.os }}
6353
runs-on: ${{ matrix.os }}
6454
strategy:
65-
fail-fast: false
6655
matrix:
67-
os: [ ubuntu-20.04, macos-12, windows-2022 ]
68-
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
69-
include:
70-
- os: ubuntu-20.04
71-
python-version: 3.8
72-
single_action_config: "True"
73-
- os: macos-12
74-
python-version: 3.8
75-
- os: windows-2019
76-
python-version: 3.8
77-
78-
env:
79-
RUNNER_OS: ${{ matrix.os }}
80-
PYTHON_VERSION: ${{ matrix.python-version }}
81-
SINGLE_ACTION_CONFIG: "${{ matrix.single_action_config == 'True' }}"
82-
PYPI_SERVER: ${{ secrets.PYPI_SERVER }}
83-
PYPI_USER: ${{ secrets.PYPI_USER }}
84-
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
56+
# macos-13 is an intel runner, macos-14 is apple silicon
57+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
8558

8659
steps:
87-
8860
- uses: actions/checkout@v4
89-
- uses: actions/setup-python@v4
90-
with:
91-
python-version: ${{ matrix.python-version }}
92-
- name: Set Additional Envs
93-
shell: bash
61+
- name: Install
9462
run: |
95-
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV
96-
echo "DEPLOY_PYPI_SOURCE=$( [[ $PYTHON_VERSION == 3.8 && $RUNNER_OS == 'macOS' ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV
97-
echo "DEPLOY=$( [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/tags'* ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV
63+
pip install numpy scipy cvxpy pytest
9864
9965
- name: Build wheels
100-
env:
101-
CIBW_BUILD: "cp3${{env.PYTHON_SUBVERSION}}-*"
102-
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
103-
CIBW_ARCHS_MACOS: x86_64 universal2
104-
CIBW_ARCHS_LINUX: auto aarch64
105-
uses: pypa/cibuildwheel@v2.16.2
106-
107-
- name: Build source
108-
if: ${{env.DEPLOY_PYPI_SOURCE == 'True'}}
109-
run: |
110-
python setup.py sdist --dist-dir=wheelhouse
66+
uses: pypa/cibuildwheel@v2.20.0
11167

112-
- name: Check wheels
113-
shell: bash
114-
run: |
115-
python -m pip install --upgrade twine
116-
twine check wheelhouse/*
68+
- uses: actions/upload-artifact@v4
69+
with:
70+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
71+
path: ./wheelhouse/*.whl
11772

118-
- name: Release to pypi
119-
if: ${{env.DEPLOY == 'True'}}
120-
shell: bash
121-
run: |
122-
twine upload --skip-existing --repository-url $PYPI_SERVER wheelhouse/* -u $PYPI_USER -p $PYPI_PASSWORD
73+
build_sdist:
74+
name: Build source distribution
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Build sdist
80+
run: pipx run build --sdist
81+
82+
- uses: actions/upload-artifact@v4
83+
with:
84+
name: cibw-sdist
85+
path: dist/*.tar.gz
86+
87+
upload_pypi:
88+
needs: [build_wheels, build_sdist]
89+
runs-on: ubuntu-latest
90+
environment: pypi
91+
permissions:
92+
id-token: write
93+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
94+
steps:
95+
- uses: actions/download-artifact@v4
96+
with:
97+
# unpacks all CIBW artifacts into dist/
98+
pattern: cibw-*
99+
path: dist
100+
merge-multiple: true
123101

124-
- name: Upload artifacts to github
125-
uses: actions/upload-artifact@v3
102+
- uses: pypa/gh-action-pypi-publish@release/v1
126103
with:
127-
name: wheels
128-
path: ./wheelhouse
104+
verbose: true
105+
password: ${{ secrets.PYPI_API_TOKEN }}

diffcp/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from diffcp.cone_program import solve_and_derivative, \
44
solve_and_derivative_batch, \
5-
solve_and_derivative_internal, SolverError
5+
solve_and_derivative_internal, \
6+
solve_only_batch, solve_only, \
7+
solve_internal, SolverError
68
from diffcp.cones import ZERO, POS, SOC, PSD, EXP
79
from diffcp import utils

0 commit comments

Comments
 (0)