Repository navigation
142 lines (137 loc) · 5.89 KB
/
Copy pathci.yml
File metadata and controls
142 lines (137 loc) · 5.89 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
134
135
136
137
138
139
140
141
142
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Atri10
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
tests:
name: Engine suite (${{ matrix.os }}, shard ${{ matrix.shard }})
# Three OSes, always. The engine ships to users on macOS, Linux and
# Windows, and the platform differences that bite are the ones CI never
# ran: path separators, a filename that is legal on one and not the
# other, and UTF-8 output under a legacy console. A Linux-only gate
# catches none of them.
runs-on: ${{ matrix.os }}
# A racing or hung suite must fail fast. The v2.2.0 run spent 33 minutes on
# Windows inside a provisioning race before reporting, and 45 minutes in
# total. Every shard now has a budget it can actually meet; a red job is
# useful in minutes, not hours.
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
# The 100% floor is measured once per architecture, on the platforms
# that finish it comfortably: Ubuntu in ~3.5 min, macOS in ~9.
- os: ubuntu-latest
shard: "1/1"
cover: "true"
- os: macos-latest
shard: "1/1"
cover: "true"
# Windows process creation is order-of-magnitude slower: one job could
# not finish 930 tests inside 25 minutes. Four shards run the same
# suite in parallel, behavior-only. The same source still meets the
# branch floor on Linux and macOS, so a Windows-only gap has to be a
# branch that does not exist on the other platforms.
- os: windows-latest
shard: "1/4"
cover: "false"
- os: windows-latest
shard: "2/4"
cover: "false"
- os: windows-latest
shard: "3/4"
cover: "false"
- os: windows-latest
shard: "4/4"
cover: "false"
env:
# The engine is a package under engine/, not installed; run_tests.py
# bootstraps this itself, but `python -m executor` does not.
PYTHONPATH: engine
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install the one dev tool (coverage)
# The engine has zero runtime dependencies; coverage is the only
# tool run_tests.py needs, and it refuses to report a branch floor
# it cannot measure rather than silently skipping it.
run: python -m pip install -r requirements-dev.txt
- name: Entry point (python -m executor)
# Proves the package runs as a module on this platform, not just
# when its test runner imports it.
run: python -m executor --version
- name: Suite at 100% branch coverage
# run_tests.py is the only entry point: it runs the suite AND
# enforces the fail_under=100 branch floor from pyproject.toml. A
# green suite below 100% fails this step by design.
if: matrix.cover == 'true'
run: python scripts/run_tests.py --shard ${{ matrix.shard }}
- name: Suite (behavior; the floor is measured on Linux and macOS)
# A sharded run covers part of the program, so run_tests.py reports the
# floor without enforcing it. Every test still runs, just in parallel.
if: matrix.cover == 'false'
run: python scripts/run_tests.py --no-cover --shard ${{ matrix.shard }}
contract:
name: Skill contract and prompt lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Skill files, registry, payload shapes, refusals
# validate_skills.py checks frontmatter, the dispatch registry,
# that no prompt teaches a second markdown renderer, that every
# payload-writing prompt states the refusal contract, and that no
# ID example or JSON skeleton teaches something the engine rejects.
run: python scripts/validate_skills.py
- name: The bundled engine matches the engine source
# Users install the skill, and the skill carries the engine. The
# bundle is generated, so a change to engine/executor/ that misses
# the bundle would ship one engine and test another.
run: python scripts/sync_engine.py --check
- name: The installed skill runs with no PYTHONPATH
# The claim in the README, executed: copy the skill out of the repo,
# drop PYTHONPATH, and run the launcher from an unrelated directory.
run: |
set -e
dest="$(mktemp -d)"
cp -R skills/executor "$dest/executor"
cd "$dest"
env -u PYTHONPATH python3 executor/scripts/executor --version
- name: Prompt-injection lint
# Every SKILL.md is executed as instruction by agents. This blocks
# override directives, concealment, exfiltration endpoints,
# fetch-and-execute, and credential literals from entering main.
run: python scripts/lint-prompt-injection.py skills/
secret-scan:
name: Secret scan (both stores)
runs-on: ubuntu-latest
env:
PYTHONPATH: engine
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: The engine's own scanner finds nothing in a store it just wrote
# Not a lint of this file: this runs the shipped `executor check
# --secrets` against a real initiative, so the scanner that users
# depend on is exercised here, and it must report no findings.
run: |
set -e
git config user.email ci@example.com
git config user.name ci
python -m executor new "ci secret-scan smoke"
python -m executor check --secrets
- name: Gitleaks (defense in depth, full history)
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}