sortednp #36
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: sortednp | |
on: | |
workflow_dispatch: | |
inputs: | |
sortednpVersion: | |
description: "sortednp version" | |
required: true | |
default: "0.5.0" | |
numpyVersion: | |
description: "numpy version" | |
required: true | |
default: "2.0" | |
cibwVersion: | |
description: "cibuildwheel version" | |
default: "2.12.3" | |
newVersionTag: | |
description: "The name/tag of the version published" | |
required: true | |
default: "0.5.0.1" | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" | |
SORTEDNP_VERSION: ${{ inputs.sortednpVersion }} | |
NUMPY_VERSION: ${{ inputs.numpyVersion }} | |
CIBW_VERSION: ${{ inputs.cibwVersion }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download sortednp | |
run: | | |
git clone https://gitlab.sauerburger.com/frank/sortednp.git \ | |
--branch "release-${SORTEDNP_VERSION}" --single-branch | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Patch Numpy version Linux | |
if: ${{ matrix.os == 'ubuntu-latest'}} | |
run: | | |
cd sortednp | |
sed -i 's/.*numpy>.*/ install_requires=["numpy>=${{ inputs.numpyVersion }}"],/g' setup.py | |
sed -i 's/.*version=.*/ version="${{ inputs.newVersionTag }}",/g' setup.py | |
sed -i 's/.*__version__=.*/__version__ = "${{ inputs.newVersionTag }}"/g' src/sortednp/__init__.py | |
cat setup.py | |
cat src/sortednp/__init__.py | |
sed -i "s/oldest-supported-numpy/numpy>=${{ inputs.numpyVersion }}/g" pyproject.toml | |
cat pyproject.toml | |
- name: Patch Numpy version MacOS | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
cd sortednp | |
sed -i '' 's/.*numpy>.*/ install_requires=["numpy>=${{ inputs.numpyVersion }}"],/g' setup.py | |
sed -i '' 's/.*version=.*/ version="${{ inputs.newVersionTag }}",/g' setup.py | |
sed -i '' 's/.*__version__=.*/__version__ = "${{ inputs.newVersionTag }}"/g' src/sortednp/__init__.py | |
cat setup.py | |
cat src/sortednp/__init__.py | |
sed -i '' 's/oldest-supported-numpy/numpy>=${{ inputs.numpyVersion }}/g' pyproject.toml | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==${CIBW_VERSION} | |
- name: Build wheels | |
env: | |
CIBW_SKIP: "*-musllinux*" | |
CIBW_ARCHS_MACOS: "universal2" | |
CIBW_ARCHS_LINUX: "x86_64" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
run: | | |
cd sortednp | |
CIBW_BEFORE_BUILD="pip install numpy==${NUMPY_VERSION}" \ | |
python -m cibuildwheel --output-dir wheelhouse | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./sortednp/wheelhouse/*.whl | |
publish: | |
name: Publish wheels to pypi.scm.io | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get wheels | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: Publish to pypy.scm.io | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: ${{ secrets.PYPI_SCM_USERNAME }} | |
password: ${{ secrets.PYPI_SCM_PASSWORD }} | |
repository-url: https://pypi.scm.io/simple/ | |
skip-existing: true |