Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions .github/workflows/build-and-upload.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
---
name: publish on TestPyPI
#
# documentation:
# - https://docs.pypi.org/trusted-publishers/
# - https://github.com/astral-sh/trusted-publishing-examples/blob/main/.github/workflows/release.yml
#
name: publish package on TestPyPI

on:
release:
types: [published]
workflow_dispatch:
push:
tags:
- v*

jobs:
build-and-upload:
name: build package and upload to PyPI
runs-on: ubuntu-latest
environment: publish-to-pypi-test
environment:
name: publish-to-pypi-test
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
- name: Publish package distributions to PyPI
run: pdm publish --repository testpypi
# publish to PyPI (generic)
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# publish to Test-PyPI (generic)
# - name: Publish package distributions to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
- name: Checkout repository
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build package
run: uv build
# Check that basic features work and we didn't miss to include crucial files
# - name: Smoke test (wheel)
# run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py
# - name: Smoke test (source distribution)
# run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py
- name: Publish package
run: uv publish
25 changes: 12 additions & 13 deletions .github/workflows/validate-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: identify changed files
uses: tj-actions/changed-files@v46
id: changed-files
Expand All @@ -41,32 +41,27 @@ jobs:
contrib:
- examples/**.py
- test/**.py
- name: configure Python (using PDM)
uses: pdm-project/setup-pdm@v4
with:
python-version-file: pyproject.toml
- name: install dependencies
run: |
pdm install
- name: install uv
uses: astral-sh/setup-uv@v7
- name: lint code (flake8)
env:
LIBRARY_FILES: ${{ steps.changed-files.outputs.library_all_changed_files }}
CONTRIB_FILES: ${{ steps.changed-files.outputs.contrib_all_changed_files }}
run: |
if [[ -n $LIBRARY_FILES ]] || [[ -n $CONTRIB_FILES ]] ; then
# the GitHub editor is 127 chars wide
pdm run flake8 --max-line-length=127 --show-source --statistics $LIBRARY_FILES $CONTRIB_FILES
uv run flake8 --max-line-length=127 --show-source --statistics $LIBRARY_FILES $CONTRIB_FILES
fi
- name: lint code (mypy)
env:
CONTRIB_FILES: ${{ steps.changed-files.outputs.contrib_all_changed_files }}
run: |
# since this is a namespace package we must instruct mypy to scan
# the code as a namespace package; it won't work if we scan files
pdm run mypy -p feeph.i2c
uv run mypy -p feeph.i2c
# example scripts and tests can be scanned as files
if [[ -n $CONTRIB_FILES ]] ; then
pdm run mypy $CONTRIB_FILES
uv run mypy $CONTRIB_FILES
fi
test:
name: perform unit tests
Expand All @@ -81,15 +76,19 @@ jobs:
- "3.12"
steps:
- name: checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: configure Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: install uv
uses: astral-sh/setup-uv@v7
- name: install dependencies
with:
python-version: ${{ matrix.python-version }}
run: |
uv export --format=requirements.txt --all-extras --dev > requirements.txt
pip install -r requirements.txt
pip install pytest pytest-md pytest-emoji
# https://github.com/marketplace/actions/run-pytest
- name: perform unit tests (Python ${{ matrix.python-version }})
env:
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.9
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Coverage Status](https://coveralls.io/repos/github/feeph/libi2c-python/badge.svg)](https://coveralls.io/github/feeph/libi2c-python)
[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)
[![tox](https://img.shields.io/badge/tox-ab79d2)](https://tox.wiki/)
[![uvm-managed](https://img.shields.io/badge/packaging-uv-ab79d2)](https://docs.astral.sh/uv/)
[![tox](https://img.shields.io/badge/testing-tox-ab79d2)](https://tox.wiki/)

abstraction layer for the I²C bus (incl. simulation for testing)

Expand Down
Loading
Loading