Wrap Photonlib via nanobind #1241
Workflow file for this run
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: Build and Distribute PhotonLibPy | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- 'v*' | |
paths: | |
- '**' | |
- '!docs/**' | |
- '.github/**' | |
pull_request: | |
branches: [ master ] | |
paths: | |
- '**' | |
- '!docs/**' | |
- '.github/**' | |
jobs: | |
buildAndDeploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
working-directory: ./photon-lib/py | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r build_requirements.txt | |
- name: Build wheel | |
working-directory: ./photon-lib/py | |
# disable isolation so we can run stubgen (ew but w/e) | |
run: | | |
python -m build -swn | |
- name: Run Unit Tests | |
working-directory: ./photon-lib/py | |
run: | | |
pip install --no-cache-dir dist/*.whl | |
pytest | |
- name: Upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: dist | |
path: ./photon-lib/py/dist/ | |
- name: Publish package distributions to TestPyPI | |
# Only upload on tags | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages_dir: ./photon-lib/py/dist/ | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing |