Bump version again so we can publish a release and test #10
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: Test and Publish to PyPI | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
release: | |
types: [published] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and run tests in Docker | |
run: | | |
docker build -t pyindi-client . | |
docker run --rm pyindi-client | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: test | |
if: github.event_name == 'release' && github.event.action == 'published' | |
environment: pypi | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" | |
CIBW_ARCHS_LINUX: "x86_64 aarch64" | |
CIBW_BEFORE_ALL_LINUX: | | |
set -e | |
add-apt-repository -y ppa:mutlaqja/ppa || { echo "Failed to add PPA"; exit 1; } | |
apt-get update || { echo "Failed to update package lists"; exit 1; } | |
apt-get install -y swig libindi-dev libnova-dev libcfitsio-dev || { echo "Failed to install dependencies"; exit 1; } | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
publish: | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install build dependencies | |
run: python -m pip install build | |
- name: Build source distribution | |
run: python -m build --sdist | |
- name: Download wheels | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |