Skip to content

chore: modernize build system, deps, and CI #161

chore: modernize build system, deps, and CI

chore: modernize build system, deps, and CI #161

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup build and test environment
run: |
python -m pip install --upgrade pip build
- name: Lint with ruff
run: |
pip install ruff
ruff format --check src/ tests/
ruff check src/ tests/
- name: Static Code Analysis with mypy
run: |
python -m pip install mypy types-aiofiles
python -m mypy --ignore-missing-imports src/ tests/
- name: Build Python Package
run: |
python -m pip install '.[tests]'
- name: Unit Test with pytest
run: |
python -m coverage run -p -m pytest
env:
W1THERMSENSOR_NO_KERNEL_MODULE: 1
- name: Report code coverage
if: always()
run: |
python -m coverage combine
python -m coverage report
publish:
needs: [ci]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
if: startsWith(github.event.ref, 'refs/tags')
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Build Package
if: startsWith(github.event.ref, 'refs/tags')
run: |
python -m pip install --upgrade pip build
python -m build
- name: Publish Package on PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_token }}
- name: Create Release on GitHub
if: startsWith(github.event.ref, 'refs/tags')
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}