Repository navigation
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
149 lines (133 loc) · 5.52 KB
/
Copy pathTaskfile.yaml
File metadata and controls
149 lines (133 loc) · 5.52 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# https://taskfile.dev
---
version: "3"
vars:
TEMPLATE_REVISION:
sh: git rev-parse HEAD
tasks:
default:
summary: |
Just a list of documented tasks.
silent: true
cmds:
- task --list
clean:
desc: clean up working directory
cmds:
- rm -rf *_dir
create:
desc: create a project with the current version and ask for answers
deps:
- clean
cmds:
- copier copy --trust --vcs-ref {{.TEMPLATE_REVISION}} . new_dir
check:generate:case:
desc: generate a project with the current version from a TEST_CASE
preconditions:
- sh: "[[ -v TEST_CASE ]]"
msg: >
Environment needs 'TEST_CASE' variable.
See tests directory - all yaml files without suffix are test cases.
- sh: "[ -f tests/${TEST_CASE}.yml ]"
msg: Test case file ${TEST_CASE}.yml does not exist.
cmds:
- rm -rf {{.TEST_CASE}}_dir
- mkdir {{.TEST_CASE}}_dir
- cp tests/{{.TEST_CASE}}.yml {{.TEST_CASE}}_dir/.copier-answers.yml
- copier copy --trust --vcs-ref {{.TEMPLATE_REVISION}} --defaults . {{.TEST_CASE}}_dir
- cd {{.TEST_CASE}}_dir && git init -b develop .
- cd {{.TEST_CASE}}_dir && git add .
- cd {{.TEST_CASE}}_dir && git config user.name "Anonymous Person"
- cd {{.TEST_CASE}}_dir && git config user.email "anonymous@example.org"
- cd {{.TEST_CASE}}_dir && git commit -m "init from template"
check:generate:cases:
desc: generate all test cases with the current template version
deps:
- clean
vars:
TEST_CASES:
sh: find tests -type f -name '*.yml' | sed 's/^tests\///g' | sed 's/\.yml$//g'
cmds:
- for: {var: TEST_CASES}
cmd: TEST_CASE={{.ITEM}} task check:generate:case
check:hook:case:
desc: smoke test the Stop hook a generated package ships
summary: |
Nothing else here ever executes the shipped agent files, and this one is
a blocking Stop hook: if it stayed silent when a template owned file was
edited the feature would be dead, and if it spoke on a clean tree or
ignored the loop guard every session in every generated package would
stop being able to end. All three are asserted.
This cannot tell you the hook fires on the right evidence in a real
repository. That is still a hand run in a rendered case - see CLAUDE.md.
cmds:
- cd {{.TEST_CASE}}_dir && ../scripts/check-hook.py
check:skillhook:case:
desc: smoke test the skill check hook a generated package ships
summary: |
The hook runs on every edit and shell command in every generated package,
so one that decided on a tool call would stall sessions, and a mute one
would remind of nothing. Both directions are asserted: an edit of a
mapped file, and a command naming one, get a reminder naming the skill;
unmapped files, prose and code get none; the output is never more than
context; and a user-level copy reads its own map for a package without
one and stands down where the package's own copy runs.
cmds:
- cd {{.TEST_CASE}}_dir && ../scripts/check-skill-hook.py
check:skills:case:
desc: assert the skills a generated package ships are present and well formed
summary: |
Nothing here can test what a skill says - that is a hand read. What this
asserts is that they ship: frontmatter parses, the name matches the
directory, no Jinja leaked into a rendered file, and the two skills that
are conditional on package_type are present for a project package and
absent for a vocabulary one.
cmds:
- cd {{.TEST_CASE}}_dir && ../scripts/check-skills.py
check:offline:case:
desc: assert the offline RDF checkers a generated package ships still bite
summary: |
A generated package ships one example.ttl that declares no shapes and no
vocabulary terms, so every check is a no-op over it and a checker that
had stopped detecting anything would look exactly as healthy as one that
works. This drives the rendered package's own bin/ over tests/fixtures
instead - a good catalog that must pass, and one planted fault per
checker that each must catch by name.
It needs no Corporate Memory connection, so it is the part of
check:validate:case that still runs with no credentials.
cmds:
- cd {{.TEST_CASE}}_dir && ../scripts/check-offline.py
check:validate:case:
desc: validate a project test case
preconditions:
- sh: "[[ -v TEST_CASE ]]"
msg: >
Environment needs 'TEST_CASE' variable.
See tests directory - all yaml files without suffix are test cases.
- sh: "[ -d ${TEST_CASE}_dir ]"
msg: >
Test case directory ${TEST_CASE}_dir does not exist.
Please use check:generate* tasks to create directories.
cmds:
- task: check:hook:case
vars: {TEST_CASE: '{{.TEST_CASE}}'}
- task: check:skillhook:case
vars: {TEST_CASE: '{{.TEST_CASE}}'}
- task: check:skills:case
vars: {TEST_CASE: '{{.TEST_CASE}}'}
- task: check:offline:case
vars: {TEST_CASE: '{{.TEST_CASE}}'}
- cd {{.TEST_CASE}}_dir && task check
check:validate:cases:
desc: validate all test cases
vars:
TEST_CASES:
sh: find tests -type f -name '*.yml' | sed 's/^tests\///g' | sed 's/\.yml$//g'
cmds:
- for: {var: TEST_CASES}
cmd: TEST_CASE={{.ITEM}} task check:validate:case
check:
desc: First generate, the validate all test cases
cmds:
- task: check:generate:cases
- task: check:validate:cases