Skip to content

Merge pull request #2 from Lauszus/fix/python3.8 #13

Merge pull request #2 from Lauszus/fix/python3.8

Merge pull request #2 from Lauszus/fix/python3.8 #13

Workflow file for this run

name: CI
on: [push]
jobs:
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@v4
with:
python-version: "3.8"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-3.8-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}
- name: Update pip
run: pip install .[extra]
- name: Check formatting with Black
run: black --check --diff .
- name: Lint with flake8
run: flake8 .
- name: Static type checking
run: |
# Use mypy for static type checking
mkdir -p .mypy_cache # Workaround issue with mypy: https://github.com/tk-woven/mypy-install-types-mre
mypy --install-types --non-interactive .
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@v4
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: pybldc-${{ github.sha }}
path: dist
release:
needs: [checks, dist]
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@v4
with:
python-version: "3.8"
- uses: actions/download-artifact@v4
with:
name: pybldc-${{ github.sha }}
path: pybldc
- name: Publish to PyPI server
id: pypi
run: |
pip install -U pip setuptools wheel
pip install -U twine
twine check pybldc/*
twine upload -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} pybldc/*
- name: Calculate checksums
run: |
pushd pybldc
sha256sum * > SHA256SUMS
popd
- name: Publish to Github Release
if: ${{ ! cancelled() && steps.pypi.conclusion == 'success' }}
uses: softprops/action-gh-release@v1
with:
files: pybldc/*
draft: true
fail_on_unmatched_files: true