-
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (86 loc) · 2.87 KB
/
test.yml
File metadata and controls
106 lines (86 loc) · 2.87 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
name: test
on: [push, pull_request]
permissions:
contents: read
jobs:
unit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
cache: npm
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci --prefer-offline
- name: Run unit tests
run: npm run test:ci
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
integration:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
cache: npm
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci --prefer-offline
- name: Build package
run: npm run build
- name: Verify CLI via npm exec
run: |
package_archive=$(npm pack | tail -n 1)
temp_dir=$(mktemp -d)
cd "$temp_dir"
output=$(npm exec --yes --package "${GITHUB_WORKSPACE}/${package_archive}" code-ollama -- --help)
printf '%s\n' "$output"
grep -F "code-ollama" <<< "$output"
grep -F "run <model> <prompt>" <<< "$output"
- name: Setup Ollama
uses: ai-action/setup-ollama@v2
- name: Install CLI
run: |
package_archive=$(npm pack | tail -n 1)
npm install --global "./$package_archive"
- name: Verify CLI version
run: |
actual=$(code-ollama --version)
printf '%s\n' "$actual"
expected="$(node -p "require('./package.json').version")"
grep -F "$expected" <<< "$actual"
- name: Verify CLI help
run: |
output=$(code-ollama --help)
printf '%s\n' "$output"
grep -F "code-ollama" <<< "$output"
grep -F "run <model> <prompt>" <<< "$output"
- name: Cache model
uses: actions/cache@v5
with:
path: ~/.ollama
key: ${{ runner.os }}-ollama
- name: Pull model
run: ollama pull gemma4:e2b
# Change year to 2025 so AI can edit it back to 2026
- name: Setup test
run: |
sed -i 's/Copyright (c) 2026/Copyright (c) 2025/' LICENSE
grep -F "2025" LICENSE
- name: Edit with CLI
run: |
output=$(timeout 300s code-ollama run gemma4:e2b "Change 2025 to 2026 in ./LICENSE")
printf '%s\n' "$output"
test -n "$output"
! grep -F "Error:" <<< "$output"
- name: Verify edit
run: |
grep -F "Copyright (c) 2026" LICENSE
! grep -F "2025" LICENSE || (echo "Year 2025 still present in LICENSE" && exit 1)