Skip to content

Use miniforge for gsl install and install other dependencies via pip #1064

Use miniforge for gsl install and install other dependencies via pip

Use miniforge for gsl install and install other dependencies via pip #1064

Workflow file for this run

name: Build and publish to TestPyPI or PyPI
on: [push, pull_request]
jobs:
get_python_versions:
name: "Determine Python versions"
runs-on: ubuntu-latest
outputs:
min-python: ${{ steps.nep29.outputs.min-python }}
max-python: ${{ steps.nep29.outputs.max-python }}
steps:
- name: "calculate versions according to NEP29"
id: nep29
uses: mstimberg/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: [get_python_versions]
name: Build 🎡 on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest, macOS-12, macOS-14 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.5
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_PROJECT_REQUIRES_PYTHON: ">=${{ needs.get_python_versions.outputs.min-python }}"
CIBW_ARCHS: auto64
# Do not build for PyPy
CIBW_SKIP: 'pp*'
CIBW_TEST_COMMAND: python {project}/dev/continuous-integration/run_simple_test.py
CIBW_TEST_REQUIRES: pytest
- name: store distribution 📦
uses: actions/upload-artifact@v3
with:
name: packages
path: dist
build-linux:
needs: [get_python_versions]
name: Build ${{ matrix.arch }} 🎡 and source 📦 on Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [ auto64, aarch64 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build source tarball
run: |
python -m pip install --upgrade pip build
python -m pip install "cython>=0.29" oldest-supported-numpy "setuptools>=61" "setuptools_scm[toml]>=6.2"
python -m build --sdist --config-setting=--formats=gztar --config-setting=--with-cython --config-setting=--fail-on-error
if: ${{ matrix.arch == 'auto64' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.5
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_PROJECT_REQUIRES_PYTHON: ">=${{ needs.get_python_versions.outputs.min-python }}"
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_SKIP: 'pp* *-musllinux_aarch64'
CIBW_TEST_COMMAND: python {project}/dev/continuous-integration/run_simple_test.py
CIBW_TEST_REQUIRES: pytest
- name: store distribution 📦
uses: actions/upload-artifact@v3
with:
name: packages
path: dist
deploy_dev:
name: Publish development 📦 to TestPyPI
runs-on: ubuntu-latest
if: github.repository == 'brian-team/brian2' && github.ref == 'refs/heads/master'
environment: development_release
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
needs:
- build
- build-linux
steps:
- name: load distribution 📦
uses: actions/download-artifact@v3
with:
name: packages
path: dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
deploy:
name: Publish release 📦 to PyPI
runs-on: ubuntu-latest
if: github.repository == 'brian-team/brian2' && startsWith(github.ref, 'refs/tags')
environment: release
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
needs:
- build
- build-linux
steps:
- name: load distribution 📦
uses: actions/download-artifact@v3
with:
name: packages
path: dist/
- name: Publish distribution release 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1