Skip to content

Commit 9665f7a

Browse files
committed
ci: test skills locally
1 parent 89255e4 commit 9665f7a

1 file changed

Lines changed: 63 additions & 213 deletions

File tree

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 63 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: CI
22

33
on:
4-
schedule:
5-
- cron: "0 * * * *" # λ§€ μ‹œκ°„ 정각
64
workflow_dispatch:
75
pull_request:
86
push:
@@ -11,251 +9,103 @@ on:
119
jobs:
1210
test:
1311
runs-on: ubuntu-latest
14-
permissions:
15-
contents: read
16-
timeout-minutes: 10
17-
strategy:
18-
matrix:
19-
skill: [humanizer, grammar-checker, style-guide, humanizer]
20-
fail-fast: false # ν•œ μŠ€ν‚¬μ΄ μ‹€νŒ¨ν•΄λ„ λ‹€λ₯Έ μŠ€ν‚¬ ν…ŒμŠ€νŠΈ 계속
2112

2213
steps:
2314
- name: Checkout repository
2415
uses: actions/checkout@v6
2516

26-
- name: Validate SKILL.md frontmatter
17+
- name: Install all skills (local)
2718
run: |
28-
echo "πŸ“ Validating YAML frontmatter for ${{ matrix.skill }}..."
29-
SKILL_FILE="skills/${{ matrix.skill }}/SKILL.md"
19+
npx skills add . --yes
20+
echo "βœ… Successfully installed all skills from local repository"
3021
31-
if [ ! -f "$SKILL_FILE" ]; then
32-
echo "❌ SKILL.md not found"
33-
exit 1
34-
fi
35-
36-
# Extract frontmatter (between --- markers)
37-
FRONTMATTER=$(sed -n '/^---$/,/^---$/p' "$SKILL_FILE" | sed '1d;$d')
38-
39-
# Check required field: name
40-
if echo "$FRONTMATTER" | grep -q "^name:"; then
41-
NAME=$(echo "$FRONTMATTER" | grep "^name:" | sed 's/name: *//')
42-
echo "βœ… Found name: $NAME"
43-
44-
# Verify name matches matrix skill
45-
if [ "$NAME" = "${{ matrix.skill }}" ]; then
46-
echo "βœ… Name is correct: ${{ matrix.skill }}"
47-
else
48-
echo "❌ Name should be '${{ matrix.skill }}', got '$NAME'"
49-
exit 1
50-
fi
51-
else
52-
echo "❌ Missing required field: name"
53-
exit 1
54-
fi
55-
56-
# Check required field: description
57-
if echo "$FRONTMATTER" | grep -q "^description:"; then
58-
# Handle both quoted and unquoted descriptions
59-
DESC=$(echo "$FRONTMATTER" | sed -n 's/^description: *"\?\(.*\)"\?$/\1/p')
60-
DESC_LEN=${#DESC}
61-
echo "βœ… Found description ($DESC_LEN chars)"
62-
63-
# Verify description length (1-1024 chars per Agent Skills spec)
64-
if [ $DESC_LEN -lt 1 ] || [ $DESC_LEN -gt 1024 ]; then
65-
echo "❌ Description must be 1-1024 characters, got $DESC_LEN"
66-
exit 1
67-
fi
68-
69-
# Check for non-ASCII characters in description (CLI compatibility)
70-
if echo "$DESC" | grep -qP '[^\x00-\x7F]'; then
71-
echo "⚠️ Warning: Description contains non-ASCII characters (may cause CLI parsing issues)"
72-
else
73-
echo "βœ… Description is ASCII-safe"
74-
fi
75-
else
76-
echo "❌ Missing required field: description"
77-
exit 1
78-
fi
79-
80-
echo "βœ… Frontmatter validation passed for ${{ matrix.skill }}"
81-
82-
- name: Validate skill structure
22+
- name: Verify all skill files
8323
run: |
84-
echo "πŸ“ Validating skill structure for ${{ matrix.skill }}..."
85-
SKILL_DIR="skills/${{ matrix.skill }}"
86-
87-
# Check SKILL.md exists
88-
if [ ! -f "$SKILL_DIR/SKILL.md" ]; then
89-
echo "❌ SKILL.md not found"
90-
exit 1
91-
fi
92-
echo "βœ… SKILL.md exists"
93-
94-
# Check for references directory (if it exists)
95-
if [ -d "$SKILL_DIR/references" ]; then
96-
echo "βœ… references/ directory found"
97-
REF_COUNT=$(find "$SKILL_DIR/references" -name "*.md" | wc -l)
98-
echo " Found $REF_COUNT reference files"
99-
fi
24+
echo "πŸ“ Checking installed skill files..."
10025
101-
# Check for examples directory (if it exists)
102-
if [ -d "$SKILL_DIR/examples" ]; then
103-
echo "βœ… examples/ directory found"
104-
EX_COUNT=$(find "$SKILL_DIR/examples" -type f | wc -l)
105-
echo " Found $EX_COUNT example files"
106-
fi
26+
SKILLS_DIR=".agents/skills"
10727
108-
# Check for scripts directory (if it exists)
109-
if [ -d "$SKILL_DIR/scripts" ]; then
110-
echo "βœ… scripts/ directory found"
111-
SCRIPT_COUNT=$(find "$SKILL_DIR/scripts" -type f | wc -l)
112-
echo " Found $SCRIPT_COUNT scripts"
113-
fi
114-
115-
# Check for assets directory (if it exists)
116-
if [ -d "$SKILL_DIR/assets" ]; then
117-
echo "βœ… assets/ directory found"
118-
ASSET_COUNT=$(find "$SKILL_DIR/assets" -type f | wc -l)
119-
echo " Found $ASSET_COUNT assets"
28+
if [ ! -d "$SKILLS_DIR" ]; then
29+
echo "❌ Skills directory not found: $SKILLS_DIR"
30+
exit 1
12031
fi
12132
122-
echo "βœ… Skill structure validation passed for ${{ matrix.skill }}"
33+
echo "βœ… Skills directory exists: $SKILLS_DIR"
12334
124-
- name: Validate skill-specific requirements
125-
run: |
126-
echo "πŸ” Running skill-specific validation for ${{ matrix.skill }}..."
35+
# μ„€μΉ˜λœ λͺ¨λ“  μŠ€ν‚¬ 확인
36+
SKILL_COUNT=0
37+
for skill_dir in "$SKILLS_DIR"/*; do
38+
if [ -d "$skill_dir" ]; then
39+
skill_name=$(basename "$skill_dir")
40+
echo ""
41+
echo "πŸ“¦ Checking skill: $skill_name"
12742
128-
if [ "${{ matrix.skill }}" = "humanizer" ]; then
129-
echo "Validating humanizer-specific files..."
130-
131-
# Expected reference files for humanizer
132-
EXPECTED_FILES=(
133-
"skills/humanizer/references/punctuation-patterns.md"
134-
"skills/humanizer/references/spacing-patterns.md"
135-
"skills/humanizer/references/pos-patterns.md"
136-
"skills/humanizer/references/vocabulary-patterns.md"
137-
"skills/humanizer/references/structure-patterns.md"
138-
)
139-
140-
for file in "${EXPECTED_FILES[@]}"; do
141-
if [ -f "$file" ]; then
142-
echo "βœ… Found: $file"
43+
if [ -f "$skill_dir/SKILL.md" ]; then
44+
echo " βœ… Found SKILL.md"
45+
SKILL_COUNT=$((SKILL_COUNT + 1))
14346
else
144-
echo "❌ Missing: $file"
47+
echo " ❌ SKILL.md not found in $skill_dir"
14548
exit 1
14649
fi
147-
done
148-
149-
elif [ "${{ matrix.skill }}" = "grammar-checker" ]; then
150-
echo "Validating grammar-checker-specific files..."
50+
fi
51+
done
15152
152-
# Expected reference files for grammar-checker
153-
EXPECTED_FILES=(
154-
"skills/grammar-checker/references/rules.md"
155-
"skills/grammar-checker/references/common-errors.md"
156-
)
53+
echo ""
54+
echo "βœ… Successfully verified $SKILL_COUNT skills"
15755
158-
for file in "${EXPECTED_FILES[@]}"; do
159-
if [ -f "$file" ]; then
160-
echo "βœ… Found: $file"
161-
else
162-
echo "❌ Missing: $file"
163-
exit 1
164-
fi
165-
done
56+
# μ΅œμ†Œ 1개 μ΄μƒμ˜ μŠ€ν‚¬μ΄ μ„€μΉ˜λ˜μ—ˆλŠ”μ§€ 확인
57+
if [ $SKILL_COUNT -eq 0 ]; then
58+
echo "❌ No skills were installed"
59+
exit 1
16660
fi
16761
168-
echo "βœ… Skill-specific validation passed for ${{ matrix.skill }}"
62+
test-remote:
63+
runs-on: ubuntu-latest
64+
# main λΈŒλžœμΉ˜μ— merge된 ν›„μ—λ§Œ μ‹€ν–‰
65+
if: github.ref == 'refs/heads/main'
16966

170-
- name: Install skill with npx skills add
67+
steps:
68+
- name: Install all skills from Skills.sh
17169
run: |
172-
echo "πŸ§ͺ Installing ${{ matrix.skill }} with npx skills add..."
70+
npx skills add daleseo/korean-skills --yes
71+
echo "βœ… Successfully installed all skills from GitHub"
17372
174-
# Install skill with claude-code agent and auto-confirm
175-
npx skills add DaleSeo/korean-skills --skill ${{ matrix.skill }} --agent claude-code --yes || {
176-
echo "⚠️ npx skills add failed, but continuing to verify..."
177-
echo "This may be expected in CI environment due to TTY issues"
178-
}
179-
180-
echo "βœ… Skill installation step completed for ${{ matrix.skill }}"
181-
182-
- name: Verify installed skill
73+
- name: Verify all skill files
18374
run: |
184-
echo "πŸ” Verifying installed ${{ matrix.skill }}..."
75+
echo "πŸ“ Checking installed skill files..."
18576
186-
# Debug: Show all potential skill locations
187-
echo "πŸ”Ž Searching for skill installation..."
188-
echo "Checking ~/.claude/skills/:"
189-
ls -laR ~/.claude/ 2>/dev/null || echo "~/.claude/ not found"
190-
191-
echo ""
192-
echo "Checking ~/.agents/skills/:"
193-
ls -laR ~/.agents/ 2>/dev/null || echo "~/.agents/ not found"
77+
SKILLS_DIR=".agents/skills"
19478
195-
echo ""
196-
echo "Searching entire home directory for ${{ matrix.skill }}:"
197-
find ~ -name "${{ matrix.skill }}" -type d 2>/dev/null | head -10 || echo "No directories found"
198-
199-
# Try to find the skill in any location
200-
SKILL_DIR=""
201-
if [ -d ~/.claude/skills/${{ matrix.skill }} ]; then
202-
SKILL_DIR=~/.claude/skills/${{ matrix.skill }}
203-
elif [ -d ~/.agents/skills/${{ matrix.skill }} ]; then
204-
SKILL_DIR=~/.agents/skills/${{ matrix.skill }}
205-
else
206-
# Last resort: search for it
207-
SKILL_DIR=$(find ~ -name "${{ matrix.skill }}" -type d 2>/dev/null | grep -E '(\.claude|\.agents)/skills' | head -1)
208-
fi
209-
210-
if [ -z "$SKILL_DIR" ]; then
211-
echo "❌ Skill directory not found in any expected location"
212-
echo "This may indicate npx skills add failed to install"
79+
if [ ! -d "$SKILLS_DIR" ]; then
80+
echo "❌ Skills directory not found: $SKILLS_DIR"
21381
exit 1
21482
fi
21583
216-
echo "βœ… Skill directory found: $SKILL_DIR"
217-
echo "πŸ“ Contents:"
218-
ls -la "$SKILL_DIR"
84+
echo "βœ… Skills directory exists: $SKILLS_DIR"
21985
220-
# Find and display SKILL.md content
221-
echo ""
222-
echo "πŸ“„ Searching for SKILL.md..."
223-
SKILL_FILE=$(find "$SKILL_DIR" -name "*.md" -type f | head -1)
86+
# μ„€μΉ˜λœ λͺ¨λ“  μŠ€ν‚¬ 확인
87+
SKILL_COUNT=0
88+
for skill_dir in "$SKILLS_DIR"/*; do
89+
if [ -d "$skill_dir" ]; then
90+
skill_name=$(basename "$skill_dir")
91+
echo ""
92+
echo "πŸ“¦ Checking skill: $skill_name"
22493
225-
if [ -z "$SKILL_FILE" ]; then
226-
echo "❌ No .md files found in skill directory"
227-
exit 1
228-
fi
229-
230-
echo "βœ… Found skill file: $SKILL_FILE"
231-
echo "πŸ“‹ Skill content preview:"
232-
head -20 "$SKILL_FILE"
94+
if [ -f "$skill_dir/SKILL.md" ]; then
95+
echo " βœ… Found SKILL.md"
96+
SKILL_COUNT=$((SKILL_COUNT + 1))
97+
else
98+
echo " ❌ SKILL.md not found in $skill_dir"
99+
exit 1
100+
fi
101+
fi
102+
done
233103
234-
# Verify references directory (if expected)
235104
echo ""
236-
if [ -d "$SKILL_DIR/references" ]; then
237-
echo "βœ… references/ directory installed"
238-
echo "πŸ“š Reference files:"
239-
ls -1 "$SKILL_DIR/references/"
240-
else
241-
echo "ℹ️ references/ directory not found (may not be required)"
242-
fi
243-
244-
echo "βœ… Skill verification completed for ${{ matrix.skill }}"
105+
echo "βœ… Successfully verified $SKILL_COUNT skills"
245106
246-
summary:
247-
runs-on: ubuntu-latest
248-
needs: test
249-
if: always()
250-
steps:
251-
- name: Check test results
252-
run: |
253-
echo "πŸ“Š Test Summary"
254-
echo "==============="
255-
if [ "${{ needs.test.result }}" = "success" ]; then
256-
echo "βœ… All skill tests passed!"
257-
exit 0
258-
else
259-
echo "❌ Some skill tests failed"
107+
# μ΅œμ†Œ 1개 μ΄μƒμ˜ μŠ€ν‚¬μ΄ μ„€μΉ˜λ˜μ—ˆλŠ”μ§€ 확인
108+
if [ $SKILL_COUNT -eq 0 ]; then
109+
echo "❌ No skills were installed"
260110
exit 1
261111
fi

0 commit comments

Comments
Β (0)