Skip to content

feat: add support for rsfitsio as backend #824

feat: add support for rsfitsio as backend

feat: add support for rsfitsio as backend #824

Workflow file for this run

# this is based on the wheel workflow in GalSim, but adapted to our needs
name: build wheels and sdist
on:
workflow_dispatch:
inputs:
ref:
description: 'The git ref to build wheels for. This will trigger a pypi upload.'
default: ''
required: false
type: string
cibw_skip:
description: 'Python versions to skip when building wheels.'
default: 'cp36* cp37* pp* cp38* cp39*'
required: false
type: string
pull_request: null
release:
types:
- published
concurrency:
group: pypi
cancel-in-progress: false
env:
PYVER: '3.11'
CIBW_SKIP_VAL: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.cibw_skip || 'cp36* cp37* pp* cp38* cp39*' }}
jobs:
linux-manylinux:
name: linux-manylinux
runs-on: ubuntu-latest
steps:
- name: free disk space
uses: endersonmenezes/free-disk-space@v3
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
rm_cmd: "rmz"
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || '' }}
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_BUILD: "*manylinux*"
CIBW_ARCHS: auto64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# I think yum might always work here. But leave all options available.
CIBW_BEFORE_ALL: yum install -y bzip2-devel || apt-get install libbz2-dev || apk add --upgrade bzip2-dev
- name: test wheel for python ${{ env.PYVER }}
run: |
pystr='${{ env.PYVER }}'
pystr=${pystr//./}
whl=$(ls ./wheelhouse/*cp${pystr}*.whl)
python -m pip install --upgrade pip
pip install "${whl}[dev]"
pytest --pyargs fitsio --parallel-threads 4 --iterations 4
- uses: actions/upload-artifact@v7
with:
name: whl-linux
path: ./wheelhouse/*.whl
linux-musl:
name: linux-musl
runs-on: ubuntu-latest
steps:
- name: free disk space
uses: endersonmenezes/free-disk-space@v3
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
rm_cmd: "rmz"
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || '' }}
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_BUILD: "*musllinux*"
CIBW_ARCHS: auto64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# I think musl always uses apk, but keep all options available.
CIBW_BEFORE_ALL: yum install -y bzip2-devel || apt-get install libbz2-dev || apk add --upgrade bzip2-dev
CIBW_ENVIRONMENT: 'CFLAGS="-Wno-implicit-function-declaration -Wno-int-conversion"'
- uses: jirutka/setup-alpine@v1
with:
packages: "bzip2-dev python3 py3-pip py3-numpy"
- name: test wheel for python
shell: alpine.sh {0}
run: |
python --version
pystr=$(python --version | cut -d' ' -f 2 | cut -d'.' -f 1)$(python --version | cut -d' ' -f 2 | cut -d'.' -f 2)
whl=$(ls ./wheelhouse/*cp${pystr}-musl*.whl)
mkdir test-venv
python3 -m venv test-venv
. test-venv/bin/activate
python -m pip install --upgrade pip
pip install "${whl}[dev]"
pytest --pyargs fitsio --parallel-threads 4 --iterations 4
deactivate
- uses: actions/upload-artifact@v7
with:
name: whl-musl
path: ./wheelhouse/*.whl
osx-intel:
name: osx-intel
runs-on: macos-15-intel
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || '' }}
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_BUILD: "*macosx*"
CIBW_ARCHS: auto64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# CIBW_BEFORE_ALL: brew install fftw || true
CIBW_ENVIRONMENT: >-
MACOSX_DEPLOYMENT_TARGET=13.0
- name: test wheel for python ${{ env.PYVER }}
run: |
pystr='${{ env.PYVER }}'
pystr=${pystr//./}
whl=$(ls ./wheelhouse/*cp${pystr}*.whl)
python -m pip install --upgrade pip
pip install "${whl}[dev]"
pytest --pyargs fitsio --parallel-threads 4 --iterations 4
- uses: actions/upload-artifact@v7
with:
name: whl-macos
path: ./wheelhouse/*.whl
osx-arm:
name: osx-arm
runs-on: macos-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || '' }}
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_BUILD: "*macosx*"
CIBW_ARCHS: arm64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# CIBW_BEFORE_ALL: brew install llvm libomp fftw eigen
CIBW_ENVIRONMENT: >-
MACOSX_DEPLOYMENT_TARGET=14.7
- name: test wheel for python ${{ env.PYVER }}
run: |
pystr='${{ env.PYVER }}'
pystr=${pystr//./}
whl=$(ls ./wheelhouse/*cp${pystr}*.whl)
python -m pip install --upgrade pip
pip install "${whl}[dev]"
pytest --pyargs fitsio --parallel-threads 4 --iterations 4
- uses: actions/upload-artifact@v7
with:
name: whl-arm
path: ./wheelhouse/*.whl
win-amd64:
name: win-amd64
runs-on: windows-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || '' }}
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '${{ env.PYVER }}'
- name: make nmake available
uses: ilammy/msvc-dev-cmd@v1
- name: build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_BUILD: "*win_amd64*"
CIBW_ARCHS: auto64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
- name: test wheel for python ${{ env.PYVER }}
shell: cmd
run: |
set pystr=${{ env.PYVER }}
set pystr=%pystr:.=%
echo python version string is %pystr%
if errorlevel 1 exit 1
python -m pip install --upgrade pip
if errorlevel 1 exit 1
for %%f in (.\wheelhouse\*cp%pystr%*.whl) do pip install %%f[dev]
if errorlevel 1 exit 1
pytest --pyargs fitsio
if errorlevel 1 exit 1
- uses: actions/upload-artifact@v7
with:
name: whl-win-amd64
path: ./wheelhouse/*.whl
sdist:
name: sdist
needs: [linux-manylinux, linux-musl, osx-intel, osx-arm, win-amd64]
# Just need to build sdist on a single machine
runs-on: ubuntu-latest
steps:
- name: free disk space
uses: endersonmenezes/free-disk-space@v3
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
rm_cmd: "rmz"
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || '' }}
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '${{ env.PYVER }}'
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U build
- name: download wheels
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: ./wheels
pattern: whl-*
merge-multiple: true
- name: build sdist
run: |
python -m build --sdist .
ls -l dist
tar tvfz dist/*.tar.gz
- name: copy wheels to dist
run: |
echo ls -l wheels
ls -l wheels
cp wheels/*.whl dist
echo ls -l dist
ls -l dist
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
with:
verbose: true
skip-existing: true
password: ${{ secrets.PYPI_API_TOKEN }}