-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (185 loc) · 6.8 KB
/
Copy pathci.yml
File metadata and controls
194 lines (185 loc) · 6.8 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
actions: read
contents: read
issues: write
jobs:
lint-and-typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Lint
run: pnpm lint
- name: Type-check
run: pnpm typecheck
- name: Format check
run: pnpm format:check
- name: Docs governance
run: pnpm docs:lint
- name: Skills validation
run: pnpm skills:lint
- name: Open ticket on failure
if: >-
failure() &&
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/ci-failure-ticket.sh "lint-and-typecheck" "${{ github.run_id }}"
go-qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: packages/golangci-lint/go.mod
- name: Verify Go formatting
run: test -z "$(cd packages/golangci-lint && gofmt -l analyzer plugin)"
- name: Verify Go analyzer
run: cd packages/golangci-lint && go test ./...
- name: Open ticket on failure
if: >-
failure() &&
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/ci-failure-ticket.sh "go-qa" "${{ github.run_id }}"
python-qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Verify Python checker
run: |
python3 -m unittest discover -s packages/python/tests -t packages/python
python3 -m compileall -q packages/python/codecontext_python
- name: Open ticket on failure
if: >-
failure() &&
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/ci-failure-ticket.sh "python-qa" "${{ github.run_id }}"
ruby-qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
- name: Verify Ruby checker
run: |
cd packages/ruby
ruby -Ilib -e 'Dir["test/**/*_test.rb"].sort.each { |file| require File.expand_path(file) }'
gem build codecontext-ruby.gemspec >/dev/null
rm -f codecontext-ruby-*.gem
- name: Open ticket on failure
if: >-
failure() &&
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/ci-failure-ticket.sh "ruby-qa" "${{ github.run_id }}"
test:
runs-on: ubuntu-latest
needs: [lint-and-typecheck, go-qa, python-qa, ruby-qa]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Run tests with coverage
run: pnpm --filter @recallnet/codecontext-parser test:coverage
- name: Open ticket on failure
if: >-
failure() &&
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/ci-failure-ticket.sh "test" "${{ github.run_id }}"
build-verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- uses: actions/setup-go@v5
with:
go-version-file: packages/golangci-lint/go.mod
- run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm build
- name: Verify CLI entry point
run: node packages/cli/dist/index.js --help
- name: Verify parser exports
run: node -e "const m = await import('./packages/parser/dist/index.js'); if (!m.parseContextTags) throw new Error('Missing export'); console.log('Parser exports OK');"
- name: Verify ESLint plugin exports
run: node -e "const m = await import('./packages/eslint-plugin/dist/index.js'); if (!m.default?.rules) throw new Error('Missing rules'); console.log('ESLint plugin exports OK');"
- name: Verify pi extension exports
run: node -e "const m = await import('./packages/pi/dist/index.js'); if (typeof m.default !== 'function') throw new Error('Missing extension export'); console.log('pi extension exports OK');"
- name: Verify Go analyzer package
run: pnpm go:test
- name: Open ticket on failure
if: >-
failure() &&
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/ci-failure-ticket.sh "build-verify" "${{ github.run_id }}"
changeset-check:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- name: Check for changesets
run: |
CHANGED=$(git diff --name-only origin/main...HEAD | grep -E '^packages/(parser|cli|eslint-plugin)/src/' || true)
if [ -n "$CHANGED" ]; then
CHANGESETS=$(git diff --name-only origin/main...HEAD | grep -E '^\.changeset/.*\.md$' || true)
if [ -z "$CHANGESETS" ]; then
echo "::warning::Source files changed in publishable packages but no changeset found. Run 'pnpm changeset' before merging."
fi
fi
- name: Open ticket on failure
if: >-
failure() &&
github.event.pull_request.head.repo.full_name == github.repository
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/ci-failure-ticket.sh "changeset-check" "${{ github.run_id }}"