Try and fix publishing packages from CI #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | |
# Only cancels-in-progress on PRs (head_ref only defined in PR, fallback run_id always unique) | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-24.04, macos-12, windows-2022 ] | |
python-version: [ 3.9, "3.10", "3.11", "3.12" ] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge,anaconda | |
- name: Install | |
# scipy and numpy versions are chosen to match cvxpy | |
run: | | |
pip install cvxpy | |
python -m pip install . | |
- name: Test | |
run: | | |
pytest | |
rm -rf build/ | |
build_wheels: | |
needs: build | |
if: ${{github.event_name == 'push'}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-24.04, macos-12, windows-2022 ] | |
python-version: [ 3.9, "3.10", "3.11", "3.12" ] | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/checkout@v4 | |
- name: build | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
run: | | |
pip install --upgrade build | |
python -m build | |
- name: publish | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |