Skip to content

Commit

Permalink
Merge pull request espressif#390 from espressif-abhikroy/common/pytes…
Browse files Browse the repository at this point in the history
…t_gitignore_changelog

fix(common): Fix pytest exclusion, gitignore, and changelog checks
  • Loading branch information
espressif-abhikroy authored Oct 23, 2023
2 parents 3e8de3a + 2696221 commit 5134eed
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 94 deletions.
File renamed without changes.
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ci/bump
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
10 changes: 10 additions & 0 deletions ci/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
93 changes: 0 additions & 93 deletions components/esp_websocket_client/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 5134eed

Please sign in to comment.