Skip to content

Merge pull request #75 from astro-informatics/numpy #239

Merge pull request #75 from astro-informatics/numpy

Merge pull request #75 from astro-informatics/numpy #239

Workflow file for this run

name: Python Build
"on":
push:
branches: ["main"]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:
jobs:
from-sdist:
name: python source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install build packages and pytest
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install "conan<2" scikit-build pytest cython numpy>=2
- name: Create sdist
run: python setup.py sdist
- name: Install pyssht
run: "pip install dist/pyssht-*.tar.gz"
- name: run pytest
run: pytest tests/test_pyssht.py
- uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
path: ./dist/*.tar.gz
name: source-distribution
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: ${{ matrix.python-version }}
- name: Setup environment
run: |
python -m pip install --upgrade pip wheel
python -m pip install "conan<2" pytest ducc0
conan profile new default --detect
- name: Build wheels
run: pip wheel . --use-pep517 --no-deps -w dist
- name: install wheel
run: "pip install dist/*.whl"
- name: run pytests
run: pytest tests
- uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
path: ./dist/*.whl
name: wheel-${{matrix.os}}-${{matrix.python-version}}
publication:
name: publish to pypi
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
needs: [build_wheels, from-sdist]
steps:
- name: Download wheels and sdist
uses: actions/download-artifact@v2
- name: Move wheels and source distribution to dist/
run: |
mkdir -p dist
mv source-distribution/*.tar.gz wheel-*/*.whl dist
- name: Publish distribution 📦 to Test PyPI
if: ${{ github.ref != 'refs/tags/v1.5.2' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: ${{ github.ref == 'refs/tags/v1.5.2' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_TOKEN }}