name: Wheel
on:
push:
tags:
- v*
jobs:
build_python:
name: build python bindings on ${{ matrix.platform || matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos
- ubuntu
- windows
include:
- os: ubuntu
platform: linux
testvec_path: satkit-testvecs
data_path: astro-data
- os: windows
ls: dir
testvec_path: satkit-testvecs
data_path: astro-data
- os: macos
testvec_path: satkit-testvecs
data_path: astro-data
runs-on: ${{ format('{0}-latest', matrix.os) }}
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v5
- name: install python packages necessary for build
run: pip install -U setuptools wheel build
- name: set up rust
if: matrix.os != 'ubuntu'
uses: dtolnay/rust-toolchain@stable
- name: Cache Satkit Data
id: cache-satkit-data
uses: actions/cache@v4
with:
path: ${{matrix.data_path}}
enableCrossOsArchive: True
key: satkit-data-cache
- name: Download Satkit Data
if: steps.cache-satkit-data.outputs.cache-hit != 'true'
run: |
pip install requests
python python/test/download_data.py ${{matrix.data_path}}
- name: Cache Satkit Test Vectors
id: cache-satkit-testvecs
uses: actions/cache@v4
with:
path: ${{matrix.testvec_path}}
enableCrossOsArchive: True
key: satkit-testvecs-cache
- name: Download Satkit Test Vectors
if: steps.cache-satkit-testvecs.outputs.cache-hit != 'true'
run: |
pip install requests
python python/test/download_testvecs.py ${{matrix.testvec_path}}
- name: Build ${{ matrix.platform || matrix.os }} wheels
uses: pypa/cibuildwheel@v2.21.3
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- name: Create sdist
if: matrix.os == 'ubuntu'
run: python -m build --sdist . -o wheelhouse
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*
publish_wheels:
needs: build_python
runs-on: ubuntu-latest
environment: PyPiPublish
permissions:
id-token: write steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: cibw-wheels-*
merge-multiple: true
- name: Publish packages to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/