Skip to content

fix python packaging #118

fix python packaging

fix python packaging #118

name: Python tests
on:
push:
tags-ignore:
- '**'
branches:
- '**'
pull_request:
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
test:
name: Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macOS-14]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
exclude:
- os: macOS-14
python-version: 3.8
- os: macOS-14
python-version: 3.9
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: (macos) install automake and autoconf
if: ${{ startsWith(matrix.os, 'macOS') }}
run: |
brew install automake autoconf
- name: Install stable minimal toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- name: install cfitsio
env:
# TODO: CFITSIO_VERSION: 4.4.0
CFITSIO_VERSION: 3.49
run: |
cd /tmp
curl "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-${CFITSIO_VERSION}.tar.gz" -o cfitsio.tar.gz
tar -xf cfitsio.tar.gz
rm cfitsio.tar.gz
cd cfitsio-${CFITSIO_VERSION}
./configure --prefix=/usr/local --enable-reentrant --disable-curl
sudo make shared
sudo make install
cd ..
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo ldconfig
fi
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run rust tests to generate test data
run: cargo test --features=cfitsio-static
- name: Setup python environment and run pytests
run: |
pip3 install --upgrade pip
python3 -m venv env
source env/bin/activate
pip3 install --upgrade pip
pip3 install maturin
maturin develop --features=python,cfitsio-static --strip
pip3 install pytest
pytest