name: Build and Distribute PhotonLibPy permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing on: push: pull_request: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: build-and-deploy: runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v6 with: python-version: 3.14 - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel pytest mypy - name: Build wheel working-directory: ./photon-lib/py run: python setup.py sdist bdist_wheel - name: Run Unit Tests working-directory: ./photon-lib/py run: | pip install --no-cache-dir dist/*.whl pytest - name: Run mypy type checking run: mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib - name: Upload artifacts uses: actions/upload-artifact@v6 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 build-python-examples: strategy: matrix: os: [ubuntu-24.04, windows-2022, macos-14] runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v6 with: python-version: 3.14 - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel pytest mypy - name: Build wheel working-directory: ./photon-lib/py run: python setup.py sdist bdist_wheel - name: Build and configure PhotonLibPy working-directory: ./photon-lib/py shell: bash run: | ./buildAndTest.sh ./enableUsingDevBuilds.sh - name: Run Unit Tests working-directory: ./photon-lib/py shell: bash run: | pip install --no-cache-dir dist/*.whl pytest - name: Run mypy type checking run: mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib - name: Build Python examples working-directory: photonlib-python-examples shell: bash run: | for folder in */; do echo $folder ./run.sh $folder done