Skip to content

Commit 6cf8729

Browse files
authored
workflows: ensure generated project is formatted (#18)
* workflows: ensure generated project is formatted * Fix project formatting * Use 'fake' git committer instead of GitHub bot This should hopefully avoid any confusion about what the committer and commits signify.
1 parent f85bc8a commit 6cf8729

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.github/workflows/tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,25 @@ jobs:
1919
- name: install cookiecutter
2020
run: python -m pip install cookiecutter
2121

22+
# we need the git config setup here to make sure the subsequent git commit in each test works
23+
- name: setup fake git committer
24+
run: |
25+
git config --global user.email "[email protected]"
26+
git config --global user.name "fake"
27+
2228
- name: run template (default)
2329
run: |
2430
cookiecutter --no-input -o /tmp .
2531
2632
[[ -d /tmp/python-project/src/python_project ]] || { >&2 echo "not generated?"; exit 1; }
2733
2834
cd /tmp/python-project
35+
git init . && git add . && git commit -m "Initial commit"
2936
make dev
3037
make reformat
38+
39+
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
40+
3141
make lint
3242
make test
3343
make package
@@ -41,8 +51,12 @@ jobs:
4151
[[ ! -f /tmp/python-project/python_project/__main__.py ]] || { >&2 echo "not expecting main"; exit 1; }
4252
4353
cd /tmp/python-project
54+
git init . && git add . && git commit -m "Initial commit"
4455
make dev
4556
make reformat
57+
58+
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
59+
4660
make lint
4761
make test
4862
make package
@@ -56,8 +70,12 @@ jobs:
5670
[[ -d /tmp/tob-r-and-e-python-project/src/tob/r_and_e/python_project ]] || { >&2 echo "not generated?"; exit 1; }
5771
5872
cd /tmp/tob-r-and-e-python-project
73+
git init . && git add . && git commit -m "Initial commit"
5974
make dev
6075
make reformat
76+
77+
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
78+
6179
make lint
6280
make test
6381
make package
@@ -71,8 +89,12 @@ jobs:
7189
[[ -d /tmp/bit-trails/src/tob/r_and_e/bit_trails ]] || { >&2 echo "not generated?"; exit 1; }
7290
7391
cd /tmp/bit-trails
92+
git init . && git add . && git commit -m "Initial commit"
7493
make dev
7594
make reformat
95+
96+
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
97+
7698
make lint
7799
make test
78100
make package
@@ -87,8 +109,12 @@ jobs:
87109
[[ ! -f /tmp/python-project/.github/workflows/docs.yml ]] || { >&2 echo "not expecting docs.yml"; exit 1; }
88110
89111
cd /tmp/python-project
112+
git init . && git add . && git commit -m "Initial commit"
90113
make dev
91114
make reformat
115+
116+
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
117+
92118
make lint
93119
make test
94120
make package

{{cookiecutter.project_slug}}/test/test_init.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Initial testing module."""
2+
23
import {{ cookiecutter.__project_import }}
34

45

0 commit comments

Comments
 (0)