-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (109 loc) · 4.77 KB
/
Copy pathci.yml
File metadata and controls
114 lines (109 loc) · 4.77 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -e '.[dev]'
- name: Lint (Makefile lint target)
# Wire the repo Makefile lint target into CI: ruff check over tools/.
run: make lint
- name: consumer boundary guard
run: bash ./scripts/check-consumer-boundaries.sh
- name: Compile category payload scripts
# Syntax-check shipped skill scripts so a SyntaxError in
# categories/**/scripts/*.py fails the build (they are never imported
# by the test suite).
run: python3 -m compileall -q categories
- name: Correctness and TLS-safety ratchet for changed scripts
env:
BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
changed="$(git diff --name-only "$BASE_REF" HEAD)"
python3 tools/check_changed_scripts.py $changed
- name: Validate all skills
run: >-
python3 tools/validate_skill.py --all
--warning-budget tools/validation_warning_budget.json
- name: Registry drift check
run: python3 tools/update_registry.py --check
- name: Run tests
run: python -m pytest tests/ -v --cov --cov-report=term-missing --cov-fail-under=88
- name: Packaging smoke check
run: make package-check
- name: Security audit
run: python3 tools/check_secrets.py --strict
- name: Shell-command audit
run: python3 tools/check_shell_commands.py --strict
- name: Dependency security audit
run: pip-audit -r tools/requirements.txt
# -------------------------------------------------------------------------
# Sandbox containment check for changed skill scripts. Deliberately scoped
# to changed files only (mirrors the ratchet job above) — see
# tools/sandbox_run_changed_scripts.py's module docstring for exactly what
# this does and does not prove: it checks that network/filesystem/
# resource isolation actually holds when a changed script is invoked with
# --help, not that the script's real business logic (which routinely
# needs cloud credentials, live network targets, or external binaries
# this CI must never provide) is safe or correct.
# -------------------------------------------------------------------------
sandbox:
name: sandbox (changed scripts containment check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Build sandbox image
# Built fresh (with layer caching) rather than pulled from a
# previously-published tag, so the sandbox always matches this
# exact commit's Dockerfile.sandbox / sandbox_requirements.txt —
# no version-skew risk between what's tested and what's pushed.
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
file: Dockerfile.sandbox
tags: graycode-skills-sandbox:ci
push: false
load: true
cache-from: type=gha,scope=sandbox
cache-to: type=gha,mode=max,scope=sandbox
- name: Sandbox-test changed scripts
env:
BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
changed="$(git diff --name-only "$BASE_REF" HEAD)"
python3 tools/sandbox_run_changed_scripts.py --image graycode-skills-sandbox:ci $changed
# -------------------------------------------------------------------------
# Duplication detection — jscpd (scan categories with reasonable thresholds).
# -------------------------------------------------------------------------
jscpd:
name: duplication
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '20'
- name: jscpd
run: |
npx jscpd --min-lines 15 --min-tokens 150 --threshold 5 --reporters console \
--ignore "docs/**,plans/**,tools/**" . 2>&1 | tail -30