Skip to content

Commit d3b260f

Browse files
chore(deps): update from template
1 parent 8ca7905 commit d3b260f

10 files changed

Lines changed: 217 additions & 72 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_commit: v0.15.26
1+
_commit: v0.16.3
22
_src_path: gh:helmut-hoffer-von-ankershoffen/oe-python-template
33
attestations_enabled: true
44
author_email: helmuthva@gmail.com

.github/workflows/_docker-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ jobs:
139139
with:
140140
subject-name: ${{ env.DOCKER_IO_REGISTRY }}/${{ env.DOCKER_IO_IMAGE_NAME_SLIM }}
141141
subject-digest: ${{ steps.build-and-push-slim.outputs.digest }}
142-
push-to-registry: true
142+
push-to-registry: true

.github/workflows/_scheduled-test.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ jobs:
4040
- name: Audit
4141
run: make audit
4242

43-
- name: Test / regular + long running
43+
- name: Test / scheduled
4444
run: |
4545
set +e
46-
make test test_long_running
46+
make test_scheduled
4747
EXIT_CODE=$?
4848
# Show test execution in GitHub Job summary
4949
found_files=0
@@ -55,16 +55,17 @@ jobs:
5555
fi
5656
done
5757
if [ $found_files -eq 0 ]; then
58-
echo "# All tests passed" >> $GITHUB_STEP_SUMMARY
58+
echo "# All scheduled tests passed" >> $GITHUB_STEP_SUMMARY
5959
echo "" >> $GITHUB_STEP_SUMMARY
6060
fi
6161
# Show test coverage in GitHub Job summary
62-
for file in reports/coverage_*.md; do
63-
if [ -f "$file" ]; then
64-
cat "$file" >> $GITHUB_STEP_SUMMARY
65-
echo "" >> $GITHUB_STEP_SUMMARY
66-
fi
67-
done
62+
if [ -f "reports/coverage.md" ]; then
63+
cat "reports/coverage.md" >> $GITHUB_STEP_SUMMARY
64+
echo "" >> $GITHUB_STEP_SUMMARY
65+
else
66+
echo "# No test coverage computed." >> $GITHUB_STEP_SUMMARY
67+
echo "" >> $GITHUB_STEP_SUMMARY
68+
fi
6869
exit $EXIT_CODE
6970
7071
- name: Upload test results
@@ -82,6 +83,7 @@ jobs:
8283
reports/vulnerabilities.json
8384
reports/junit.xml
8485
reports/coverage.xml
86+
reports/coverage.md
8587
reports/coverage_html
8688
oe_python_template_example.log
8789
retention-days: 7

.github/workflows/_test.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ jobs:
8585
echo "# All regular tests passed" >> $GITHUB_STEP_SUMMARY
8686
echo "" >> $GITHUB_STEP_SUMMARY
8787
fi
88+
# Show test coverage in GitHub Job summary
89+
if [ -f "reports/coverage.md" ]; then
90+
cat "reports/coverage.md" >> $GITHUB_STEP_SUMMARY
91+
echo "" >> $GITHUB_STEP_SUMMARY
92+
else
93+
echo "# No test coverage computed." >> $GITHUB_STEP_SUMMARY
94+
echo "" >> $GITHUB_STEP_SUMMARY
95+
fi
8896
exit $EXIT_CODE
8997
9098
- name: Test / long running
@@ -106,12 +114,13 @@ jobs:
106114
echo "" >> $GITHUB_STEP_SUMMARY
107115
fi
108116
# Show test coverage in GitHub Job summary
109-
for file in reports/coverage_*.md; do
110-
if [ -f "$file" ]; then
111-
cat "$file" >> $GITHUB_STEP_SUMMARY
112-
echo "" >> $GITHUB_STEP_SUMMARY
113-
fi
114-
done
117+
if [ -f "reports/coverage.md" ]; then
118+
cat "reports/coverage.md" >> $GITHUB_STEP_SUMMARY
119+
echo "" >> $GITHUB_STEP_SUMMARY
120+
else
121+
echo "# No test coverage computed." >> $GITHUB_STEP_SUMMARY
122+
echo "" >> $GITHUB_STEP_SUMMARY
123+
fi
115124
exit $EXIT_CODE
116125
117126
- name: Upload test results
@@ -123,6 +132,7 @@ jobs:
123132
reports/mypy_junit.xml
124133
reports/junit.xml
125134
reports/coverage.xml
135+
reports/coverage.md
126136
reports/coverage_html
127137
oe_python_template_example.log
128138
retention-days: 30

.github/workflows/ci-cd.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ jobs:
5454
secrets: inherit
5555

5656

57+
vercel_preview:
58+
59+
needs: [lint, audit, test, codeql]
60+
61+
if: (!(startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'release')) && !contains(github.event.head_commit.message, '[skip ci]'))
62+
uses: ./.github/workflows/_vercel-preview.yml
63+
permissions:
64+
contents: read
65+
deployments: write
66+
id-token: write
67+
secrets: inherit
68+
5769
package_publish:
5870

5971
needs: [lint, audit, test, codeql]
@@ -78,19 +90,6 @@ jobs:
7890
packages: write
7991
secrets: inherit
8092

81-
82-
vercel_preview:
83-
84-
needs: [lint, audit, test, codeql]
85-
86-
if: (!(startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'release')) && !contains(github.event.head_commit.message, '[skip ci]'))
87-
uses: ./.github/workflows/_vercel-preview.yml
88-
permissions:
89-
contents: read
90-
deployments: write
91-
id-token: write
92-
secrets: inherit
93-
9493
vercel_production:
9594

9695
needs: [lint, audit, test, codeql]
@@ -102,4 +101,3 @@ jobs:
102101
deployments: write
103102
id-token: write
104103
secrets: inherit
105-

ATTRIBUTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12189,7 +12189,7 @@ License: LGPL-2.1-or-later
1218912189

1219012190
```
1219112191

12192-
## oe-python-template-example (0.4.14) - MIT License
12192+
## oe-python-template-example (0.4.15) - MIT License
1219312193

1219412194
🧠 Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
1219512195

CLI_REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $ oe-python-template-example [OPTIONS] COMMAND [ARGS]...
1414
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
1515
* `--help`: Show this message and exit.
1616

17-
🧠 OE Python Template Example v0.4.14 - built with love in Berlin 🐻
17+
🧠 OE Python Template Example v0.4.15 - built with love in Berlin 🐻
1818

1919
**Commands**:
2020

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile for running common development tasks
22

33
# Define all PHONY targets
4-
.PHONY: all act audit bump clean dist dist_vercel docs docker_build install lint pre_commit_run_all profile setup setup test test_scheduled test_long_running update_from_template gui_watch
4+
.PHONY: all act audit bump clean dist dist_vercel docs docker_build install lint pre_commit_run_all profile setup setup test test_scheduled test_long_running test_coverage_reset update_from_template gui_watch
55

66
# Main target i.e. default sessions defined in noxfile.py
77
all:
@@ -41,7 +41,12 @@ test_scheduled:
4141

4242
## Run tests marked as long_running
4343
test_long_running:
44-
uv run --all-extras nox -s test -p 3.13 -- -m long_running --keep-coverage
44+
uv run --all-extras nox -s test -p 3.13 -- -m long_running --cov-append
45+
46+
## Run tests marked as scheduled
47+
test_coverage_reset:
48+
rm -rf .coverage
49+
rm -rf reports/coverage*
4550

4651
## Clean build artifacts and caches
4752
clean:
@@ -97,6 +102,7 @@ help:
97102
@echo " test [3.11|3.12|3.13] - Run tests (for specific Python version)"
98103
@echo " test_scheduled - Run tests marked as scheduled with Python 3.11"
99104
@echo " test_long_running - Run tests marked as long running with Python 3.11"
105+
@echo " test_coverage_reset - Reset test coverage data"
100106
@echo " update_from_template - Update from template using copier"
101107
@echo ""
102108
@echo "Built with love in Berlin 🐻"

noxfile.py

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def _prepare_coverage(session: nox.Session) -> None:
473473
Args:
474474
session: The nox session
475475
"""
476-
if "--keep-coverage" not in session.posargs:
476+
if "--cov-append" not in session.posargs:
477477
session.run("rm", "-rf", ".coverage", external=True)
478478

479479

@@ -530,24 +530,23 @@ def _get_report_type(session: nox.Session, custom_marker: str | None) -> str:
530530
return f"{python_version}_{report_type}"
531531

532532

533-
def _inject_header(preamble: str, report_type: str, report_file_name: str) -> None:
534-
"""Prepend report file with header indicating the report type.
533+
def _inject_headline(headline: str, file_name: str) -> None:
534+
"""Inject headline into file.
535535
536536
- Checks if report file actually exists
537-
- If so, injects header indicating the report type
537+
- If so, injects headline
538538
- If not, does nothing
539539
540540
Args:
541-
preamble: Preamble text to inject
542-
report_type: Type of the report
543-
report_file_name: Name of the report file
541+
headline: Headline to inject as first line
542+
file_name: Name of the report file
544543
"""
545-
report_file = Path(report_file_name)
546-
if report_file.is_file():
547-
header = f"# {preamble}{report_type}\n\n"
548-
content = report_file.read_text(encoding=UTF8)
544+
file = Path(file_name)
545+
if file.is_file():
546+
header = f"{headline}\n"
547+
content = file.read_text(encoding=UTF8)
549548
content = header + content
550-
report_file.write_text(content, encoding=UTF8)
549+
file.write_text(content, encoding=UTF8)
551550

552551

553552
def _run_pytest(
@@ -565,19 +564,7 @@ def _run_pytest(
565564
is_sequential = test_type == "sequential"
566565

567566
# Build base pytest arguments
568-
pytest_args = [
569-
"pytest",
570-
"--disable-warnings",
571-
JUNIT_XML,
572-
"-n",
573-
"auto",
574-
"--dist",
575-
"loadgroup",
576-
]
577-
578-
# Add coverage append for sequential tests
579-
if is_sequential:
580-
pytest_args.extend(["--cov-append"])
567+
pytest_args = ["pytest", "--disable-warnings", JUNIT_XML, "-n", "auto", "--dist", "loadgroup"]
581568

582569
# Add act environment filter if needed
583570
if _is_act_environment():
@@ -589,11 +576,8 @@ def _run_pytest(
589576
marker_value += f" and ({custom_marker})"
590577
pytest_args.extend(["-m", marker_value])
591578

592-
# Add additional arguments and report output
593-
# Add any additional posargs except for --keep-coverage
594-
for arg in posargs:
595-
if arg != "--keep-coverage":
596-
pytest_args.extend([arg])
579+
# Add additional arguments
580+
pytest_args.extend(posargs)
597581

598582
# Report output as markdown for GitHub step summaries
599583
report_file_name = f"reports/pytest_{report_type}_{'sequential' if is_sequential else 'parallel'}.md"
@@ -608,21 +592,20 @@ def _run_pytest(
608592
# Run pytest with the constructed arguments
609593
session.run(*pytest_args)
610594

611-
# Inject header into the report file indicating the report type
612-
_inject_header("Failing tests with for test execution with ", report_type, report_file_name)
595+
# Inject headline into the report file indicating the report type
596+
_inject_headline(f"# Failing tests with for test execution with {report_type}\n", report_file_name)
613597

614598

615-
def _generate_coverage_report(session: nox.Session, report_type: str) -> None:
599+
def _generate_coverage_report(session: nox.Session) -> None:
616600
"""Generate coverage report in markdown format.
617601
618602
Args:
619603
session: The nox session
620-
report_type: Report type string for output files
621604
"""
622-
coverage_report_file_name = f"reports/coverage_{report_type}.md"
605+
coverage_report_file_name = "reports/coverage.md"
623606
with Path(coverage_report_file_name).open("w", encoding=UTF8) as outfile:
624607
session.run("coverage", "report", "--format=markdown", stdout=outfile)
625-
_inject_header("Coverage report for ", report_type, coverage_report_file_name)
608+
_inject_headline("# Coverage report", coverage_report_file_name)
626609

627610

628611
def _cleanup_test_execution(session: nox.Session) -> None:
@@ -650,6 +633,7 @@ def test(session: nox.Session) -> None:
650633
_setup_venv(session)
651634

652635
# Conditionally clean coverage data
636+
# Will remove .coverage file if --cov-append is not specified
653637
_prepare_coverage(session)
654638

655639
# Extract custom markers from posargs if present
@@ -662,10 +646,12 @@ def test(session: nox.Session) -> None:
662646
_run_pytest(session, "not sequential", custom_marker, filtered_posargs, report_type)
663647

664648
# Run sequential tests
649+
if "--cov-append" not in filtered_posargs:
650+
filtered_posargs.extend(["--cov-append"])
665651
_run_pytest(session, "sequential", custom_marker, filtered_posargs, report_type)
666652

667653
# Generate coverage report in markdown
668-
_generate_coverage_report(session, report_type)
654+
_generate_coverage_report(session)
669655

670656
# Clean up post test execution
671657
_cleanup_test_execution(session)

0 commit comments

Comments
 (0)