-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from max-pfeiffer/feature/github_workflow
Feature/GitHub workflow
- Loading branch information
Showing
12 changed files
with
195 additions
and
100 deletions.
There are no files selected for viewing
This file contains 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,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
This file contains 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 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 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 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,11 @@ | ||
from pathlib import Path | ||
from shutil import rmtree | ||
|
||
REMOVE_PATHS: list[str] = [ | ||
"{% if not cookiecutter.github_workflow %}.github{% endif %}", | ||
] | ||
|
||
for path in REMOVE_PATHS: | ||
if path and Path(path.strip()).exists(): | ||
path_object: Path = Path(path.strip()) | ||
path_object.unlink() if path_object.is_file() else rmtree(path_object) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,20 +1,20 @@ | ||
[tool.poetry] | ||
name = "fast-api-micro-service-template" | ||
version = "1.1.0" | ||
version = "1.3.0" | ||
description = "A Cookiecutter template for spinning up a micro service" | ||
authors = ["Max Pfeiffer <[email protected]>"] | ||
|
||
[tool.poetry.dependencies] | ||
python = "3.11.*" | ||
|
||
[tool.poetry.dev-dependencies] | ||
black = "23.12.0" | ||
black = "23.12.1" | ||
cookiecutter = "2.5.0" | ||
coverage = "7.3.3" | ||
coverage = "7.4.0" | ||
docker = "7.0.0" | ||
furl = "2.1.3" | ||
httpx = "0.25.2" | ||
pytest = "7.4.3" | ||
httpx = "0.26.0" | ||
pytest = "7.4.4" | ||
pre-commit = "3.6.0" | ||
pytest-cookies = "0.7.0" | ||
pytest-cov = "4.1.0" | ||
|
This file contains 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ def test_custom_config(cookies) -> None: | |
"author_email": "[email protected]", | ||
"python_version": "3.10.13", | ||
"operating_system_variant": "bookworm", | ||
"github_workflow": False, | ||
} | ||
) | ||
|
||
|
@@ -46,3 +47,9 @@ def test_custom_config(cookies) -> None: | |
|
||
assert dfp.is_multistage | ||
assert all(["3.10.13-bookworm" in image for image in dfp.parent_images]) | ||
|
||
# Check for GitHub workflow | ||
workflow: Path = ( | ||
result.project_path / ".github" / "workflows" / "pipeline.yml" | ||
) | ||
assert not workflow.exists() |
This file contains 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
63 changes: 63 additions & 0 deletions
63
{{cookiecutter.project_slug}}/.github/workflows/pipeline.yml
This file contains 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,63 @@ | ||
name: Pipeline | ||
|
||
on: push | ||
|
||
jobs: | ||
code-quality: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: {{ cookiecutter.python_version }} | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.7.1 | ||
virtualenvs-in-project: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-{{ "${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}" }} | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: | | ||
poetry install --no-interaction --no-root | ||
- name: Run pylint and black | ||
run: | | ||
source .venv/bin/activate | ||
black --check . | ||
run-tests: | ||
needs: code-quality | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: {{ cookiecutter.python_version }} | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.7.1 | ||
virtualenvs-in-project: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-{{ "${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}" }} | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: | | ||
poetry install --no-interaction --no-root | ||
- name: Run tests | ||
run: | | ||
source .venv/bin/activate | ||
pytest |
This file contains 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 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