|
| 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 | + pylint: |
| 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 pylint crowdstrike-falconpy pyyaml tomli |
| 59 | + - name: Run pylint (fail-under=10 enforced by .pylintrc) |
| 60 | + run: | |
| 61 | + source .venv/bin/activate |
| 62 | + pylint --rcfile=.pylintrc \ |
| 63 | + common/scripts/*.py \ |
| 64 | + skills/authoring/scripts/*.py \ |
| 65 | + skills/deployment/scripts/*.py \ |
| 66 | + skills/execution/scripts/*.py \ |
| 67 | + skills/lookup-files/scripts/*.py \ |
| 68 | + bin/*.py |
| 69 | +
|
| 70 | + validate: |
| 71 | + runs-on: ubuntu-latest |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 74 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 75 | + with: |
| 76 | + python-version: "3.13" |
| 77 | + - name: Install dependencies |
| 78 | + run: pip install pyyaml |
| 79 | + - name: Validate JSON files |
| 80 | + run: | |
| 81 | + for f in \ |
| 82 | + hooks/hooks.json \ |
| 83 | + .claude-plugin/plugin.json \ |
| 84 | + .claude-plugin/marketplace.json \ |
| 85 | + test-result-schema.json \ |
| 86 | + verify-result-schema.json; do |
| 87 | + echo "Validating $f" |
| 88 | + python -m json.tool "$f" > /dev/null |
| 89 | + done |
| 90 | + - name: Validate SKILL.md frontmatter |
| 91 | + run: | |
| 92 | + fail=0 |
| 93 | + for skill in skills/*/SKILL.md; do |
| 94 | + for field in name description version; do |
| 95 | + if ! head -20 "$skill" | grep -q "^${field}:"; then |
| 96 | + echo "FAIL: $skill missing '$field' in frontmatter" |
| 97 | + fail=1 |
| 98 | + fi |
| 99 | + done |
| 100 | + done |
| 101 | + exit $fail |
| 102 | + - name: Validate skill size budgets |
| 103 | + run: | |
| 104 | + fail=0 |
| 105 | + MAX_TOKENS=5500 |
| 106 | + WARN_TOKENS=4500 |
| 107 | + DESC_BUDGET=8000 |
| 108 | + total_desc=0 |
| 109 | + for skill in skills/*/SKILL.md; do |
| 110 | + words=$(wc -w < "$skill") |
| 111 | + tokens=$(( words * 4 / 3 )) |
| 112 | + if [ "$tokens" -gt "$MAX_TOKENS" ]; then |
| 113 | + echo "FAIL: $skill is ~${tokens} tokens (max $MAX_TOKENS)" |
| 114 | + fail=1 |
| 115 | + elif [ "$tokens" -gt "$WARN_TOKENS" ]; then |
| 116 | + echo "WARN: $skill is ~${tokens} tokens (approaching $MAX_TOKENS limit)" |
| 117 | + else |
| 118 | + echo "OK: $skill ~${tokens} tokens" |
| 119 | + fi |
| 120 | + desc_len=$(python -c " |
| 121 | + import yaml |
| 122 | + with open('$skill') as f: |
| 123 | + parts = f.read().split('---') |
| 124 | + if len(parts) >= 3: |
| 125 | + fm = yaml.safe_load(parts[1]) |
| 126 | + print(len(fm.get('description', ''))) |
| 127 | + else: |
| 128 | + print(0) |
| 129 | + ") |
| 130 | + total_desc=$(( total_desc + desc_len )) |
| 131 | + done |
| 132 | + echo "Total description chars: $total_desc / $DESC_BUDGET" |
| 133 | + if [ "$total_desc" -gt "$DESC_BUDGET" ]; then |
| 134 | + echo "FAIL: total description chars ($total_desc) exceeds budget ($DESC_BUDGET)" |
| 135 | + fail=1 |
| 136 | + fi |
| 137 | + exit $fail |
| 138 | + - name: Validate hook scripts are executable |
| 139 | + run: | |
| 140 | + fail=0 |
| 141 | + for script in hooks/*.sh; do |
| 142 | + [ -x "$script" ] || { echo "FAIL: $script is not executable"; fail=1; } |
| 143 | + done |
| 144 | + exit $fail |
| 145 | + - name: Validate Python scripts are syntactically valid |
| 146 | + run: | |
| 147 | + fail=0 |
| 148 | + while IFS= read -r py; do |
| 149 | + if ! python -c "import ast, sys; ast.parse(open(sys.argv[1], encoding='utf-8').read())" "$py"; then |
| 150 | + echo "FAIL: $py has a syntax error" |
| 151 | + fail=1 |
| 152 | + fi |
| 153 | + done < <(find . -name '*.py' -not -path '*/__pycache__/*' -not -path '*/.venv/*') |
| 154 | + exit $fail |
| 155 | + - name: Validate no PLACEHOLDER values in example workflows |
| 156 | + run: | |
| 157 | + fail=0 |
| 158 | + while IFS= read -r wf; do |
| 159 | + if grep -qE 'PLACEHOLDER_[A-Z_]+' "$wf"; then |
| 160 | + echo "FAIL: $wf contains PLACEHOLDER_* values (action IDs must be resolved)" |
| 161 | + grep -nE 'PLACEHOLDER_[A-Z_]+' "$wf" |
| 162 | + fail=1 |
| 163 | + fi |
| 164 | + done < <(find skills/authoring/examples -name '*.yaml' -o -name '*.yml') |
| 165 | + [ $fail -eq 0 ] && echo "No PLACEHOLDER_* values in example workflows" |
| 166 | + exit $fail |
| 167 | + - name: Validate version consistency |
| 168 | + run: | |
| 169 | + fail=0 |
| 170 | + plugin_version=$(jq -r '.version' .claude-plugin/plugin.json) |
| 171 | + marketplace_version=$(jq -r '.plugins[0].version' .claude-plugin/marketplace.json) |
| 172 | + echo "plugin.json version: $plugin_version" |
| 173 | + echo "marketplace.json plugins[0].version: $marketplace_version" |
| 174 | +
|
| 175 | + # marketplace.json must match plugin.json |
| 176 | + if [ "$marketplace_version" != "$plugin_version" ]; then |
| 177 | + echo "FAIL: marketplace.json plugins[0].version '$marketplace_version' != plugin.json '$plugin_version'" |
| 178 | + fail=1 |
| 179 | + fi |
| 180 | +
|
| 181 | + # All SKILL.md versions must match plugin.json |
| 182 | + for skill in skills/*/SKILL.md; do |
| 183 | + skill_version=$(sed -n 's/^version: *//p' "$skill") |
| 184 | + if [ "$skill_version" != "$plugin_version" ]; then |
| 185 | + echo "FAIL: $skill version '$skill_version' != plugin.json '$plugin_version'" |
| 186 | + fail=1 |
| 187 | + fi |
| 188 | + done |
| 189 | +
|
| 190 | + # CHANGELOG must have an entry for this version |
| 191 | + if ! grep -q "## \[${plugin_version}\]" CHANGELOG.md; then |
| 192 | + echo "FAIL: CHANGELOG.md missing entry for version $plugin_version" |
| 193 | + fail=1 |
| 194 | + fi |
| 195 | +
|
| 196 | + [ $fail -eq 0 ] && echo "All versions consistent: $plugin_version" |
| 197 | + exit $fail |
| 198 | +
|
| 199 | + markdownlint: |
| 200 | + runs-on: ubuntu-latest |
| 201 | + steps: |
| 202 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 203 | + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 |
| 204 | + with: |
| 205 | + node-version: 22 |
| 206 | + - name: Run markdownlint |
| 207 | + run: npx markdownlint-cli2 "**/*.md" |
0 commit comments