Better pyscript sphinx #714
This file contains hidden or 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: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| jobs: | |
| build_sdist: | |
| name: Make SpiceyPy 🌶️ 🥧 Python 🐍 source distribution | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - name: Checkout 🌶️ 🥧 | |
| uses: actions/checkout@v5 | |
| - name: Build 🛠️ sdist source for 🌶️ 🥧 SpiceyPy | |
| run: | | |
| pipx run build --sdist | |
| echo "contents of dist folder: " | |
| ls dist/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-sdist-${{ hashFiles('pyproject.toml') }} | |
| path: dist/*.tar.gz | |
| test_sdist: | |
| name: Test SpiceyPy 🌶️ 🥧 Python 🐍 source distribution | |
| needs: [build_sdist] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| [ | |
| ubuntu-22.04-arm, | |
| ubuntu-latest, | |
| macos-15, | |
| macos-15-intel, | |
| windows-latest, | |
| ] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout 🌶️ 🥧 | |
| uses: actions/checkout@v5 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| path: dist | |
| - name: Display structure of downloaded files | |
| run: ls dist/ | |
| - name: Setup windows msvc | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| uses: ilammy/[email protected] | |
| - name: Set up Python 🐍 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Display Python 🐍 | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Update pip | |
| run: | | |
| python -m pip install --upgrade pip | |
| - name: Install CI dependencies | |
| run: | | |
| python -m pip install --user --group dev | |
| - name: Install SpiceyPy 🌶️ 🥧 from sdist on Mac/Linux | |
| if: ${{ matrix.os != 'windows-latest' }} | |
| shell: bash | |
| run: | | |
| echo "Running Pip install from sdist" | |
| python -m pip install dist/*.tar.gz --user --no-build-isolation -vvvv | |
| - name: Install SpiceyPy 🌶️ 🥧 from sdist on Windows | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| shell: cmd | |
| run: | | |
| for /f %%f in ('dir /b dist\*.tar.gz') do ( | |
| python -m pip install dist\%%f --user --no-build-isolation -vvvv | |
| ) | |
| - name: Test 🧪 with coverage 📈 | |
| run: | | |
| python -m coverage run --source spiceypy -m pytest --pyargs spiceypy --benchmark-disable | |
| - name: Upload 🆙 coverage 📈 report to codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: false | |
| verbose: true | |
| use_oidc: true | |
| build_wheels: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - config: { "name": "Linux", "os": "ubuntu-latest", "arch": "x86_64" } | |
| - config: { "name": "Linux", "os": "ubuntu-22.04-arm", "arch": "aarch64" } | |
| - config: { "name": "macOS", "os": "macos-15-intel", "arch": "x86_64" } | |
| - config: { "name": "macOS", "os": "macos-15", "arch": "arm64" } | |
| - config: { "name": "Windows", "os": "windows-latest", "arch": "AMD64" } | |
| - config: { "name": "Pyodide", "os": "ubuntu-latest", "arch": "wasm32", "platform": "pyodide" } | |
| name: Build SpiceyPy 🌶️ 🥧 Python 🐍 wheels for ${{ matrix.config.os }} ${{ matrix.config.arch }} | |
| env: | |
| CSPICE_CACHE: 0 | |
| CIBW_PLATFORM: ${{ matrix.config.platform || 'auto' }} | |
| CIBW_ARCHS: ${{ matrix.config.arch }} | |
| CMAKE_BUILD_PARALLEL_LEVEL: 2 | |
| CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL="2" | |
| runs-on: ${{ matrix.config.os }} | |
| steps: | |
| - name: Checkout 🌶️ 🥧 | |
| uses: actions/checkout@v5 | |
| - name: Setup 🔬🍦🏗️ | |
| if: runner.os == 'Windows' | |
| uses: ilammy/[email protected] | |
| - name: set additional environment variables for macOS arm | |
| if: runner.os == 'macOS' && matrix.config.arch == 'arm64' | |
| run: | | |
| echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV | |
| echo "ARCHFLAGS=-arch arm64" >> $GITHUB_ENV | |
| - name: set additional environment variables for macOS x86 | |
| if: runner.os == 'macOS' && matrix.config.arch == 'x86_64' | |
| run: | | |
| echo "CIBW_ARCHS_MACOS=x86_64" >> $GITHUB_ENV | |
| echo "ARCHFLAGS=-arch x86_64" >> $GITHUB_ENV | |
| echo "CMAKE_TLS_VERIFY=0" >> $GITHUB_ENV | |
| - name: set additional environment variables for linux aarch64 | |
| if: runner.os == 'Linux' && matrix.config.arch == 'aarch64' | |
| run: | | |
| echo "CIBW_ARCHS_LINUX=aarch64" >> $GITHUB_ENV | |
| echo "ARCHFLAGS=-arch aarch64" >> $GITHUB_ENV | |
| - name: Print ARCHFLAGS | |
| run: | | |
| echo "ARCHFLAGS is: $ARCHFLAGS" | |
| - name: Set up Python 🐍 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Display Python 🐍 Version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --user --group devwheel | |
| - name: Build wheels for SpiceyPy 🌶️ 🥧 | |
| uses: pypa/[email protected] | |
| continue-on-error: true | |
| env: | |
| CIBW_PLATFORM: ${{ matrix.config.platform || 'auto' }} | |
| CIBW_ARCHS: ${{ matrix.config.arch }} | |
| CMAKE_BUILD_PARALLEL_LEVEL: 2 | |
| CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL="2" | |
| SKBUILD_BUILD_VERBOSE: "true" | |
| - name: Upload wheels for SpiceyPy 🌶️ 🥧 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-${{ matrix.config.os }}-${{ strategy.job-index }}-${{ hashFiles('pyproject.toml') }} | |
| path: ./wheelhouse/*.whl | |
| test_with_twine: | |
| name: Twine 🧵 Sanity Check distributions | |
| needs: [build_wheels, test_sdist] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: artifact-* | |
| merge-multiple: true | |
| path: dist | |
| - name: Set up Python 🐍 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --user twine | |
| - name: Check dists | |
| run: | | |
| python -m twine check dist/* | |
| publish_to_test_pypi: | |
| name: Publish 🌶️ 🥧 📦 to TestPyPI | |
| needs: [build_wheels, test_sdist, test_with_twine] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/spiceypy | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Checkout 🌶️ 🥧 | |
| uses: actions/checkout@v5 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: artifact-* | |
| merge-multiple: true | |
| path: dist | |
| - name: Remove WASM wheels before TestPyPI publish | |
| run: rm -f dist/*wasm*.whl | |
| - name: Publish distribution 📦 to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| print-hash: true | |
| verbose: true | |
| repository-url: https://test.pypi.org/legacy/ | |
| publish_to_pypi: | |
| name: Publish 🌶️ 🥧 📦 to PyPI | |
| needs: [build_wheels, test_sdist, test_with_twine, publish_to_test_pypi] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' && !contains(github.ref_name, '-') && !contains(github.ref_name, 'rc') && !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/spiceypy | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: artifact-* | |
| merge-multiple: true | |
| path: dist | |
| - name: Remove WASM wheels before PyPI publish | |
| run: rm -f dist/*wasm*.whl | |
| - name: Publish distribution 📦 to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| print-hash: true | |
| verbose: true | |
| upload_wheels_to_release: | |
| name: Upload wheels to GitHub Release | |
| needs: [publish_to_test_pypi, publish_to_pypi] | |
| runs-on: ubuntu-latest | |
| if: | | |
| always() && | |
| startsWith(github.ref, 'refs/tags/v') && | |
| github.event_name == 'push' && | |
| (needs.publish_to_test_pypi.result == 'success' || needs.publish_to_pypi.result == 'success') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check release exists | |
| run: | | |
| gh release view ${{ github.ref_name }} || \ | |
| (echo "::error::Release ${{ github.ref_name }} does not exist yet. Create the release in the GitHub UI and re-run this job." && exit 1) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: artifact-* | |
| merge-multiple: true | |
| path: dist | |
| - name: Upload wheels to release | |
| run: gh release upload ${{ github.ref_name }} dist/*.whl --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |