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

Try and fix publishing packages from CI #66

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 15 additions & 66 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, macos-12, windows-2022 ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
os: [ ubuntu-24.04, macos-12, windows-2022 ]
python-version: [ 3.9, "3.10", "3.11", "3.12" ]

env:
PYTHON_VERSION: ${{ matrix.python-version }}
Expand All @@ -40,16 +40,7 @@ jobs:
- name: Install
# scipy and numpy versions are chosen to match cvxpy
run: |
if [[ "$PYTHON_VERSION" == "3.8" ]]; then
conda install scipy=1.5 numpy=1.17 mkl scs pytest pip
elif [[ "$PYTHON_VERSION" == "3.9" ]]; then
conda install scipy=1.5 numpy=1.19 mkl scs pytest pip
elif [[ "$PYTHON_VERSION" == "3.10" ]]; then
conda install scipy=1.7 numpy=1.21 mkl scs pytest pip
elif [[ "$PYTHON_VERSION" == "3.11" ]]; then
conda install scipy=1.9.3 numpy=1.23.4 mkl scs pytest pip
fi
pip install cvxpy
pip install cvxpy pytest
python -m pip install .

- name: Test
Expand All @@ -64,65 +55,23 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, macos-12, windows-2022 ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
include:
- os: ubuntu-20.04
python-version: 3.8
single_action_config: "True"
- os: macos-12
python-version: 3.8
- os: windows-2019
python-version: 3.8

env:
RUNNER_OS: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
SINGLE_ACTION_CONFIG: "${{ matrix.single_action_config == 'True' }}"
PYPI_SERVER: ${{ secrets.PYPI_SERVER }}
PYPI_USER: ${{ secrets.PYPI_USER }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
os: [ ubuntu-24.04, macos-12, windows-2022 ]
python-version: [ 3.9, "3.10", "3.11", "3.12" ]

steps:

- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set Additional Envs
shell: bash
run: |
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV
echo "DEPLOY_PYPI_SOURCE=$( [[ $PYTHON_VERSION == 3.8 && $RUNNER_OS == 'macOS' ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV
echo "DEPLOY=$( [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/tags'* ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV

- name: Build wheels
env:
CIBW_BUILD: "cp3${{env.PYTHON_SUBVERSION}}-*"
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_ARCHS_LINUX: auto aarch64
uses: pypa/[email protected]

- name: Build source
if: ${{env.DEPLOY_PYPI_SOURCE == 'True'}}
run: |
python setup.py sdist --dist-dir=wheelhouse

- name: Check wheels
shell: bash
run: |
python -m pip install --upgrade twine
twine check wheelhouse/*

- name: Release to pypi
if: ${{env.DEPLOY == 'True'}}
shell: bash
- uses: actions/checkout@v4
- name: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
twine upload --skip-existing --repository-url $PYPI_SERVER wheelhouse/* -u $PYPI_USER -p $PYPI_PASSWORD
pip install --upgrade build
python -m build

- name: Upload artifacts to github
uses: actions/upload-artifact@v3
- name: publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
name: wheels
path: ./wheelhouse
password: ${{ secrets.PYPI_API_TOKEN }}
Loading