Repository navigation
258 lines (198 loc) · 6.53 KB
/
Copy pathci.yml
File metadata and controls
258 lines (198 loc) · 6.53 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm test
- name: Build TypeScript
run: npm run build
integration-test:
name: Integration Test
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build and bundle
run: npm run package
- name: Create test fixture
run: |
mkdir -p test-fixture/docs
mkdir -p test-fixture/guides
cat > test-fixture/docs/getting-started.md << 'EOF'
# Getting Started
Learn how to get started with our project.
## Installation
Install the package using npm.
EOF
cat > test-fixture/docs/api-reference.md << 'EOF'
# API Reference
Complete API documentation for developers.
## Methods
Available methods and their usage.
EOF
cat > test-fixture/guides/tutorial.md << 'EOF'
# Tutorial
Step-by-step tutorial for beginners.
## Step 1
First step of the tutorial.
EOF
cat > test-fixture/README.md << 'EOF'
# Test Project
This is a test project for integration testing.
EOF
- name: Run action on test fixture
uses: ./
with:
input-directory: 'test-fixture'
output-directory: 'test-fixture'
base-url: 'https://example.com'
project-name: 'Test Project'
project-description: 'Integration test project'
sections: |
{
"Docs": "docs/**",
"Guides": "guides/**",
"General": "*.md"
}
- name: Verify generated files
run: |
echo "Checking for generated files..."
if [ ! -f test-fixture/llms.txt ]; then
echo "❌ llms.txt not found"
exit 1
fi
if [ ! -f test-fixture/llms-full.txt ]; then
echo "❌ llms-full.txt not found"
exit 1
fi
echo "✅ Both files generated successfully"
echo ""
echo "=== llms.txt content ==="
cat test-fixture/llms.txt
echo ""
echo "=== llms-full.txt content ==="
cat test-fixture/llms-full.txt
- name: Validate llms.txt structure
run: |
echo "Validating llms.txt structure..."
# Check for project name header
if ! grep -q "# Test Project" test-fixture/llms.txt; then
echo "❌ Project name header not found"
exit 1
fi
# Check for description
if ! grep -q "> Integration test project" test-fixture/llms.txt; then
echo "❌ Project description not found"
exit 1
fi
# Check for sections
if ! grep -q "## Docs" test-fixture/llms.txt; then
echo "❌ Docs section not found"
exit 1
fi
if ! grep -q "## Guides" test-fixture/llms.txt; then
echo "❌ Guides section not found"
exit 1
fi
# Check for links
if ! grep -q "https://example.com" test-fixture/llms.txt; then
echo "❌ Base URL not found in links"
exit 1
fi
echo "✅ llms.txt structure is valid"
- name: Validate llms-full.txt structure
run: |
echo "Validating llms-full.txt structure..."
# Check for source attribution
if ! grep -q "Source: https://example.com" test-fixture/llms-full.txt; then
echo "❌ Source attribution not found"
exit 1
fi
# Check for content from markdown files
if ! grep -q "Getting Started" test-fixture/llms-full.txt; then
echo "❌ Content from getting-started.md not found"
exit 1
fi
if ! grep -q "API Reference" test-fixture/llms-full.txt; then
echo "❌ Content from api-reference.md not found"
exit 1
fi
echo "✅ llms-full.txt structure is valid"
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-output
path: |
test-fixture/llms.txt
test-fixture/llms-full.txt
bundle:
name: Bundle
runs-on: ubuntu-latest
needs: [test, integration-test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build and bundle
run: npm run package
- name: Check bundle size
run: |
BUNDLE_SIZE=$(stat -f%z dist/index.js 2>/dev/null || stat -c%s dist/index.js)
echo "Bundle size: $BUNDLE_SIZE bytes"
# Warn if bundle is larger than 5MB
if [ $BUNDLE_SIZE -gt 5242880 ]; then
echo "⚠️ Warning: Bundle size is larger than 5MB"
else
echo "✅ Bundle size is acceptable"
fi
- name: Upload bundle artifact
uses: actions/upload-artifact@v4
with:
name: action-bundle
path: dist/
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check TypeScript compilation
run: npx tsc --noEmit