Skip to content

Commit 2696221

Browse files
fix(common): Fix pytest exclusion, gitignore, and changelog checks
1 parent 3e8de3a commit 2696221

File tree

6 files changed

+50
-94
lines changed

6 files changed

+50
-94
lines changed
File renamed without changes.

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
Contributions in the form of pull requests, issue reports, and feature requests are welcome!
44

5+
## Common Terminology:
6+
* [Type]: Examples include feat (for new features), fix (for bug fixes), ci (for continuous integration), bump (for version updates), etc. You can find a comprehensive list of types in .pre-commit-config.yaml on line 65.
7+
* [Scope]: Refers to specific sections or areas within the project, such as mdns, modem, common, console, etc. You can discover additional scopes in .pre-commit-config.yaml on line 65.
8+
* [Component]: This is the name of the component, and it should match the directory name where the component code is located.
9+
510
## Submitting a PR
611

712
- [ ] Fork the [esp-protocols repository on GitHub](https://github.com/espressif/esp-protocols) to start making your changes.
@@ -14,6 +19,37 @@ For quick merging, the contribution should be short, and concentrated on a singl
1419

1520
Please follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) rule when writing commit messages.
1621

22+
A typical commit message title template:
23+
24+
Template:
25+
`[type]([scope]): Message`
26+
27+
e.g.
28+
`feat(console): Added fully operational ifconfig command`
29+
30+
31+
## Creating a new component
32+
33+
Steps:
34+
1. Add a file named .cz.yaml to the root of the component.
35+
36+
The template for .cz.yaml should look like this:
37+
```
38+
---
39+
commitizen:
40+
bump_message: 'bump([scope]): $current_version -> $new_version'
41+
pre_bump_hooks: python ../../ci/changelog.py [component]
42+
tag_format: [component]-v$version
43+
version: 0.0.0
44+
version_files:
45+
- idf_component.yml
46+
```
47+
2. Run the following command to bump the version of the component:
48+
49+
`ci/bump [component] [version] --bump-message "bump([scope]): First version [version]"`
50+
51+
Replace [component], [version] and [scope] with the specific component name, version and scope you are working with. This command will help you bump the version of the component with the provided details.
52+
1753
## Release process
1854

1955
When releasing a new component version we have to:

ci/bump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if ! cz bump --dry-run; then
1414
fi
1515

1616
cz_bump_out=`cz bump --files-only "$@"`
17-
commit_title=`echo "${cz_bump_out}" | head -1`
17+
commit_title=`echo "${cz_bump_out}" | grep "bump(" | head -1`
1818
commit_body=`cat ../../release_notes.txt`
1919

2020
git add -u .

ci/changelog.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def main():
3131
'breaking': 'Breaking changes',
3232
'major': 'Major changes'
3333
}
34+
35+
res = git('show-ref', '--tags', _tty_out=False)
36+
if old_ref not in res:
37+
old_ref = git('rev-list', '--max-parents=0', 'HEAD', _tty_out=False).strip()
38+
3439
brief_log = git.log('--oneline', '{}..HEAD'.format(old_ref), '--', 'components/' + component, _tty_out=False)
3540
for oneline in brief_log.splitlines():
3641
[commit, brief_msg] = oneline.split(' ', 1)
@@ -80,6 +85,11 @@ def main():
8085
changelog += '- {}\n'.format(it)
8186
changelog += '\n'
8287
filename = os.path.join(root_path, 'components', component, 'CHANGELOG.md')
88+
# Check if the changelog file exists.
89+
if not os.path.exists(filename):
90+
# File does not exist, create it
91+
with open(filename, 'w') as file:
92+
file.write('# Changelog\n\n')
8393
# insert the actual changelog to the beginning of the file, just after the title (2nd line)
8494
with open(filename, 'r') as orig_changelog:
8595
changelog_title = orig_changelog.readline(

components/esp_websocket_client/.gitignore

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

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ log_file = test.log
2323
log_file_level = INFO
2424
log_file_format = %(asctime)s %(levelname)s %(message)s
2525
log_file_date_format = %Y-%m-%d %H:%M:%S
26+
27+
# Directory patterns to avoid for recursion
28+
norecursedirs = "managed_components"

0 commit comments

Comments
 (0)