Skip to content

Commit

Permalink
chore: Release preparation kitchen sink
Browse files Browse the repository at this point in the history
- Use justfile instead of Makefile, since the release script can be
  integrated natively: `just release patch`. Might be possible to even
  include this in pyproject.toml since `uv` will provide a task runner
  (astral-sh/uv#5903) that might be based on
  just.

- Adjust the linting checks in the CI to run against the whole project.

- Use the just runner in CI to avoid differing invocations in the
  project.

- Add commitizen for bumping the release. This was provided by poetry in
  the past. I make too many mistakes without a tool here. In the future,
  this will be covered by uv as well: astral-sh/uv#6298

- next… let's try to release a dev release and let's have a look if the
  pipeline works correctly.
  • Loading branch information
rumpelsepp committed Dec 19, 2024
1 parent 7a9f0f1 commit ff9b20d
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 241 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
- name: Run mypy
run: |
uv run make lint-win32
uv run just win32-lint-mypy
16 changes: 8 additions & 8 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ jobs:
run: |
uv sync --all-extras --dev
- name: Run ruff
- name: Run reuse lint
run: |
uv run ruff check src tests
uv run just lint-reuse
- name: Run mypy
- name: Run ruff format
run: |
uv run mypy src tests
uv run just lint-ruff-format
- name: Run ruff format
- name: Run ruff check
run: |
uv run ruff format --check src tests
uv run just lint-ruff-check
- name: Run reuse lint
- name: Run mypy
run: |
uv run reuse lint
uv run just lint-mypy
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Run pytest
run: |
uv run make pytest
uv run just run-test-pytest
bats:
strategy:
Expand Down Expand Up @@ -78,4 +78,4 @@ jobs:
- name: Run bats
run: |
uv run make bats
uv run just run-test-bats
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ Several linters and unit tests are used to catch programming errors and regressi
The relevant tools and their versions are specified in the `pyproject.toml`.
[Github Actions](https://docs.github.com/en/actions) are configured to run against all merge requests.

To run these checks locally, use `make lint` and `make test`.

## Commit Messages

We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for structured commit messages.
58 changes: 0 additions & 58 deletions Makefile

This file was deleted.

63 changes: 63 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: AISEC Pentesting Team
#
# SPDX-License-Identifier: CC0-1.0

default:
@just --list

[private]
lint-mypy:
mypy --pretty src tests

[private]
lint-ruff-check:
ruff check

[private]
lint-ruff-format:
ruff format --check

[private]
lint-shellcheck:
find tests/bats \( -iname "*.bash" -or -iname "*.bats" -or -iname "*.sh" \) | xargs shellcheck

[private]
lint-reuse:
reuse lint

lint: lint-mypy lint-ruff-check lint-ruff-format lint-ruff-format lint-shellcheck lint-reuse

win32-lint-mypy:
mypy --platform win32 --exclude "gallia\/log\.py" --exclude "hr" src tests

fmt:
ruff check --fix-only
ruff format
find tests/bats \( -iname "*.bash" -or -iname "*.bats" -or -iname "*.sh" \) | xargs shfmt -w

run-tests: run-test-pytest run-test-bats

run-test-pytest:
python -m pytest -v --cov={{justfile_directory()}} --cov-report html tests/pytest

run-test-bats:
./tests/bats/run_bats.sh

gen-constants: && fmt
./scripts/gen_constants.py > src/gallia/transports/_can_constants.py

release increment:
cz bump --increment {{increment}}
git push --follow-tags
gh release create "v$(cz version -p)"

pre-release increment premode:
cz bump --increment {{increment}} --prerelease {{premode}}
git push --follow-tags
gh release create --prerelease "v$(cz version -p)"

make-docs:
make -C docs html

clean:
make -C docs clean
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies = [
[project.optional-dependencies]
dev = [
"Sphinx >=8.0",
"commitizen>=4.1.0",
"construct-typing >=0.5.2,<0.7.0",
"mypy >=1.0,<2.0",
"myst-parser >=3.0.1,<4.1",
Expand All @@ -63,6 +64,7 @@ dev = [
"python-lsp-server >=1.5,<2.0",
"reuse >=4.0,<5.0",
"ruff >=0.8.0",
"rust-just>=1.38.0",
"sphinx-rtd-theme >=3",
"types-tabulate >=0.9,<0.10",
]
Expand Down Expand Up @@ -129,3 +131,10 @@ asyncio_default_fixture_loop_scope = "function"
filterwarnings = [
"error::UserWarning",
]

[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_scheme = "pep440"
version_provider = "pep621"
annotated_tag = true
1 change: 0 additions & 1 deletion scripts/gen_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import socket


TEMPLATE = f"""# This file has been autogenerated by `make constants`.
# !! DO NOT CHANGE MANUALLY !!
Expand Down
169 changes: 0 additions & 169 deletions scripts/release.py

This file was deleted.

Loading

0 comments on commit ff9b20d

Please sign in to comment.