-
Notifications
You must be signed in to change notification settings - Fork 1
tooling: Add Makefile and npm hooks for dev workflow. #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3761702
ba7feea
7122f59
833a85f
bd6339f
f089246
214fca4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/usr/bin/env sh | ||
| npx --no-install commitlint --edit "$1" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/usr/bin/env sh | ||
| npx --no-install validate-branch-name && npx --no-install git-precommit-checks && npx --no-install lint-staged | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "endOfLine": "lf", | ||
| "semi": true, | ||
| "singleQuote": true, | ||
| "tabWidth": 4, | ||
| "arrowParens": "avoid", | ||
| "trailingComma": "all", | ||
| "useTabs": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "branches": ["main"], | ||
| "repositoryUrl": "https://github.com/steamicc/micropython-steami-lib.git", | ||
| "debug": false, | ||
| "plugins": [ | ||
| "@semantic-release/commit-analyzer", | ||
| "@semantic-release/release-notes-generator", | ||
| [ | ||
| "@semantic-release/changelog", | ||
| { | ||
| "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." | ||
| } | ||
| ], | ||
| [ | ||
| "@semantic-release/github", | ||
| { | ||
| "assets": "pack/*.tgz" | ||
| } | ||
| ], | ||
| [ | ||
| "@semantic-release/git", | ||
| { | ||
| "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
| } | ||
| ] | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||
| module.exports = { | ||||||
| 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-]*)$", | ||||||
| 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>`", | ||||||
|
||||||
| 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>`", | |
| errorMsg: "The branch name does not follow our conventions. You can rename it with: `git branch -m <current-name> <new-name>`", |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,120 @@ | ||||||
| .DEFAULT_GOAL := help | ||||||
|
|
||||||
| .ONESHELL: # Applies to every targets | ||||||
|
|
||||||
| include env.mk | ||||||
|
|
||||||
| # --- Setup --- | ||||||
|
|
||||||
| # npm install is re-run only when package.json changes | ||||||
| node_modules/.package-lock.json: package.json package-lock.json | ||||||
| npm install | ||||||
| @touch $@ | ||||||
|
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because Useful? React with 👍 / 👎. |
||||||
|
|
||||||
| .PHONY: prepare | ||||||
| prepare: node_modules/.package-lock.json ## Install git hooks | ||||||
| husky | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎.
|
||||||
| husky | |
| husky install |
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip install -e ... can pick up the wrong Python environment (e.g., if pip points to a different interpreter than python3). Using python3 -m pip install -e ... (or $(PYTHON) -m pip with a configurable PYTHON var) makes the install target more reliable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match per-scenario filters to pytest scenario IDs
The generated test-<scenario> targets filter with -k "$(s)", where $(s) comes from the YAML filename stem, but test IDs are built from scenario name/driver (tests/test_scenarios.py), not necessarily from the filename. For example, tests/scenarios/wsen_hids.yaml uses driver: wsen-hids and tests/scenarios/board_temperature_comparison.yaml uses name: "Temperature comparison (all sensors)", so make test-wsen_hids and make test-board_temperature_comparison can select zero tests and fail with "no tests collected". Use the same identifier source as pytest (or --driver) when generating these targets.
Useful? React with 👍 / 👎.
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dynamic per-scenario targets are generated from YAML filenames (e.g. wsen_hids.yaml -> make test-wsen_hids), but pytest IDs use scenario.get('name', scenario.get('driver', ...)). For wsen_hids.yaml/wsen_pads.yaml, driver is wsen-hids/wsen-pads, so -k "wsen_hids" won't match and the generated make targets won't run any tests. Consider generating targets from the scenario name/driver fields (parsed from YAML) or aligning filenames/name with the driver string used in test IDs (e.g., rename YAMLs or add a name: matching the filename).
| $(foreach s,$(SCENARIOS),$(eval .PHONY: test-$(s))$(eval test-$(s): ; python3 -m pytest tests/ -v -k "$(s)" --port $$(PORT) -s)) | |
| $(foreach s,$(SCENARIOS),$(eval .PHONY: test-$(s))$(eval test-$(s): ; python3 -m pytest tests/ -v -k "$(s) or $(subst _,-,$(s))" --port $$(PORT) -s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Select board tests by marker instead of name substring
These targets split board vs sensor suites using -k substring checks on board_, but board scenarios are identified by the board marker in the test generator (tests/test_scenarios.py marks board scenarios explicitly). Any board scenario whose ID does not contain board_ (e.g. name: "Temperature comparison (all sensors)") is omitted from test-board and incorrectly included by test-sensors, so both commands run the wrong scope. Use marker-based filtering (-m board and -m "hardware and not board") to make the target behavior correct.
Useful? React with 👍 / 👎.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||
| module.exports = { | ||||||
| extends: ['@commitlint/config-conventional'], | ||||||
| parserPreset: { | ||||||
| parserOpts: { | ||||||
| issuePrefixes: ['#'], | ||||||
| }, | ||||||
| }, | ||||||
| rules: { | ||||||
| 'subject-case': [0], | ||||||
| 'subject-full-stop': [0], | ||||||
| 'header-max-length': [2, 'always', 78], | ||||||
| 'scope-enum': [ | ||||||
| 1, | ||||||
|
||||||
| 1, | |
| 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow existing scope-only commit subjects
The new type-enum restricts the leading token to conventional types and excludes driver scopes (e.g. hts221, ism330dl), so commit messages in the repository’s established <scope>: <Description.> format are rejected by the new commit-msg hook. This blocks contributors using the documented/project-native format unless they switch to a different convention, which creates workflow breakage.
Useful? React with 👍 / 👎.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export PATH := $(CURDIR)/node_modules/.bin:$(PATH) | ||
| PORT ?= /dev/ttyACM0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Husky hook file doesn’t include a shebang (e.g.
#!/usr/bin/env sh). Depending on platform and how Git executes the hook, a missing shebang can cause the hook to fail to run. Add the standard Husky header (and any required initialization for your Husky major version) so the hook executes reliably.