Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/check-mergeable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Block PR Merge If BLOCK-MERGE Label Exists

on:
pull_request:
types: [labeled, unlabeled, synchronize, opened, reopened]

jobs:
fail-by-label:
if: contains(join(github.event.pull_request.labels.*.name, ' '), 'Block Merge')
runs-on: ubuntu-latest
steps:
- name: Fail if PR is labeled "Block Merge"
run: |-
echo "❌ This PR is labeled as 'Block Merge' and cannot be merged."
exit 1
15 changes: 10 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -21,32 +21,37 @@ repos:
args: ['-f=lf']

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.9.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.15.0
hooks:
- id: mypy

- repo: https://github.com/jendrikseipp/vulture
rev: v2.14
hooks:
- id: vulture

- repo: https://github.com/espressif/conventional-precommit-linter
rev: v1.10.0
hooks:
- id: conventional-precommit-linter
stages: [commit-msg]

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: ['--write-changes']
additional_dependencies: [tomli]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.22
hooks:
- id: mdformat
args: [--number]
Expand Down
58 changes: 5 additions & 53 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
# 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)'

Expand All @@ -17,58 +14,33 @@ gitstyle := '%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s
@default:
just --list


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


# PROJECT: Install development environment
# Install development environment
@install:
pip install --require-virtualenv -e '.[dev,test]'
pip install --require-virtualenv --upgrade pip


# PROJECT: Install and autoupdate pre-commit hooks
# Install and autoupdate pre-commit hooks
@install-pre-commit:
pre-commit install
git add .pre-commit-config.yaml
pre-commit autoupdate
git reset HEAD --

# PROJECT: Re-compile requirements.txt
# Re-compile requirements.txt
@lock-requirements:
pip-compile --strip-extras --output-file=requirements.txt pyproject.toml > /dev/null


# PROJECT: Release version info, 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


# TESTS: Run local tests with pytest (config in pyproject.toml)
# Run local tests with pytest (config in pyproject.toml)
@test:
python -m pytest


# DOCKER: Build Docker image
docker-build:
docker build -t espressif/sample-project:latest .


# DOCKER: Run in Docker container
docker-run:
docker run espressif/sample-project


# Build and run Docker
docker:
just docker-build
just docker-run

# PROJECT: Remove caches, builds, reports and other generated files
# Remove caches, builds, reports and other generated files
@clean:
rm -rf \
dist \
Expand All @@ -80,23 +52,3 @@ docker:
.coverage* \
.ruff_cache \
:


# GIT: Revert the last commit - keeping changes staged
@uncommit:
git reset --soft HEAD~1


# GIT: Fix failed commit message
@recommit:
git commit --edit --file=$(git rev-parse --git-dir)/COMMIT_EDITMSG


# GIT: Show commits only on current branch
@branch-commits base="v1":
if git rev-parse --verify "{{base}}" > /dev/null 2>&1; then \
git log --first-parent --no-merges --graph --pretty="{{gitstyle}}" {{base}}..HEAD; \
else \
echo 'E: Provide base (target) branch as argument to `just branch-commits <base-branch>`' >&2; \
exit 128; \
fi
14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,29 @@
extend-exclude = ["tests/"]
format.quote-style = "single"
line-length = 120
lint.exclude = ["tests/**/*"]
lint.ignore = ["S603", "S607"]
lint.isort.force-single-line = true
lint.isort.lines-between-types = 1
lint.select = ["B", "C4", "C901", "E", "F", "I", "N", "PL", "S", "UP", "W"]
lint.select = ["A", "B", "C4", "C901", "E", "F", "I", "N", "PL", "S", "UP", "W"]

[tool.mypy]
disallow_incomplete_defs = true
disallow_untyped_defs = false
exclude = ["^__init__.py$", "^build/.*", "^dist/.*", "^docs/.*", "^tests/.*"]
ignore_missing_imports = true
packages = "sample_python_app"
packages = "sync_jira_actions"
pretty = true
python_version = "3.11"
warn_return_any = true

[tool.vulture]
make_whitelist = true
min_confidence = 80
paths = ["sync_jira_actions"]
sort_by_size = true
verbose = true

[tool.commitizen]
annotated_tag = true
bump_message = 'change(bump): [skip-ci] release $current_version → $new_version'
Expand All @@ -83,4 +91,4 @@
[tool.coverage]
run.branch = true
run.parallel = true
run.source = ["sample_python_app"]
run.source = ["sync_jira_actions"]
4 changes: 0 additions & 4 deletions taplo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Configuration file for Taplo, taplo pre-commit hook and VS Cooe extension Even Better TOML
# TODO: This config needs to be in this config file, until closing: https://github.com/tamasfe/taplo/issues/603 (pyproject.toml support)
# TODO: Pre-commit hook 'taplo-format' is now excluded in Gitlab CI job 'pre-commit-mr', until closing: https://github.com/tamasfe/taplo/pull/659 (Alpine Linux - MUSL image support)

# General rules for all TOML files, if not specified otherwise
exclude = ["**/.venv/**", "**/node_modules/**", "**/venv/**", "tests/**"]
include = ["**/*.toml"]
Expand Down
Loading