Skip to content

Commit b55dd55

Browse files
Merge branch 'main' into wsen-pads-extand-example
2 parents 1278ac1 + 0f4691d commit b55dd55

21 files changed

Lines changed: 10142 additions & 79 deletions

.github/workflows/check-commits.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,19 @@ jobs:
1414
check-commit-messages:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: "📜 Check commit messages format"
18-
uses: gsactions/commit-message-checker@v1
17+
- name: "⏳ Checkout repository"
18+
uses: actions/checkout@v4
1919
with:
20-
pattern: '^[^!]+: [A-Za-z]+.+ .+\.$'
21-
flags: "gm"
22-
error: "Commit subject line must match the following pattern: <scope>: <description>."
23-
excludeTitle: "false"
24-
excludeDescription: "true"
25-
checkAllCommitMessages: "true"
26-
accessToken: ${{ secrets.GITHUB_TOKEN }}
27-
- name: "📜 Check commit messages length"
28-
uses: gsactions/commit-message-checker@v1
20+
fetch-depth: 0
21+
22+
- name: "🟢 Set up Node.js"
23+
uses: actions/setup-node@v4
2924
with:
30-
pattern: "^[^#].{10,78}$"
31-
error: "Commit subject line maximum line length of 78 characters is exceeded."
32-
excludeTitle: "false"
33-
excludeDescription: "true"
34-
checkAllCommitMessages: "true"
35-
accessToken: ${{ secrets.GITHUB_TOKEN }}
25+
node-version: "20.17.x"
26+
cache: "npm"
27+
28+
- name: "🛠 Install commitlint"
29+
run: npm ci --ignore-scripts
30+
31+
- name: "📜 Validate commit messages"
32+
run: npx --no-install commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
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

.husky/commit-msg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env sh
2+
npx --no-install commitlint --edit "$1"

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env sh
2+
npx --no-install validate-branch-name && npx --no-install git-precommit-checks && npx --no-install lint-staged

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"endOfLine": "lf",
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 4,
6+
"arrowParens": "avoid",
7+
"trailingComma": "all",
8+
"useTabs": false
9+
}

.releaserc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"branches": ["main"],
3+
"repositoryUrl": "https://github.com/steamicc/micropython-steami-lib.git",
4+
"debug": false,
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
[
9+
"@semantic-release/changelog",
10+
{
11+
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
12+
}
13+
],
14+
[
15+
"@semantic-release/github",
16+
{
17+
"assets": "pack/*.tgz"
18+
}
19+
],
20+
[
21+
"@semantic-release/git",
22+
{
23+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
24+
}
25+
]
26+
]
27+
}

.validate-branch-namerc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
pattern: "^(main)$|^(feat|fix|docs|tooling|ci|test|style|chore|refactor)\/([a-z0-9]+-)*[a-z0-9]+$|^release\/v([0-9]+)\\.([0-9]+)\\.([0-9]+)([a-z0-9-]*)$",
3+
errorMsg: "🤨 La branche que tu essaies de pusher ne respecte pas nos conventions, tu peux la renommer avec `git branch -m <nom-actuel> <nouveau-nom>`",
4+
}

CONTRIBUTING.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,46 +48,46 @@ lib/<component>/
4848

4949
## Linting
5050

51-
The project uses `ruff` for linting.
52-
5351
```bash
54-
ruff check .
52+
make lint
5553
```
5654

5755
To automatically fix issues:
5856

5957
```bash
60-
ruff check . --fix
58+
make lint-fix
6159
```
6260

6361
## Commit messages
6462

65-
Use the following format:
63+
Commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/) format, enforced by commitlint via a git hook:
6664

6765
```
68-
<scope>: <Description starting with a capital letter ending with a period.>
66+
<type>[(<scope>)]: <Description starting with a capital letter ending with a period.>
6967
```
7068

71-
The scope is the driver name or domain (`hts221`, `ism330dl`, `docs`, `tests`, `ci`...). There is no predefined list of types — the scope is free-form.
69+
**Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `ci`, `build`, `chore`, `perf`, `revert`, `tooling`
70+
71+
**Scopes** (optional): driver names (`hts221`, `ism330dl`, `wsen-pads`...) or domains (`ci`, `docs`, `style`, `tests`, `tooling`). The scope is recommended for driver-specific changes but can be omitted for cross-cutting changes.
7272

7373
### Examples
7474

7575
```
76-
hts221: Fix missing self parameter in get_av method.
77-
ism330dl: Add driver support for temperature reading.
78-
wsen-pads: Correct pressure conversion formula.
76+
fix(hts221): Fix missing self parameter in get_av method.
77+
feat(ism330dl): Add driver support for temperature reading.
78+
fix(wsen-pads): Correct pressure conversion formula.
7979
docs: Update README driver table.
80-
tests: Add mock scenarios for mcp23009e driver.
80+
test(mcp23009e): Add mock scenarios for mcp23009e driver.
8181
```
8282

8383
## Workflow
8484

85-
1. Create a branch from main (`git checkout -b my-new-feature`)
86-
2. Write your code and add tests in `tests/scenarios/<driver>.yaml`
87-
3. Run `ruff check` and `python -m pytest tests/ -v -k mock locally`
88-
4. Commit your changes following the commit message format
89-
5. Push your branch to the repository
90-
6. Open a Pull Request
85+
1. Set up your environment: `make setup`
86+
2. Create a branch from main (format: `feat/`, `fix/`, `docs/`, `tooling/`, `ci/`, `test/`, `style/`, `chore/`, `refactor/`)
87+
3. Write your code and add tests in `tests/scenarios/<driver>.yaml`
88+
4. Run `make ci` to verify everything passes (lint + tests + examples)
89+
5. Commit — the git hooks will automatically check your commit message and run ruff on staged files
90+
6. Push your branch and open a Pull Request
9191

9292
## Continuous Integration
9393

@@ -98,6 +98,7 @@ All pull requests must pass these checks:
9898
| Commit messages | `check-commits.yml` | Validates commit message format |
9999
| Linting | `python-linter.yml` | Runs `ruff check` |
100100
| Mock tests | `tests.yml` | Runs mock driver tests |
101+
| Example validation | `tests.yml` | Validates example files syntax and imports |
101102

102103
## Notes
103104

0 commit comments

Comments
 (0)