Skip to content

Commit af2902c

Browse files
authored
ci: Migrate workflows to use Makefile targets and pyproject.toml deps. (#233)
* ci: Migrate workflows to use Makefile targets and pyproject.toml deps. * ci: Fix setuptools discovery error for editable install. * ci: Pin ruff version to avoid rule drift between local and CI. * ci: Add build-system, pin test deps and set cache-dependency-path.
1 parent c77dec0 commit af2902c

5 files changed

Lines changed: 22 additions & 32 deletions

File tree

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: "🔎 Python Linter"
52

63
on:
@@ -10,26 +7,22 @@ on:
107
branches: ["main"]
118

129
jobs:
13-
build:
10+
lint:
1411
runs-on: ubuntu-latest
15-
strategy:
16-
fail-fast: false
1712

1813
steps:
1914
- name: "⏳ Checkout repository"
20-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
2116

2217
- name: "🐍 Set up Python"
23-
uses: actions/setup-python@v4
18+
uses: actions/setup-python@v5
2419
with:
2520
cache: "pip"
21+
cache-dependency-path: pyproject.toml
2622
python-version: "3.10"
2723

2824
- name: "🛠 Install dependencies"
29-
run: |
30-
pip install -r .github/workflows/requirements.txt
31-
ruff --version
32-
pytest --version
25+
run: python3 -m pip install -e ".[dev]"
3326

3427
- name: "😾 Lint with ruff"
35-
run: ruff check
28+
run: make lint

.github/workflows/requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,23 @@ on:
99
jobs:
1010
mock-tests:
1111
runs-on: ubuntu-latest
12-
strategy:
13-
fail-fast: false
1412

1513
steps:
1614
- name: "⏳ Checkout repository"
17-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1816

1917
- name: "🐍 Set up Python"
20-
uses: actions/setup-python@v4
18+
uses: actions/setup-python@v5
2119
with:
2220
cache: "pip"
21+
cache-dependency-path: pyproject.toml
2322
python-version: "3.10"
2423

2524
- name: "🛠 Install dependencies"
26-
run: |
27-
pip install -r .github/workflows/requirements.txt
25+
run: python3 -m pip install -e ".[dev,test]"
2826

2927
- name: "🧪 Run mock tests"
30-
run: python -m pytest tests/ -v -k mock
28+
run: make test-mock
3129

3230
- name: "📋 Validate examples"
33-
run: python -m pytest tests/test_examples.py -v
31+
run: make test-examples

pyproject.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[build-system]
2+
requires = ["setuptools>=64"]
3+
build-backend = "setuptools.build_meta"
4+
15
[project]
26
name = "micropython-steami-lib"
37
version = "0.1.0"
@@ -6,8 +10,12 @@ license = {text = "GPL-3.0-or-later"}
610
requires-python = ">=3.7"
711

812
[project.optional-dependencies]
9-
dev = ["ruff>=0.9"]
10-
test = ["pytest>=7.0", "pyyaml>=6.0", "mpremote>=1.0"]
13+
dev = ["ruff==0.11.6"]
14+
test = ["pytest==7.4.0", "pyyaml==6.0.2", "mpremote>=1.0"]
15+
16+
[tool.setuptools]
17+
# No Python packages to install — this project contains MicroPython drivers
18+
packages = []
1119

1220
[project.urls]
1321
Homepage = "https://www.steami.cc/"

tests/requirements-test.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)