Skip to content

Version 0.1.0

Version 0.1.0 #34

name: Python Lint, Format, Test, Deploy
on:
push:
branches:
- "**"
pull_request:
release:
types: [published]
jobs:
test:
name: Lint, Check formatting, Static Type-Check, Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff mypy pytest pytest-cov pytest-markdown-summary
pip install -e .
- name: Install pyproject.toml
run: pip install .
- name: Ruff lint
run: ruff check --output-format=github --target-version=py314
- name: Ruff format
run: ruff format --diff --target-version=py314
- name: MyPy
run: mypy python_ci_base
- name: Run tests
run: |
mkdir summary
pytest --cov=python_ci_base --cov-report=markdown-append:summary/coverage.md --markdown-summary-file=summary/summary.md
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY
cat summary/summary.md >> $GITHUB_STEP_SUMMARY
echo -e "\n# Coverage\n" >> $GITHUB_STEP_SUMMARY
cat summary/coverage.md >> $GITHUB_STEP_SUMMARY
# TODO: uncomment if you want to automate deployment to TestPyPI and PyPI
# # we may build and publish to TestPyPI. We accept local versions rather than
# build_for_testpypi:
# name: Build project for TestPyPI
# runs-on: ubuntu-latest
# env:
# # TODO: replace PYTHON_CI_BASE (derived from python_ci_base) with the escaped project.name from pyproject.toml (upper-case everything, replace '.', '-' with '_', see PEP 503)
# SETUPTOOLS_SCM_OVERRIDES_FOR_PYTHON_CI_BASE: '{local_scheme = "no-local-version-strict"}'
#
# if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
#
# steps:
# - uses: actions/checkout@v7
# with:
# fetch-depth: 0
#
# - uses: hynek/build-and-inspect-python-package@v2
#
# publish-to-test-pypi:
# name: Publish to TestPyPI
# runs-on: ubuntu-latest
# needs: [build_for_testpypi, test]
#
# if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
#
# environment:
# name: testpypi
#
# # TODO: change <python_ci_base> to the package name you assigned for your PyPI project
# url: https://test.pypi.org/p/<python_ci_base>
#
# permissions:
# id-token: write
#
# steps:
# - name: Download dist
# uses: actions/download-artifact@v6
# with:
# name: Packages
# path: dist
#
# - name: Publish
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
#
# # we may build and publish to PyPI
# build_for_pypi:
# name: Build project for PyPI
# runs-on: ubuntu-latest
#
# if: github.event_name == 'release'
#
# steps:
# - uses: actions/checkout@v7
# with:
# fetch-depth: 0
#
# - uses: hynek/build-and-inspect-python-package@v2
#
# publish-to-pypi:
# name: Publish to PyPI
# runs-on: ubuntu-latest
# needs: [build_for_pypi, test]
#
# if: github.event_name == 'release'
#
# environment:
# name: pypi
#
# # TODO: change <python_ci_base> to the package name you assigned for your PyPI project
# url: https://pypi.org/p/<python_ci_base>
# permissions:
# id-token: write
#
# steps:
# - name: Download dist
# uses: actions/download-artifact@v6
# with:
# name: Packages
# path: dist
#
# - name: Publish
# uses: pypa/gh-action-pypi-publish@release/v1
#