-
Notifications
You must be signed in to change notification settings - Fork 5
123 lines (94 loc) · 3.66 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
self-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: cookiecutter.json
# we need the git config setup here to make sure the subsequent git commit in each test works
- name: setup fake git committer
run: |
git config --global user.email "[email protected]"
git config --global user.name "fake"
- name: run template (default)
run: |
uvx cookiecutter --no-input -o /tmp .
[[ -d /tmp/python-project/src/python_project ]] || { >&2 echo "not generated?"; exit 1; }
cd /tmp/python-project
git init . && git add . && git commit -m "Initial commit"
make dev
make reformat
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
make lint
make test
make package
make doc
cd .. && rm -rf /tmp/python-project
- name: run template (no entry point)
run: |
uvx cookiecutter --no-input -o /tmp . entry_point=''
[[ ! -f /tmp/python-project/python_project/__main__.py ]] || { >&2 echo "not expecting main"; exit 1; }
cd /tmp/python-project
git init . && git add . && git commit -m "Initial commit"
make dev
make reformat
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
make lint
make test
make package
make doc
cd .. && rm -rf /tmp/python-project
- name: run template (namespace)
run: |
uvx cookiecutter --no-input -o /tmp . project_namespace_import=tob.r_and_e
[[ -d /tmp/tob-r-and-e-python-project/src/tob/r_and_e/python_project ]] || { >&2 echo "not generated?"; exit 1; }
cd /tmp/tob-r-and-e-python-project
git init . && git add . && git commit -m "Initial commit"
make dev
make reformat
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
make lint
make test
make package
make doc
cd .. && rm -rf /tmp/tob-r-and-e-python-project
- name: run template (namespace, short slug)
run: |
uvx cookiecutter --no-input -o /tmp . project_namespace_import=tob.r_and_e "project_name=Bit Trails" project_slug=bit-trails
[[ -d /tmp/bit-trails/src/tob/r_and_e/bit_trails ]] || { >&2 echo "not generated?"; exit 1; }
cd /tmp/bit-trails
git init . && git add . && git commit -m "Initial commit"
make dev
make reformat
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
make lint
make test
make package
make doc
cd .. && rm -rf /tmp/bit-trails
- name: run template (no docs)
run: |
uvx cookiecutter --no-input -o /tmp . documentation='none'
[[ -d /tmp/python-project/src/python_project ]] || { >&2 echo "not generated?"; exit 1; }
[[ ! -f /tmp/python-project/.github/workflows/docs.yml ]] || { >&2 echo "not expecting docs.yml"; exit 1; }
cd /tmp/python-project
git init . && git add . && git commit -m "Initial commit"
make dev
make reformat
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
make lint
make test
make package
make doc
cd .. && rm -rf /tmp/python-project