-
Notifications
You must be signed in to change notification settings - Fork 1
Modernize cookiecutter template #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9b128d8
Modernize cookiecutter template with bug fixes, security improvements…
ankurs 8b86604
Update default Go versions to 1.26 and 1.25
ankurs d40f012
Keep .git in Docker build context for version metadata
ankurs 2d1b2d2
Address PR review feedback
ankurs 4efb1ae
Remove make doc target from generated services
ankurs e15a3c5
Add go install tool to make install target
ankurs 60fbc54
Add govulncheck and fix OpenTelemetry SDK vulnerability
ankurs edcf067
Add end-to-end integration test workflow
ankurs b23b212
Add local e2e test script and root Makefile
ankurs b4fad72
Add AGENTS.md, fix PR review feedback, improve developer experience
ankurs 62568c9
updating contributing
ankurs fdf5087
Fix tox.ini deps and benchmark allocation in hot path
ankurs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main", "master"] | ||
| pull_request: | ||
| branches: ["main", "master"] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.11", "3.12", "3.13"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: pip | ||
| - name: Install dependencies | ||
| run: pip install -r requirements.txt | ||
| - name: Run tests | ||
| run: pytest tests/ -v |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| cookiecutter==2.1.1 | ||
| cookiecutter>=2.6.0 | ||
|
|
||
| # Testing | ||
| pytest==3.0.5 | ||
| tox==2.5.0 | ||
| sh==1.12.8 | ||
| pytest-cookies==0.2.0 | ||
| binaryornot==0.4.0 | ||
| tox==2.5.0 | ||
| pytest>=8.0.0 | ||
| tox>=4.0.0 | ||
| pytest-cookies>=0.7.0 | ||
| binaryornot>=0.4.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # -*- coding: utf-8 -*- | ||
| import os | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
| from cookiecutter.main import cookiecutter | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def template_dir(): | ||
| """Path to the cookiecutter template root.""" | ||
| return str(Path(__file__).parent.parent.resolve()) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def default_context(): | ||
| """Default context for baking the template.""" | ||
| return { | ||
| "source_path": "github.com/testorg", | ||
| "name": "TestService", | ||
| "app_name": "testservice", | ||
| "grpc_package": "com.github.testorg", | ||
| "service_name": "TestSvc", | ||
| "project_short_description": "A test service.", | ||
| "docker_image": "alpine:latest", | ||
| "docker_build_image": "golang", | ||
| "docker_build_image_version": "1.26", | ||
| } | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def bake_project(tmp_path, template_dir, default_context): | ||
| """Factory fixture that bakes a project without running hooks. | ||
|
|
||
| Returns a function that accepts optional context overrides and | ||
| returns a pathlib.Path to the generated project directory. | ||
| """ | ||
| def _bake(extra_context=None, full_context=None): | ||
| if full_context is not None: | ||
| ctx = full_context | ||
| else: | ||
| ctx = {**default_context} | ||
| if extra_context: | ||
| ctx.update(extra_context) | ||
|
|
||
| project_dir = cookiecutter( | ||
| template_dir, | ||
| output_dir=str(tmp_path), | ||
| no_input=True, | ||
| extra_context=ctx, | ||
| accept_hooks=False, | ||
| ) | ||
| return Path(project_dir) | ||
|
|
||
| return _bake | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.