Skip to content

20241123 fix ci required jobs #86

20241123 fix ci required jobs

20241123 fix ci required jobs #86

Workflow file for this run

name: Build and Distribute PhotonLibPy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
merge_group:
jobs:
changed:
runs-on: ubuntu-22.04
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
# We need to always rerun if workflows change or on commits/tags
py: ${{ steps.filter.outputs.python == 'true' || steps.filter.outputs.workflow == 'true' || github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
- name: Check for file changes
uses: dorny/paths-filter@v2
id: filter
with:
list-files: 'shell'
filters: |
workflow:
- '.github/**'
python:
- 'photon-lib/py/**'
buildAndDeploy:
runs-on: ubuntu-22.04
needs: changed
if: ${{ needs.changed.outputs.py }}
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
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
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: mypy
run: |
mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib
- 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