Skip to content

Commit 2169901

Browse files
committed
chore: Release preparation kitchen sink
- 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.
1 parent 7a9f0f1 commit 2169901

File tree

10 files changed

+169
-241
lines changed

10 files changed

+169
-241
lines changed

.github/workflows/linters-win32.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
4747
- name: Run mypy
4848
run: |
49-
uv run make lint-win32
49+
uv run just win32-lint-mypy

.github/workflows/linters.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ jobs:
4444
run: |
4545
uv sync --all-extras --dev
4646
47-
- name: Run ruff
47+
- name: Run reuse lint
4848
run: |
49-
uv run ruff check src tests
49+
uv run just lint-reuse
5050
51-
- name: Run mypy
51+
- name: Run ruff format
5252
run: |
53-
uv run mypy src tests
53+
uv run just lint-ruff-format
5454
55-
- name: Run ruff format
55+
- name: Run ruff check
5656
run: |
57-
uv run ruff format --check src tests
57+
uv run just lint-ruff-check
5858
59-
- name: Run reuse lint
59+
- name: Run mypy
6060
run: |
61-
uv run reuse lint
61+
uv run just lint-mypy

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
4545
- name: Run pytest
4646
run: |
47-
uv run make pytest
47+
uv run just run-test-pytest
4848
4949
bats:
5050
strategy:
@@ -78,4 +78,4 @@ jobs:
7878
7979
- name: Run bats
8080
run: |
81-
uv run make bats
81+
uv run just run-test-bats

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Several linters and unit tests are used to catch programming errors and regressi
1818
The relevant tools and their versions are specified in the `pyproject.toml`.
1919
[Github Actions](https://docs.github.com/en/actions) are configured to run against all merge requests.
2020

21-
To run these checks locally, use `make lint` and `make test`.
22-
2321
## Commit Messages
2422

2523
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for structured commit messages.

Makefile

Lines changed: 0 additions & 58 deletions
This file was deleted.

justfile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-FileCopyrightText: AISEC Pentesting Team
2+
#
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
default:
6+
@just --list
7+
8+
[private]
9+
lint-mypy:
10+
mypy --pretty src tests
11+
12+
[private]
13+
lint-ruff-check:
14+
ruff check
15+
16+
[private]
17+
lint-ruff-format:
18+
ruff format --check
19+
20+
[private]
21+
lint-shellcheck:
22+
find tests/bats \( -iname "*.bash" -or -iname "*.bats" -or -iname "*.sh" \) | xargs shellcheck
23+
24+
[private]
25+
lint-reuse:
26+
reuse lint
27+
28+
lint: lint-mypy lint-ruff-check lint-ruff-format lint-ruff-format lint-shellcheck lint-reuse
29+
30+
win32-lint-mypy:
31+
mypy --platform win32 --exclude "gallia\/log\.py" --exclude "hr" src tests
32+
33+
fmt:
34+
ruff check --fix-only
35+
ruff format
36+
find tests/bats \( -iname "*.bash" -or -iname "*.bats" -or -iname "*.sh" \) | xargs shfmt -w
37+
38+
run-tests: run-test-pytest run-test-bats
39+
40+
run-test-pytest:
41+
python -m pytest -v --cov={{justfile_directory()}} --cov-report html tests/pytest
42+
43+
run-test-bats:
44+
./tests/bats/run_bats.sh
45+
46+
gen-constants: && fmt
47+
./scripts/gen_constants.py > src/gallia/transports/_can_constants.py
48+
49+
release increment:
50+
cz bump --increment {{increment}}
51+
git push --follow-tags
52+
gh release create "v$(cz version -p)"
53+
54+
make-docs:
55+
make -C docs html
56+
57+
clean:
58+
make -C docs clean

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ dependencies = [
5252
[project.optional-dependencies]
5353
dev = [
5454
"Sphinx >=8.0",
55+
"commitizen>=4.1.0",
5556
"construct-typing >=0.5.2,<0.7.0",
5657
"mypy >=1.0,<2.0",
5758
"myst-parser >=3.0.1,<4.1",
@@ -63,6 +64,7 @@ dev = [
6364
"python-lsp-server >=1.5,<2.0",
6465
"reuse >=4.0,<5.0",
6566
"ruff >=0.8.0",
67+
"rust-just>=1.38.0",
6668
"sphinx-rtd-theme >=3",
6769
"types-tabulate >=0.9,<0.10",
6870
]

scripts/gen_constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import socket
88

9-
109
TEMPLATE = f"""# This file has been autogenerated by `make constants`.
1110
# !! DO NOT CHANGE MANUALLY !!
1211

scripts/release.py

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)