Skip to content

Commit 20da7b3

Browse files
committed
Added HISTORY.rst file and new GitHub Actions workflow, adjusted tests
1 parent 39467ac commit 20da7b3

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name : modified_history_check
2+
3+
on :
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
jobs:
10+
check-history:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Check if HISTORY.rst was modified or created
18+
run: |
19+
git diff origin/${{ github.base_ref }} HEAD \
20+
--diff-filter=AMR \
21+
--name-only \
22+
-- HISTORY.rst | grep -q . || {
23+
echo "ERROR: HISTORY.rst was not modified"
24+
exit 1
25+
}
26+

template/HISTORY.rst.jinja

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
=======
2+
History
3+
=======
4+
5+
[Unreleased]
6+
------------
7+
8+
Added
9+
^^^^^
10+
11+
Changed
12+
^^^^^^^
13+
14+
Deprecated
15+
^^^^^^^^^^
16+
17+
Removed
18+
^^^^^^^
19+
20+
Fixed
21+
^^^^^
22+
23+
{{ version }} ({{ '%Y-%m-%d' | strftime }})
24+
------------------
25+
26+
Added
27+
^^^^^
28+
* First release on PyPI.

tests/test_copier.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from datetime import date
23

34
def test_project_folder(default_project):
45
assert default_project.exit_code == 0
@@ -13,6 +14,8 @@ def test_project_folder(default_project):
1314
"pyproject.toml",
1415
"my_project/__init__.py",
1516
"my_project/my_project.py",
17+
"HISTORY.rst",
18+
".github/workflows/check_modified_history.yml",
1619
])
1720
def test_generated_file_exists(default_project, file_name):
1821
assert default_project.project_dir.joinpath(file_name).exists()
@@ -110,3 +113,10 @@ def test_content_project_slug_init(default_project, desired):
110113
content = default_project.project_dir.joinpath('my_project').joinpath(
111114
"__init__.py").read_text()
112115
assert desired in content, f"{desired!r} is not in content"
116+
117+
118+
def test_content_history(default_project):
119+
content = default_project.project_dir.joinpath(
120+
"HISTORY.rst").read_text()
121+
desired = f"0.1.0 ({date.today().strftime("%Y-%m-%d")})"
122+
assert desired in content

0 commit comments

Comments
 (0)