Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "CI - linters and tests"

on:
push:
branches:
- main
pull_request:

jobs:
lint-and-test:
name: linters and tests
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
with:
python-version: 3.11

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --dev --no-cache-dir

- name: install just
run: |
sudo apt install just

- name: run tests
run: |
just test

- name: run linters in test catalog
run: |
just ci_lint_full
32 changes: 0 additions & 32 deletions .github/workflows/test.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ htmlcov
.pytest_cache/
/.vscode/
.mypy_cache
test_folder/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Familiarize yourself with the [copier templating engine](https://copier.readthed
> If file not ends on `.jinja`, it will be copy-pasted as is.
> When you add `.jinja` - make sure that there will no conflicts between template languages, or just wrap everything not related to copier templating in `{%raw%}` `{%endraw%}`

### Prerequisities
### Prerequisites

1. Install python 3.11 or greater. Consider using [pyenv](https://github.com/pyenv/pyenv#installation) if you work with multiple python versions
2. Install [uv](https://github.com/astral-sh/uv#installation)
Expand All @@ -31,6 +31,6 @@ Familiarize yourself with the [copier templating engine](https://copier.readthed

1. run `uv run pytest` in your root directory

### Running template localy
### Running template locally

1. copier cli: `copier copy . test-folder-path`
15 changes: 12 additions & 3 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ _answers_file: .copier-answers.copier-python-project.yml
# For a complete list of prompt options, see https://copier.readthedocs.io/en/stable/configuring/#advanced-prompt-formatting
project_name:
type: str
help: Provide the project name
help: Provide the project name (snake case, e.g. my_project)

description:
type: str
help: Provide a short description of the project

authors:
author_name:
type: str
help: Provide a list of authors in format "Firstname Lastname <email>, Firstname Lastname <email>, ..."
help: Provide an author name in format "Firstname Lastname"

author_email:
type: str
help: Provide the author's email address

docker:
type: bool
default: true
help: Enable Docker support
37 changes: 37 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PROJECT_NAME := "copier-python-project"
TEST_ANSWERS_FILE := ".copier/.copier-answers." + PROJECT_NAME + ".yml"

copy output="test_folder":
uv run copier copy . {{ output }} \
--vcs-ref=HEAD

recopy output="test_folder":
uv run copier recopy {{ output }} \
--vcs-ref=HEAD \
--answers-file {{ TEST_ANSWERS_FILE }} \
--skip-answered \
--overwrite

update output="test_folder":
uv run copier recopy {{ output }} \
--vcs-ref=HEAD \
--answers-file {{ TEST_ANSWERS_FILE }} \
--overwrite

all_ff output="test_folder":
just recopy {{ output }}
just --justfile {{ output }}/justfile all_ff

test:
uv run pytest

ci_lint_full:
uv run copier copy . tmp/test_catalog \
--vcs-ref=HEAD \
--data project_name="test_project" \
--data description="..." \
--data author_name="Test Author" \
--data author_email="test@test.com" \
--data docker=false

just --justfile tmp/test_catalog/justfile lint_full_ff
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "copier-python-project"
version = "0.1.0"
description = "Template for empty dockerized python project."
description = "Template for python project."
authors = [{ name = "Piotr Karaś", email = "pepe500p@gmail.com" }]
requires-python = ">=3.11"
dependencies = []
Expand Down
44 changes: 44 additions & 0 deletions skeleton/.github/workflows/ci.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "CI - linters and tests"

on:
push:
branches:
- main
pull_request:

jobs:
lint-and-test:
name: linters and tests
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
{%- if docker %}

- name: run linters and tests
run: just dc _ci
{%- else %}

- name: setup python
uses: actions/setup-python@v3
with:
python-version: 3.13

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --dev --no-cache-dir

- name: install just
run: |
sudo apt install just

- name: run linters
run: |
just _ci_lint

- name: run tests
run: |
just _ci_test
{%- endif %}
7 changes: 3 additions & 4 deletions skeleton/.github/workflows/conventional-commit-pr-name.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: "Check PR title matches conventional commit specification"

on:
push:
branches:
- main
pull_request:
types:
- opened
- edited
- synchronize

jobs:
main:
Expand Down
25 changes: 0 additions & 25 deletions skeleton/.github/workflows/lint-and-test.yml

This file was deleted.

84 changes: 0 additions & 84 deletions skeleton/Makefile.jinja

This file was deleted.

8 changes: 5 additions & 3 deletions skeleton/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{{ description }}

{%- if docker %}
1. Build docker image:
```
docker compose build {{ project_name }}
Expand All @@ -11,12 +12,13 @@
```
docker compose {{ project_name }} run bash
```
or with make
or with just
```
make dc_bash
just dc bash
```

3. Run tests:
```
make test
just test
```
{%- endif %}
Loading