Publish to PyPI #10
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 to PyPI | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: # Allows you to run this manually for testing | |
| jobs: | |
| test: | |
| name: Run Automated Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| - name: Install System Dependencies | |
| # Fixes the 'libgl1-mesa-glx' error by using modern packages | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ffmpeg libgl1 libglx-mesa0 libglib2.0-0 | |
| - name: Install PyTorch (CPU) | |
| # Must be installed separately before Detectron2 | |
| run: | | |
| pip install torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cpu | |
| pip install ninja wheel setuptools | |
| - name: Install Detectron2 | |
| # --no-build-isolation is the key to preventing the 'Getting Requirements' error | |
| run: | | |
| pip install --no-build-isolation git+https://github.com/facebookresearch/detectron2.git | |
| - name: Install Pupil_LIMlab | |
| run: | | |
| pip install -e . | |
| - name: Run Pytest | |
| run: pytest | |
| build-n-publish: | |
| name: Build and publish to PyPI | |
| needs: test | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/Pupil_LIMlab | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install build tool | |
| run: pip install build | |
| - name: Build binary | |
| run: | | |
| rm -rf dist/ | |
| python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |