Skip to content

Commit e5fe624

Browse files
committed
test: add test change to verify CI diff output
Also updated CI to run all three monitors: - assertion-monitor - batch-poster-monitor - retryable-monitor
1 parent 9f37a1c commit e5fe624

File tree

2 files changed

+48
-31
lines changed

2 files changed

+48
-31
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -166,28 +166,50 @@ jobs:
166166
with:
167167
node-version: 18.x
168168

169-
- name: Run monitoring on target branch
170-
id: target
169+
- name: Run monitors on target branch
171170
run: |
172171
cd target-branch
173172
yarn install --frozen-lockfile
173+
174+
# Build all monitors
174175
yarn workspace assertion-monitor build
175-
# Run monitoring with CI config and extract alert summary
176-
timeout 180s yarn workspace assertion-monitor dev --configPath=../../config.ci.json 2>&1 | tee output.txt || true
177-
# Extract alerts section
178-
sed -n '/Alert Summary/,$ p' output.txt > ../target-alerts.txt || echo "No alerts" > ../target-alerts.txt
176+
yarn workspace batch-poster-monitor build
177+
yarn workspace retryable-monitor build
178+
179+
# Run each monitor and capture output
180+
echo "=== ASSERTION MONITOR ===" > ../target-output.txt
181+
timeout 180s yarn workspace assertion-monitor dev --configPath=../../config.ci.json 2>&1 | tee -a ../target-output.txt || true
182+
183+
echo "" >> ../target-output.txt
184+
echo "=== BATCH POSTER MONITOR ===" >> ../target-output.txt
185+
timeout 180s yarn workspace batch-poster-monitor dev --configPath=../../config.ci.json 2>&1 | tee -a ../target-output.txt || true
186+
187+
echo "" >> ../target-output.txt
188+
echo "=== RETRYABLE MONITOR ===" >> ../target-output.txt
189+
timeout 180s yarn workspace retryable-monitor dev --configPath=../../config.ci.json 2>&1 | tee -a ../target-output.txt || true
179190
continue-on-error: true
180191

181-
- name: Run monitoring on PR branch
182-
id: pr
192+
- name: Run monitors on PR branch
183193
run: |
184194
cd pr-branch
185195
yarn install --frozen-lockfile
196+
197+
# Build all monitors
186198
yarn workspace assertion-monitor build
187-
# Run monitoring with CI config and extract alert summary
188-
timeout 180s yarn workspace assertion-monitor dev --configPath=../../config.ci.json 2>&1 | tee output.txt || true
189-
# Extract alerts section
190-
sed -n '/Alert Summary/,$ p' output.txt > ../pr-alerts.txt || echo "No alerts" > ../pr-alerts.txt
199+
yarn workspace batch-poster-monitor build
200+
yarn workspace retryable-monitor build
201+
202+
# Run each monitor and capture output
203+
echo "=== ASSERTION MONITOR ===" > ../pr-output.txt
204+
timeout 180s yarn workspace assertion-monitor dev --configPath=../../config.ci.json 2>&1 | tee -a ../pr-output.txt || true
205+
206+
echo "" >> ../pr-output.txt
207+
echo "=== BATCH POSTER MONITOR ===" >> ../pr-output.txt
208+
timeout 180s yarn workspace batch-poster-monitor dev --configPath=../../config.ci.json 2>&1 | tee -a ../pr-output.txt || true
209+
210+
echo "" >> ../pr-output.txt
211+
echo "=== RETRYABLE MONITOR ===" >> ../pr-output.txt
212+
timeout 180s yarn workspace retryable-monitor dev --configPath=../../config.ci.json 2>&1 | tee -a ../pr-output.txt || true
191213
continue-on-error: true
192214

193215
- name: Generate diff and post comment
@@ -196,26 +218,14 @@ jobs:
196218
script: |
197219
const fs = require('fs');
198220
199-
const targetAlerts = fs.existsSync('target-alerts.txt')
200-
? fs.readFileSync('target-alerts.txt', 'utf8').trim()
221+
const targetOutput = fs.existsSync('target-output.txt')
222+
? fs.readFileSync('target-output.txt', 'utf8').trim()
201223
: '';
202-
const prAlerts = fs.existsSync('pr-alerts.txt')
203-
? fs.readFileSync('pr-alerts.txt', 'utf8').trim()
224+
const prOutput = fs.existsSync('pr-output.txt')
225+
? fs.readFileSync('pr-output.txt', 'utf8').trim()
204226
: '';
205227
206-
const hasChanges = targetAlerts !== prAlerts;
207-
208-
let body = '';
209-
if (hasChanges) {
210-
body = `### ⚠️ Alert Output Changes
211-
212-
\`\`\`diff
213-
${generateDiff(targetAlerts, prAlerts)}
214-
\`\`\`
215-
`;
216-
} else {
217-
body = `### ✅ Alert Output: No Changes`;
218-
}
228+
const hasChanges = targetOutput !== prOutput;
219229
220230
// Simple line-by-line diff
221231
function generateDiff(oldText, newText) {
@@ -237,6 +247,13 @@ ${generateDiff(targetAlerts, prAlerts)}
237247
return diff.join('\n');
238248
}
239249
250+
let body = '';
251+
if (hasChanges) {
252+
body = '### ⚠️ Monitor Output Changes\n\n```diff\n' + generateDiff(targetOutput, prOutput) + '\n```';
253+
} else {
254+
body = '### ✅ Monitor Output: No Changes';
255+
}
256+
240257
// Find existing comment
241258
const { data: comments } = await github.rest.issues.listComments({
242259
owner: context.repo.owner,
@@ -246,7 +263,7 @@ ${generateDiff(targetAlerts, prAlerts)}
246263
247264
const botComment = comments.find(comment =>
248265
comment.user.type === 'Bot' &&
249-
comment.body.includes('Alert Output')
266+
comment.body.includes('Monitor Output')
250267
);
251268
252269
if (botComment) {

packages/assertion-monitor/alerts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const NO_CREATION_EVENTS_ALERT = `No assertion creation events found`
1+
export const NO_CREATION_EVENTS_ALERT = `No assertion creation events found (TEST CHANGE)`
22

33
export const CHAIN_ACTIVITY_WITHOUT_ASSERTIONS_ALERT = `Chain activity detected, but no assertions created in the last 4 hours`
44

0 commit comments

Comments
 (0)