-
Notifications
You must be signed in to change notification settings - Fork 10
133 lines (116 loc) · 4.2 KB
/
Copy pathci.yml
File metadata and controls
133 lines (116 loc) · 4.2 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
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
plugin-version-bump:
name: Plugin Version Bump
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check changed plugin versions
run: |
BASE_REF="${{ github.event.pull_request.base.ref }}"
BASE=$(git merge-base "origin/$BASE_REF" HEAD)
changed_plugins=$(
git diff --name-only "$BASE"...HEAD -- 'plugins/**' |
awk -F/ 'NF >= 2 { print $2 }' |
sort -u
)
if [ -z "$changed_plugins" ]; then
echo "No plugin changes detected."
exit 0
fi
while IFS= read -r plugin; do
manifest="plugins/$plugin/.claude-plugin/plugin.json"
if [ ! -f "$manifest" ]; then
echo "::error::plugins/$plugin/ changed but $manifest is missing. Each plugin must include a .claude-plugin/plugin.json manifest."
exit 1
fi
if git diff --quiet "$BASE"...HEAD -- "$manifest"; then
echo "::error::plugins/$plugin/ changed but $manifest was not updated. Please bump the plugin version."
exit 1
fi
old_version=$(git show "$BASE:$manifest" 2>/dev/null | jq -r '.version // empty' || true)
new_version=$(jq -r '.version // empty' "$manifest")
if [ -z "$new_version" ]; then
echo "::error::$manifest must define a version."
exit 1
fi
if [ -n "$old_version" ] && [ "$old_version" = "$new_version" ]; then
echo "::error::plugins/$plugin/ changed but version in $manifest was not bumped (still $new_version). Please bump the version."
exit 1
fi
if [ -n "$old_version" ]; then
echo "Plugin $plugin version bumped: $old_version -> $new_version"
else
echo "Plugin $plugin version added: $new_version"
fi
done <<< "$changed_plugins"
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.13"
- run: uv sync --frozen --group dev
- run: uv run ruff check .
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.13"
- run: uv sync --frozen --group dev
- run: uv run pyright
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.13"
- run: uv sync --frozen --group dev
- run: uv run pytest plugins/
design-inventory-ts:
name: TypeScript (design-inventory)
runs-on: ubuntu-latest
defaults:
run:
working-directory: tools/design-inventory
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: tools/design-inventory/package-lock.json
- run: npm ci
- run: npm run typecheck
- run: npm test
- name: Verify committed dist bundles are up to date
run: |
DIST=plugins/code/skills/design-inventory/scripts/dist
tracked=$(git -C ../.. ls-files "$DIST/*.mjs" | wc -l)
if [ "$tracked" -lt 10 ]; then
echo "::error::only $tracked tracked bundles under $DIST; bundles are missing or ignored (root .gitignore dist/ rule?). The skill cannot run without them."
exit 1
fi
npm run build
if ! git -C ../.. diff --exit-code -- "$DIST" || [ -n "$(git -C ../.. status --porcelain -- "$DIST")" ]; then
git -C ../.. status --porcelain -- "$DIST"
echo "::error::scripts/dist is stale or contains untracked bundles. Run 'npm run build' in tools/design-inventory and commit the result."
exit 1
fi