|
| 1 | +name: Fusion Skills CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + shellcheck: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 17 | + - name: Install ShellCheck |
| 18 | + run: command -v shellcheck || { sudo apt-get update -qq && sudo apt-get install -y -qq shellcheck; } |
| 19 | + - name: Run ShellCheck |
| 20 | + run: | |
| 21 | + shellcheck hooks/*.sh bin/*.sh |
| 22 | + shellcheck --severity=error *.sh |
| 23 | +
|
| 24 | + test-hooks: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 28 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 29 | + with: |
| 30 | + python-version: "3.13" |
| 31 | + - name: Install dependencies |
| 32 | + run: | |
| 33 | + python -m venv .venv |
| 34 | + source .venv/bin/activate |
| 35 | + pip install --upgrade pip |
| 36 | + pip install pyyaml crowdstrike-falconpy |
| 37 | + - name: Run hook tests |
| 38 | + run: | |
| 39 | + source .venv/bin/activate |
| 40 | + ./test-hooks.sh |
| 41 | + - name: Run structural validation |
| 42 | + run: | |
| 43 | + source .venv/bin/activate |
| 44 | + ./test-validate.sh |
| 45 | +
|
| 46 | + pytest: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 50 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 51 | + with: |
| 52 | + python-version: "3.13" |
| 53 | + - name: Install dependencies |
| 54 | + run: | |
| 55 | + python -m venv .venv |
| 56 | + source .venv/bin/activate |
| 57 | + pip install --upgrade pip |
| 58 | + pip install -r requirements-test.txt |
| 59 | + - name: Run unit tests |
| 60 | + run: | |
| 61 | + source .venv/bin/activate |
| 62 | + pytest tests/ -v \ |
| 63 | + --cov=common/scripts \ |
| 64 | + --cov=skills/authoring/scripts \ |
| 65 | + --cov=skills/deployment/scripts \ |
| 66 | + --cov=skills/execution/scripts \ |
| 67 | + --cov=skills/lookup-files/scripts \ |
| 68 | + --cov=bin \ |
| 69 | + --cov-report=term-missing \ |
| 70 | + --cov-fail-under=90 |
| 71 | +
|
| 72 | + pylint: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 76 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 77 | + with: |
| 78 | + python-version: "3.13" |
| 79 | + - name: Install dependencies |
| 80 | + run: | |
| 81 | + python -m venv .venv |
| 82 | + source .venv/bin/activate |
| 83 | + pip install --upgrade pip |
| 84 | + pip install pylint crowdstrike-falconpy pyyaml tomli |
| 85 | + - name: Run pylint (fail-under=10 enforced by .pylintrc) |
| 86 | + run: | |
| 87 | + source .venv/bin/activate |
| 88 | + pylint --rcfile=.pylintrc \ |
| 89 | + common/scripts/*.py \ |
| 90 | + skills/authoring/scripts/*.py \ |
| 91 | + skills/deployment/scripts/*.py \ |
| 92 | + skills/execution/scripts/*.py \ |
| 93 | + skills/lookup-files/scripts/*.py \ |
| 94 | + bin/*.py |
| 95 | +
|
| 96 | + validate: |
| 97 | + runs-on: ubuntu-latest |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 100 | + - name: Validate JSON files |
| 101 | + run: | |
| 102 | + for f in \ |
| 103 | + hooks/hooks.json \ |
| 104 | + .claude-plugin/plugin.json \ |
| 105 | + .claude-plugin/marketplace.json \ |
| 106 | + test-result-schema.json \ |
| 107 | + verify-result-schema.json; do |
| 108 | + echo "Validating $f" |
| 109 | + python -m json.tool "$f" > /dev/null |
| 110 | + done |
| 111 | + - name: Validate SKILL.md frontmatter |
| 112 | + run: | |
| 113 | + fail=0 |
| 114 | + for skill in skills/*/SKILL.md; do |
| 115 | + for field in name description version; do |
| 116 | + if ! head -20 "$skill" | grep -q "^${field}:"; then |
| 117 | + echo "FAIL: $skill missing '$field' in frontmatter" |
| 118 | + fail=1 |
| 119 | + fi |
| 120 | + done |
| 121 | + done |
| 122 | + exit $fail |
| 123 | + - name: Validate skill size budgets |
| 124 | + run: | |
| 125 | + fail=0 |
| 126 | + total_desc_chars=0 |
| 127 | + max_tokens=5500 |
| 128 | +
|
| 129 | + for skill in skills/*/SKILL.md; do |
| 130 | + name=$(basename "$(dirname "$skill")") |
| 131 | + chars=$(wc -c < "$skill") |
| 132 | + approx_tokens=$((chars / 4)) |
| 133 | + pct=$((approx_tokens * 100 / max_tokens)) |
| 134 | +
|
| 135 | + if [ "$approx_tokens" -gt "$max_tokens" ]; then |
| 136 | + echo "FAIL: $name ~${approx_tokens} tokens (${pct}% of ${max_tokens} limit)" |
| 137 | + fail=1 |
| 138 | + elif [ "$approx_tokens" -gt 4500 ]; then |
| 139 | + echo "WARN: $name ~${approx_tokens} tokens (${pct}% of ${max_tokens} limit)" |
| 140 | + fi |
| 141 | +
|
| 142 | + desc=$(sed -n 's/^description: *//p' "$skill") |
| 143 | + desc_len=${#desc} |
| 144 | + total_desc_chars=$((total_desc_chars + desc_len)) |
| 145 | +
|
| 146 | + if [ "$desc_len" -gt 1536 ]; then |
| 147 | + echo "FAIL: $name description ${desc_len} chars (max 1536)" |
| 148 | + fail=1 |
| 149 | + fi |
| 150 | + done |
| 151 | +
|
| 152 | + desc_budget=8000 |
| 153 | + desc_pct=$((total_desc_chars * 100 / desc_budget)) |
| 154 | + echo "" |
| 155 | + echo "Description budget: ${total_desc_chars} / ~${desc_budget} chars (${desc_pct}%) — 1% of 200k context at ~4 chars/token" |
| 156 | + exit $fail |
| 157 | + - name: Validate hook scripts are executable |
| 158 | + run: | |
| 159 | + fail=0 |
| 160 | + for script in hooks/*.sh; do |
| 161 | + [ -x "$script" ] || { echo "FAIL: $script is not executable"; fail=1; } |
| 162 | + done |
| 163 | + exit $fail |
| 164 | + - name: Validate Python scripts are syntactically valid |
| 165 | + run: | |
| 166 | + fail=0 |
| 167 | + while IFS= read -r py; do |
| 168 | + if ! python -c "import ast, sys; ast.parse(open(sys.argv[1], encoding='utf-8').read())" "$py"; then |
| 169 | + echo "FAIL: $py has a syntax error" |
| 170 | + fail=1 |
| 171 | + fi |
| 172 | + done < <(find . -name '*.py' -not -path '*/__pycache__/*' -not -path '*/.venv/*') |
| 173 | + exit $fail |
| 174 | + - name: Validate no PLACEHOLDER values in example workflows |
| 175 | + run: | |
| 176 | + fail=0 |
| 177 | + while IFS= read -r wf; do |
| 178 | + if grep -qE 'PLACEHOLDER_[A-Z_]+' "$wf"; then |
| 179 | + echo "FAIL: $wf contains PLACEHOLDER_* values (action IDs must be resolved)" |
| 180 | + grep -nE 'PLACEHOLDER_[A-Z_]+' "$wf" |
| 181 | + fail=1 |
| 182 | + fi |
| 183 | + done < <(find skills/authoring/examples -name '*.yaml' -o -name '*.yml') |
| 184 | + [ $fail -eq 0 ] && echo "No PLACEHOLDER_* values in example workflows" |
| 185 | + exit $fail |
| 186 | + - name: Validate version consistency |
| 187 | + run: | |
| 188 | + fail=0 |
| 189 | + plugin_version=$(jq -r '.version' .claude-plugin/plugin.json) |
| 190 | + marketplace_version=$(jq -r '.plugins[0].version' .claude-plugin/marketplace.json) |
| 191 | + echo "plugin.json version: $plugin_version" |
| 192 | + echo "marketplace.json plugins[0].version: $marketplace_version" |
| 193 | +
|
| 194 | + # marketplace.json must match plugin.json |
| 195 | + if [ "$marketplace_version" != "$plugin_version" ]; then |
| 196 | + echo "FAIL: marketplace.json plugins[0].version '$marketplace_version' != plugin.json '$plugin_version'" |
| 197 | + fail=1 |
| 198 | + fi |
| 199 | +
|
| 200 | + # All SKILL.md versions must match plugin.json |
| 201 | + for skill in skills/*/SKILL.md; do |
| 202 | + skill_version=$(sed -n 's/^version: *//p' "$skill") |
| 203 | + if [ "$skill_version" != "$plugin_version" ]; then |
| 204 | + echo "FAIL: $skill version '$skill_version' != plugin.json '$plugin_version'" |
| 205 | + fail=1 |
| 206 | + fi |
| 207 | + done |
| 208 | +
|
| 209 | + # CHANGELOG must have an entry for this version |
| 210 | + if ! grep -q "## \[${plugin_version}\]" CHANGELOG.md; then |
| 211 | + echo "FAIL: CHANGELOG.md missing entry for version $plugin_version" |
| 212 | + fail=1 |
| 213 | + fi |
| 214 | +
|
| 215 | + # README badge must match |
| 216 | + if ! grep -q "version-${plugin_version}-blue" README.md; then |
| 217 | + echo "FAIL: README.md badge doesn't match version $plugin_version" |
| 218 | + fail=1 |
| 219 | + fi |
| 220 | +
|
| 221 | + [ $fail -eq 0 ] && echo "All versions consistent: $plugin_version" |
| 222 | + exit $fail |
| 223 | +
|
| 224 | + markdownlint: |
| 225 | + runs-on: ubuntu-latest |
| 226 | + steps: |
| 227 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 228 | + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 |
| 229 | + with: |
| 230 | + node-version: 22 |
| 231 | + - name: Run markdownlint |
| 232 | + run: npx markdownlint-cli2 "**/*.md" |
0 commit comments