fixed wheel smoke tests #2
Workflow file for this run
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: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ["3.10", "3.11", "3.12"] | |
| env: | |
| QT_QPA_PLATFORM: offscreen | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -e .[dev] | |
| - name: Lint | |
| run: ruff check src tests | |
| - name: Run tests | |
| run: python -m unittest discover -s tests -t tests | |
| build: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Build and validate distributions | |
| run: | | |
| python -m pip install -U pip build twine | |
| python -m build | |
| python -m twine check dist/* | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-dists | |
| path: dist/ | |
| wheel-smoke: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [build] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: release-dists | |
| path: dist/ | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install wheel | |
| run: | | |
| python - <<'PY' | |
| import glob | |
| import subprocess | |
| import sys | |
| wheels = sorted(glob.glob("dist/*.whl")) | |
| assert wheels, "No wheel found in dist/" | |
| subprocess.check_call([sys.executable, "-m", "pip", "install", wheels[0]]) | |
| print("Installed wheel:", wheels[0]) | |
| PY | |
| shell: bash | |
| - name: Smoke import | |
| run: | | |
| python -c "import pyflowreg_session_gui; print('version:', pyflowreg_session_gui.__version__)" | |
| python - <<'PY' | |
| import importlib.metadata as md | |
| eps = [ | |
| e | |
| for e in md.entry_points(group="console_scripts") | |
| if e.name == "pyflowreg-session-gui" | |
| ] | |
| assert eps, "pyflowreg-session-gui console entrypoint not found" | |
| print("entrypoint:", eps[0].value) | |
| PY | |
| sdist-smoke: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: release-dists | |
| path: dist/ | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install sdist | |
| run: python -m pip install dist/*.tar.gz | |
| - name: Smoke import | |
| run: python -c "import pyflowreg_session_gui; print('sdist import ok')" | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [wheel-smoke, sdist-smoke] | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: release-dists | |
| path: dist/ | |
| - name: Publish RCs to TestPyPI | |
| if: contains(github.ref_name, 'rc') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| packages-dir: dist/ | |
| skip-existing: true | |
| - name: Publish to PyPI | |
| if: "!contains(github.ref_name, 'rc')" | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| skip-existing: true |