-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (153 loc) · 5.08 KB
/
ci.yml
File metadata and controls
188 lines (153 loc) · 5.08 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
name: CI/CD Pipeline
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
# Enable CodeQL permissions for this workflow
permissions:
security-events: write
actions: read
contents: read
# Disable CodeQL
env:
CODEQL_ACTION_DISABLE: true
CODEQL_ACTION_FEATURE_MULTI_LANGUAGE: false
CODEQL_ACTION_FEATURE_SARIF_COMBINE: false
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.19.6]
steps:
- name: Disable CodeQL
run: |
echo "CODEQL_DISABLED=true" >> $GITHUB_ENV
# Kill any existing CodeQL processes
pkill -f codeql || true
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Run postinstall configuration
run: npm run postinstall
- name: Validate postinstall files
run: node scripts/mjs/test-postinstall-files.mjs
- name: Setup CI paths
run: node scripts/node/setup-ci-paths.cjs
- name: TypeScript type check
run: npm run typecheck
- name: Lint code
run: npm run lint
- name: Build project
run: npm run build:all
- name: Run unit tests
run: |
npm run test:unit || (echo "Retrying with clean install..." && rm -rf node_modules package-lock.json && npm install --ignore-scripts && npm run test:unit)
- name: Run integration tests
run: npm run test:integration
- name: Run security audit
run: npm run security-audit
build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Disable CodeQL
run: |
echo "CODEQL_DISABLED=true" >> $GITHUB_ENV
pkill -f codeql || true
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.19"
cache: "npm"
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build plugin
run: npm run build
- name: Build all
run: npm run build:all
- name: Validate package
run: npm pack --dry-run
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: strray-ai-build
path: dist/
retention-days: 30
publish:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Disable CodeQL
run: |
echo "CODEQL_DISABLED=true" >> $GITHUB_ENV
pkill -f codeql || true
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.19"
cache: "npm"
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build for publish
run: npm run build
# NPM Orchestration Test - disabled, run manually if needed
# npm-orchestration-test:
# runs-on: ubuntu-latest
# needs: test
# if: github.event_name == 'push' || github.event_name == 'pull_request'
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Setup Node.js 20.x
# uses: actions/setup-node@v4
# with:
# node-version: 20.x
# cache: npm
# - name: Run CI NPM Orchestration Test
# run: bash scripts/bash/ci-npm-orchestration-test.sh
# timeout-minutes: 10
# env:
# PROJECT_DIR: ${{ github.workspace }}
# - name: Upload test artifacts on failure
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: npm-test-logs-${{ github.run_id }}
# path: /tmp/strray-ci-test-*/logs/
- name: Run CI NPM Orchestration Test
run: bash scripts/bash/ci-npm-orchestration-test.sh
timeout-minutes: 10
env:
PROJECT_DIR: ${{ github.workspace }}
- name: Upload test artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: npm-test-logs-${{ github.run_id }}
path: /tmp/strray-ci-test-*/logs/
retention-days: 7
- name: Comment PR on failure
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ **NPM Orchestration Test Failed**\n\nThe npm package installation and/or path transformation failed.\n\nPlease check:\n1. Postinstall script transforms paths correctly\n2. Plugin paths point to node_modules/strray-ai/\n3. MCP server paths are transformed\n\nSee workflow logs for details.'
})