Skip to content

Commit 6f17f5b

Browse files
committed
Improve ci scripts
1 parent 8392170 commit 6f17f5b

File tree

8 files changed

+25
-31
lines changed

8 files changed

+25
-31
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
matrix:
1313
python:
1414
- "3.11"
15-
- "3.12"
15+
- "3.13"
1616
steps:
1717
- uses: "actions/checkout@v4"
1818
- uses: "actions/cache@v4"

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212

1313
jobs:
1414
unittest:
15-
runs-on: "ubuntu-20.04"
15+
runs-on: "ubuntu-latest"
1616
steps:
1717
- uses: "actions/checkout@v4"
1818
- uses: "actions/cache@v4"
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
make unittest
3939
test:
40-
runs-on: "ubuntu-20.04"
40+
runs-on: "ubuntu-24.04"
4141
needs:
4242
- "unittest"
4343
strategy:

cookiecutter/ci/hooks/post_gen_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"pulp-glue{{ cookiecutter.__app_label_suffix }}",
3131
"CHANGES/pulp-glue{{ cookiecutter.__app_label_suffix }}",
3232
{%- endif %}
33-
{% if not cookiecutter.app_label -%}
33+
{% if not cookiecutter.app_label or not cookiecutter.glue -%}
3434
".ci/scripts/check_cli_dependencies.py",
3535
{%- endif %}
3636
]

cookiecutter/ci/{{ cookiecutter.__project_name }}/.ci/scripts/check_cli_dependencies.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
#!/bin/env python3
2+
import typing as t
23

34
import tomllib
45
from pathlib import Path
56

67
from packaging.requirements import Requirement
78

9+
10+
GLUE_DIR = "pulp-glue{{ cookiecutter.__app_label_suffix }}"
11+
12+
13+
def dependencies(path: Path) -> t.Iterator[Requirement]:
14+
with (path / "pyproject.toml").open("rb") as fp:
15+
pyproject = tomllib.load(fp)
16+
17+
return (Requirement(r) for r in pyproject["project"]["dependencies"])
18+
19+
820
if __name__ == "__main__":
921
base_path = Path(__file__).parent.parent.parent
10-
glue_path = "pulp-glue{{ cookiecutter.__app_label_suffix }}"
11-
with (base_path / "pyproject.toml").open("rb") as fp:
12-
cli_pyproject = tomllib.load(fp)
13-
14-
cli_dependency = next(
15-
(
16-
Requirement(r)
17-
for r in cli_pyproject["project"]["dependencies"]
18-
if r.startswith("pulp-cli")
19-
)
20-
)
21-
22-
with (base_path / glue_path / "pyproject.toml").open("rb") as fp:
23-
glue_pyproject = tomllib.load(fp)
24-
25-
glue_dependency = next(
26-
(
27-
Requirement(r)
28-
for r in glue_pyproject["project"]["dependencies"]
29-
if r.startswith("pulp-glue")
30-
)
31-
)
22+
glue_path = base_path / GLUE_DIR
23+
24+
cli_dependency = next((r for r in dependencies(base_path) if r.name == "pulp-cli"))
25+
glue_dependency = next((r for r in dependencies(glue_path) if r.name == "pulp-glue"))
3226

3327
if cli_dependency.specifier != glue_dependency.specifier:
3428
print("🪢 CLI and GLUE dependencies mismatch:")

cookiecutter/ci/{{ cookiecutter.__project_name }}/.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
matrix:
1313
python:
1414
- "3.11"
15-
- "3.12"
15+
- "3.13"
1616
steps:
1717
- uses: "actions/checkout@v4"
1818
{%- include "cache_action" %}

cookiecutter/ci/{{ cookiecutter.__project_name }}/.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
jobs:
1414
{%- if cookiecutter.unittests %}
1515
unittest:
16-
runs-on: "ubuntu-20.04"
16+
runs-on: "ubuntu-latest"
1717
steps:
1818
- uses: "actions/checkout@v4"
1919
{%- include "cache_action" %}
@@ -33,7 +33,7 @@ jobs:
3333
make unittest
3434
{%- endif %}
3535
test:
36-
runs-on: "ubuntu-20.04"
36+
runs-on: "ubuntu-24.04"
3737
{%- if cookiecutter.unittests %}
3838
needs:
3939
- "unittest"

cookiecutter/ci/{{ cookiecutter.__project_name }}/lint_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Lint requirements
22
black==25.1.0
3-
flake8==7.1.2
3+
flake8==7.2.0
44
flake8-pyproject==1.2.3
55
isort==6.0.1
66
mypy==1.15.0

cookiecutter/ci/{{ cookiecutter.__project_name }}/pyproject.toml.update

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ exclude = "cookiecutter"
166166
# This section is managed by the cookiecutter templates.
167167
profile = "black"
168168
line_length = 100
169-
skip = ["pulp-glue{{ cookiecutter.__app_label_suffix }}"{% if cookiecutter.app_label == "" %}, "cookiecutter"{% endif %}]
169+
extend_skip = ["pulp-glue{{ cookiecutter.__app_label_suffix }}"{% if cookiecutter.app_label == "" %}, "cookiecutter"{% endif %}]
170170

171171
[tool.flake8]
172172
# This section is managed by the cookiecutter templates.

0 commit comments

Comments
 (0)