Skip to content

Build and publish wheel #140

Build and publish wheel

Build and publish wheel #140

Workflow file for this run

name: pyblhost CI
on: [push, pull_request]
jobs:
dist:
name: Build dist
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -U build
- name: Build dist
run: python -m build --sdist --wheel
- name: Upload dist as artifact
uses: actions/upload-artifact@v4
with:
name: pyblhost-${{ github.sha }}
path: dist
retention-days: 1
if-no-files-found: error
checks:
name: Checks
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Update pip
run: pip install -U pip setuptools wheel
- name: Check formatting with Black
run: |
# Stop the build if formatting is not correct
pip install -U black
black --check --diff .
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
pip install -U flake8!=6.0.0 flake8-import-order flake8-pyproject
flake8 .
- name: Static type checking
run: |
# Use mypy for static type checking
pip install -U mypy .
mkdir -p .mypy_cache # Workaround issue with mypy: https://github.com/tk-woven/mypy-install-types-mre
mypy --install-types --non-interactive .
release:
needs: [dist, checks]
name: Release
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- uses: actions/download-artifact@v4
with:
name: pyblhost-${{ github.sha }}
path: pyblhost
- name: Publish to PyPI
id: pypi
if: startsWith(github.ref, 'refs/tags/')
run: |
pip install -U pip setuptools wheel
pip install -U twine
twine check pyblhost/*
twine upload -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} pyblhost/*
- name: Calculate checksums
run: |
pushd pyblhost
sha256sum * > SHA256SUMS
popd
- name: Publish to Github Release
if: ${{ ! cancelled() && steps.pypi.conclusion == 'success' }}
uses: softprops/action-gh-release@v2
with:
files: pyblhost/*
draft: true
fail_on_unmatched_files: true