fix(common): Fix pytest exclusion, gitignore, and changelog checks

This commit is contained in:
Abhik Roy
2023-10-17 12:13:45 +02:00
parent 3e8de3af3a
commit 269622170e
6 changed files with 50 additions and 94 deletions

View File

@ -2,6 +2,11 @@
Contributions in the form of pull requests, issue reports, and feature requests are welcome!
## Common Terminology:
* [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.
* [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.
* [Component]: This is the name of the component, and it should match the directory name where the component code is located.
## Submitting a PR
- [ ] 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
Please follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) rule when writing commit messages.
A typical commit message title template:
Template:
`[type]([scope]): Message`
e.g.
`feat(console): Added fully operational ifconfig command`
## Creating a new component
Steps:
1. Add a file named .cz.yaml to the root of the component.
The template for .cz.yaml should look like this:
```
---
commitizen:
bump_message: 'bump([scope]): $current_version -> $new_version'
pre_bump_hooks: python ../../ci/changelog.py [component]
tag_format: [component]-v$version
version: 0.0.0
version_files:
- idf_component.yml
```
2. Run the following command to bump the version of the component:
`ci/bump [component] [version] --bump-message "bump([scope]): First version [version]"`
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.
## Release process
When releasing a new component version we have to:

View File

@ -14,7 +14,7 @@ if ! cz bump --dry-run; then
fi
cz_bump_out=`cz bump --files-only "$@"`
commit_title=`echo "${cz_bump_out}" | head -1`
commit_title=`echo "${cz_bump_out}" | grep "bump(" | head -1`
commit_body=`cat ../../release_notes.txt`
git add -u .

View File

@ -31,6 +31,11 @@ def main():
'breaking': 'Breaking changes',
'major': 'Major changes'
}
res = git('show-ref', '--tags', _tty_out=False)
if old_ref not in res:
old_ref = git('rev-list', '--max-parents=0', 'HEAD', _tty_out=False).strip()
brief_log = git.log('--oneline', '{}..HEAD'.format(old_ref), '--', 'components/' + component, _tty_out=False)
for oneline in brief_log.splitlines():
[commit, brief_msg] = oneline.split(' ', 1)
@ -80,6 +85,11 @@ def main():
changelog += '- {}\n'.format(it)
changelog += '\n'
filename = os.path.join(root_path, 'components', component, 'CHANGELOG.md')
# Check if the changelog file exists.
if not os.path.exists(filename):
# File does not exist, create it
with open(filename, 'w') as file:
file.write('# Changelog\n\n')
# insert the actual changelog to the beginning of the file, just after the title (2nd line)
with open(filename, 'r') as orig_changelog:
changelog_title = orig_changelog.readline(

View File

@ -1,93 +0,0 @@
.config
*.o
*.pyc
# gtags
GTAGS
GRTAGS
GPATH
# emacs
.dir-locals.el
# emacs temp file suffixes
*~
.#*
\#*#
# eclipse setting
.settings
# MacOS directory files
.DS_Store
# Components Unit Test Apps files
components/**/build
components/**/sdkconfig
components/**/sdkconfig.old
# Example project files
examples/**/sdkconfig
examples/**/sdkconfig.old
examples/**/build
# Doc build artifacts
docs/_build/
docs/doxygen_sqlite3.db
# Downloaded font files
docs/_static/DejaVuSans.ttf
docs/_static/NotoSansSC-Regular.otf
# Unit test app files
tools/unit-test-app/sdkconfig
tools/unit-test-app/sdkconfig.old
tools/unit-test-app/build
tools/unit-test-app/builds
tools/unit-test-app/output
tools/unit-test-app/test_configs
# Unit Test CMake compile log folder
log_ut_cmake
# test application build files
test/**/build
test/**/sdkconfig
test/**/sdkconfig.old
# IDF monitor test
tools/test_idf_monitor/outputs
TEST_LOGS
# gcov coverage reports
*.gcda
*.gcno
coverage.info
coverage_report/
test_multi_heap_host
# VS Code Settings
.vscode/
# VIM files
*.swp
*.swo
# Clion IDE CMake build & config
.idea/
cmake-build-*/
# Results for the checking of the Python coding style and static analysis
.mypy_cache
flake8_output.txt
# ESP-IDF default build directory name
build
# lock files for examples and components
dependencies.lock
# ignore generated docs
docs/html

View File

@ -23,3 +23,6 @@ log_file = test.log
log_file_level = INFO
log_file_format = %(asctime)s %(levelname)s %(message)s
log_file_date_format = %Y-%m-%d %H:%M:%S
# Directory patterns to avoid for recursion
norecursedirs = "managed_components"