-
Notifications
You must be signed in to change notification settings - Fork 273
163 lines (141 loc) · 6.18 KB
/
Copy pathci.yml
File metadata and controls
163 lines (141 loc) · 6.18 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Quality Checks
on:
pull_request:
branches:
- '**'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
python-version: ['3.13']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: pip install uv
- name: Setup uv virtual environment
run: uv venv
- name: Install dependencies
run: uv pip install -e .
- name: Install pexpect for integration tests
run: uv pip install pexpect>=4.9.0
- name: Provision CI model (lilac GLM-5.2 + Kimi K2.6)
# models.json ships empty. CI gets its model from extra_models.json,
# exactly like a real user would after running /add_model.
run: |
mkdir -p "$HOME/.code_puppy"
cat > "$HOME/.code_puppy/extra_models.json" <<'JSON'
{
"lilac-zai-org-glm-5.2": {
"type": "custom_openai",
"provider": "lilac",
"name": "zai-org/glm-5.2",
"custom_endpoint": {
"url": "https://api.getlilac.com/v1",
"api_key": "$LILAC_API_KEY"
},
"context_length": 524288,
"supported_settings": ["temperature", "seed", "top_p"]
},
"lilac-moonshotai-kimi-k2.6": {
"type": "custom_openai",
"provider": "lilac",
"name": "moonshotai/kimi-k2.6",
"custom_endpoint": {
"url": "https://api.getlilac.com/v1",
"api_key": "$LILAC_API_KEY"
},
"context_length": 262144,
"supported_settings": ["temperature", "seed", "top_p"]
}
}
JSON
# Tests isolate user config, and several fallback contracts require a
# non-empty bundled catalog.
cp "$HOME/.code_puppy/extra_models.json" code_puppy/models.json
echo "Wrote CI model catalog and test-only bundled fallback"
- name: Debug environment variables
env:
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY || 'fake-key-for-ci-testing' }}
CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY || 'fake-key-for-ci-testing' }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY || 'fake-key-for-ci-testing' }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY || 'fake-key-for-ci-testing' }}
SYN_API_KEY: ${{ secrets.SYN_API_KEY || 'fake-key-for-ci-testing' }}
LILAC_API_KEY: ${{ secrets.LILAC_API_KEY || 'fake-key-for-ci-testing' }}
run: |
echo "=== DEBUG: Environment Variables ==="
echo "CEREBRAS_API_KEY is set: ${{ secrets.CEREBRAS_API_KEY != '' }}"
echo "CONTEXT7_API_KEY is set: ${{ secrets.CONTEXT7_API_KEY != '' }}"
echo "OPENAI_API_KEY is set: ${{ secrets.OPENAI_API_KEY != '' }}"
echo "ANTHROPIC_API_KEY is set: ${{ secrets.ANTHROPIC_API_KEY != '' }}"
echo "SYN_API_KEY is set: ${{ secrets.SYN_API_KEY != '' }}"
echo "CEREBRAS_API_KEY length: ${#CEREBRAS_API_KEY}"
echo "CONTEXT7_API_KEY length: ${#CONTEXT7_API_KEY}"
echo "OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
echo "ANTHROPIC_API_KEY length: ${#ANTHROPIC_API_KEY}"
echo "SYN_API_KEY length: ${#SYN_API_KEY}"
echo "=== END DEBUG ==="
- name: Run tests
env:
CI: '1'
CODE_PUPPY_TEST_FAST: '1'
CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY || 'fake-key-for-ci-testing' }}
CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY || 'fake-key-for-ci-testing' }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY || 'fake-key-for-ci-testing' }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY || 'fake-key-for-ci-testing' }}
SYN_API_KEY: ${{ secrets.SYN_API_KEY || 'fake-key-for-ci-testing' }}
LILAC_API_KEY: ${{ secrets.LILAC_API_KEY || 'fake-key-for-ci-testing' }}
run: |
echo "Running unit tests (skipping integration tests) on ${{ runner.os }} with Python ${{ matrix.python-version }}..."
echo "Required environment variables are set (using CI fallbacks if secrets not available)"
uv run pytest tests/ --ignore tests/integration -v --cov=code_puppy --cov-report=term-missing
# The exec-runner UTF-8 pipe contract is a Windows-only failure mode: child
# Pythons attached to a pipe default their stdio to the legacy codepage
# (cp1252) and crash on emoji, while macOS/Linux children default to UTF-8 --
# so regressions are invisible on the main (macos) test job. The full suite
# has pre-existing, unrelated Windows failures, so this job deliberately
# scopes to the tests that pin the encoding contract instead of gating CI on
# a platform the suite has never run on. Widen it as Windows support grows.
windows-encoding:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
run: pip install uv
- name: Setup uv virtual environment
run: uv venv
- name: Install dependencies
run: uv pip install -e .
- name: Run Windows encoding regression tests
run: uv run pytest tests/test_windows_encoding.py -v --no-cov
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dev dependencies (ruff)
# Keep in sync with the ruff pin in pyproject.toml. Unpinned ruff let
# 0.16.0 sneak in and change the default rule set (5,901 "new" errors).
run: pip install 'ruff>=0.15,<0.16'
- name: Install code_puppy
run: pip install .
- name: Lint with ruff
run: ruff check .
- name: Check formatting with ruff
run: ruff format --check .