Skip to content

Merge pull request #14 from erikandersolof/patch-1 #132

Merge pull request #14 from erikandersolof/patch-1

Merge pull request #14 from erikandersolof/patch-1 #132

Workflow file for this run

name: pyblhost CI
on: [push, pull_request]
jobs:
sdist:
name: Build sdist
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: pip install -U pip setuptools wheel
- name: Build sdist
run: python setup.py sdist
- name: Upload sdist as artifact
uses: actions/upload-artifact@v2
with:
name: pyblhost-${{ github.sha }}
path: dist
checks:
name: Checks
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
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: [sdist, checks]
name: Release
runs-on: ubuntu-22.04
timeout-minutes: 5
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/download-artifact@v2
with:
name: pyblhost-${{ github.sha }}
path: pyblhost
- name: Publish to PyPI
id: pypi
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: Publish to Github Release
if: ${{ ! cancelled() && steps.pypi.conclusion == 'success' }}
uses: softprops/action-gh-release@v1
with:
files: pyblhost/*
draft: true
fail_on_unmatched_files: true