Skip to content

Commit

Permalink
ci(project-settings): updated justfile, build test examples to 'outpu…
Browse files Browse the repository at this point in the history
…t' directory

- ci(github-workflows): add testing on MacOS and Windows
- ci(pyupgrade-tool): removed pyupgrade, replaced by ruff module 'UP'
  • Loading branch information
tomassebestik committed Oct 2, 2024
1 parent c4d78e3 commit b553735
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 83 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/dangerjs.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
name: DangerJS Pull Request linter
name: 🎓 DangerJS Pull Request linter

on:
pull_request_target:
types: [opened, edited, reopened, synchronize]
pull_request_target: {types: [opened, edited, reopened, synchronize]}

permissions:
pull-requests: write
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pull-request-style-linter:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Check out PR head
uses: actions/checkout@v4
Expand Down
67 changes: 61 additions & 6 deletions .github/workflows/plugin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,43 @@ on:
pull_request:
push: {branches: master}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
plugin-tests:
linux-tests:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies (Linux)
run: |
python -m venv venv
source venv/bin/activate
pip install --require-virtualenv --upgrade pip
pip install --require-virtualenv '.[test]'
- name: Run pytest, compare output with stored snapshots (Linux)
run: |
source venv/bin/activate
pytest -s
macos-tests:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -24,14 +52,41 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
- name: Install dependencies (macOS)
run: |
python -m venv venv
source venv/bin/activate
pip install --require-virtualenv --upgrade pip
pip install --require-virtualenv '.[test]'
- name: Run pytest, compare output with stored snapshots
run: |-
- name: Run pytest, compare output with stored snapshots (macOS)
run: |
source venv/bin/activate
pytest -s
windows-tests:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies (Windows)
run: |
python -m venv venv
venv\Scripts\python.exe -m pip install --require-virtualenv --upgrade pip
venv\Scripts\python.exe -m pip install --require-virtualenv .[test]
shell: cmd

- name: Run pytest, compare output with stored snapshots (Windows)
run: |
venv\Scripts\python.exe -m pytest -s
shell: cmd
13 changes: 4 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
__pycache__/
_version.py
.mypy_cache/
*.egg-info/
/.coverage
/.coverage.*
/.nox/
/.python-version
/.pytype/
/dist/
/docs/_build/
*.egg-info/
__pycache__/
_version.py
demo/
output/
TODO.md

# Local test to create Release notes
Release_notes.md

# Local test to create full CHANGELOG
CHANGELOG-output.md
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ repos:
args: ['--config-file', 'pyproject.toml']
exclude: 'tests/'

- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py39-plus]

- repo: https://github.com/espressif/conventional-precommit-linter
rev: v1.10.0
hooks:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@

## v1.1.0 (2024-09-24)

### 🐛 Bug fixes

- **changelog**: fix double title, header and footer on 'cz bump' *(Tomas Sebestik - f715e63)*

### 📖 Documentation

- **docker-example**: add run_command.txt for running demo container *(Tomas Sebestik - 0fa8c2e)*

---

## v1.1.0 (2024-09-24)

### ✨ New features

- **changelog**: custom template for release notes (GH action) *(Tomas Sebestik - 19e8cec)*
Expand Down
61 changes: 21 additions & 40 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
set quiet := true
set positional-arguments := true
# This Justfile contains rules/targets/scripts/commands that are used when
# developing. Unlike a Makefile, running `just <cmd>` will always invoke
# that command. For more information, see https://github.com/casey/just

# This setting will allow passing arguments through to recipes
set positional-arguments

# Parse current version from pyproject.toml
current_version := `grep -Po 'version\s*=\s*"\K[^"]*' pyproject.toml | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'`

# Custom git log format
gitstyle := '%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'


# Helper function for quick menu
[private]
@default:
just --list

exit:
exit 0

# ... Edit this Justfile
@edit-just:
$EDITOR ./Justfile

build-install:
pip uninstall -y czespressif
python -m build
pip install .
cz example
just get-versions

# PROJECT: Release version info and list of commits since last release
@version:
cz bump --dry-run | grep -E 'change\(bump\)|tag to create|increment detected'; \
echo "\nCommits since last release:"; \
git log -n 30 --graph --pretty="{{gitstyle}}" v{{current_version}}..HEAD

release-notes-show:
cz changelog v1.0.0 --template="RELEASE_NOTES.md.j2" --dry-run

# PROJECT: Install development environment
@install:
Expand All @@ -38,53 +40,32 @@ release-notes-show:
@lock-requirements:
pip-compile --strip-extras --output-file=requirements.txt pyproject.toml > /dev/null

release-notes-file:
cz changelog v1.0.0 --template="RELEASE_NOTES.md.j2" --file-name="Release_notes.md"

tests:
echo "Maximize terminal ...." && just get-versions && sleep 2 && clear
just dry-bump && sleep 3 && clear
just info && sleep 2 && clear
just example && sleep 2 && clear
just schema && sleep 2 && clear
just changelog-show && sleep 5 && clear
just release-notes-show && sleep 5 && clear
echo "Resize terminal, tests ends ...." && just get-versions && sleep 2 && clear

live-install:
pip uninstall -y czespressif
pip install -e '.[dev]'
pip install --upgrade pip
cz example
just get-versions

clean-temps:

# PROJECT: Remove caches, builds, reports and other generated files
@clean:
rm -rf \
dist \
.pytest_cache \
.mypy_cache \
.coverage \
.coverage.* \
.mypy_cache \
.pytest_cache \
.ruff_cache \
*.egg-info \
**/__pycache__/ \
build \
**/__pycache__/ \
**/*.test.md \
build \
demo \
dist \
:

docker-build:
cd docker && docker build -t tomasad/czespressif-demo . && cd -

# PROJECT: Build and check distribution package
@build:
just clean
python -m build
twine check dist/*

docker-run:
docker run --rm -v $(pwd):/app -u $(id -u):$(id -g) tomasad/czespressif-demo

# PROJECT:
@bump-test:
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="https://www.espressif.com/sites/all/themes/espressif/logo-black.svg" alt="Espressif logo" title="Espressif" align="right" height="20" />
</a>

# Commitizen plugin Espressif
# Commitizen plugin czEspressif

This is a plugin for Commitizen that makes it easy to create and maintain a well-organized and good-looking `CHANGELOG.md`. It also takes care of version bumping and helps you write commit messages that follow Espressif standards.

Expand All @@ -16,15 +16,16 @@ All of this with minimal config and setup, so your `pyproject.toml` file stays c
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/espressif/cz-plugin-espressif? display_name=release&logo=github&logoColor=white&label=Release">
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/czespressif?logo=pypi&logoColor=white&label=Pythons&link=https%3A%2F%2Fpypi.org%2Fproject%2Fczespressif%2F">
<img alt="Static Badge" src="https://img.shields.io/badge/pip%20install-czespressif-black?logo=python&logoColor=white">
<a href="/LICENSE"><img alt="Project License" src="https://img.shields.io/pypi/l/czespressif"/></a>
<br>
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/espressif/cz-plugin-espressif?logo=github&label=Contributors&color=purple">
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/y/espressif/cz-plugin-espressif?logo=git&logoColor=white&label=Commits&color=purple">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/espressif/cz-plugin-espressif?logo=git&logoColor=white&label=Last%20commit">
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/czespressif?logo=pypi&logoColor=white&label=PyPI%20downloads&color=blue&cacheSeconds=3600&link=https%3A%2F%2Fpypi.org%2Fproject%2Fczespressif%2F">
<a href="/LICENSE"><img alt="Project License" src="https://img.shields.io/pypi/l/czespressif"/></a>
<br>
<img alt="GitHub workflow SyncJira" src="https://img.shields.io/github/actions/workflow/status/espressif/cz-plugin-espressif/.github%2Fworkflows%2Fsync-jira.yml?branch=master&logo=jirasoftware&label=Sync with Jira">
<img alt="itHub workflow CodeQL" src="https://img.shields.io/github/actions/workflow/status/espressif/cz-plugin-espressif/.github%2Fworkflows%2Fcode-ql.yml?branch=master&label=CodeQL">
<img alt="GitHub workflow Tests Pytest" src="https://img.shields.io/github/actions/workflow/status/espressif/cz-plugin-espressif/.github%2Fworkflows%2Fplugin-tests.yml?branch=master&logo=pytest&logoColor=white&label=Tests&link=https%3A%2F%2Fgithub.com%2Fespressif%2Fcz-plugin-espressif%2Factions%2Fworkflows%2Fplugin-tests.yml">
<img alt="GitHub workflow SyncJira" src="https://img.shields.io/github/actions/workflow/status/espressif/cz-plugin-espressif/.github%2Fworkflows%2Fsync-jira.yml?branch=master&logo=jirasoftware&label=Sync with Jira&link=https%3A%2F%2Fgithub.com%2Fespressif%2Fcz-plugin-espressif%2Factions%2Fworkflows%2Fsync-jira.yml">
<img alt="GitHub workflow CodeQL" src="https://img.shields.io/github/actions/workflow/status/espressif/cz-plugin-espressif/.github%2Fworkflows%2Fcode-ql.yml?branch=master&label=CodeQL">
</p>
<small>
<b>
Expand All @@ -36,7 +37,7 @@ All of this with minimal config and setup, so your `pyproject.toml` file stays c
<hr>
</div>

- [Commitizen plugin Espressif](#commitizen-plugin-espressif)
- [Commitizen plugin czEspressif](#commitizen-plugin-czespressif)
- [Features](#features)
- [Compatibility](#compatibility)
- [Install](#install)
Expand Down
18 changes: 7 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,14 @@
skip = 'tests/*'

[tool.ruff]
extend-exclude = []
format.docstring-code-format = true
format.quote-style = "single"
line-length = 160
lint.exclude = ["tests"]
lint.isort.force-single-line = true
extend-exclude = []
format.docstring-code-format = true
format.quote-style = "single"
line-length = 160
lint.exclude = ["tests/**/*"]
lint.isort.force-single-line = true
lint.isort.lines-between-types = 1
lint.per-file-ignores."tests/*" = [
"PLR0913", # PYLINT: Ignore Too many arguments in tests directory
"S101", # BANDIT: Ignore use of assert in tests directory
]
lint.select = ["B", "C4", "C901", "E", "F", "I", "N", "PL", "S", "W"]
lint.select = ["B", "C4", "C901", "E", "F", "I", "N", "PL", "S", "UP", "W"]

[tool.mypy]
exclude = ["^__init__.py$", "^build/.*", "^dist/.*", "^docs/.*", "^tests/.*"]
Expand Down

0 comments on commit b553735

Please sign in to comment.