Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy Checkly monitoring

on:
push:
branches: [main]

concurrency:
group: deploy-checkly
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
env:
CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }}
CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Format check
run: npm run format:check

- name: Typecheck
run: npm run typecheck

- name: Unit tests
run: npm test

- name: Run Checkly checks
run: npx checkly test --record

- name: Deploy to Checkly
run: npx checkly deploy --force
32 changes: 32 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Verify

on:
push:
branches: [main]
pull_request:

jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Format check
run: npm run format:check

- name: Typecheck
run: npm run typecheck

- name: Unit tests
run: npm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
.DS_Store
*.log
.env
test-results
4 changes: 2 additions & 2 deletions checkly.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { defineConfig } from "checkly";
import { Frequency } from "checkly/constructs";

export default defineConfig({
projectName: "Checkly Plugin Skills Monitoring",
logicalId: "checkly-plugin-skills-monitoring",
projectName: "Checkly Plugin and AI Context",
logicalId: "checkly-plugin-and-ai-context",
repoUrl: "https://github.com/checkly/checkly-plugin",
checks: {
activated: true,
Expand Down
5 changes: 5 additions & 0 deletions checks/ai-context.group.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { CheckGroupV2 } from "checkly/constructs";

export const aiContextGroup = new CheckGroupV2("ai-context", {
name: "checkly-plugin & AI-Context",
});
16 changes: 7 additions & 9 deletions checks/checkly-skill-sync.check.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { MultiStepCheck, RetryStrategyBuilder } from "checkly/constructs";
import { AlertChannel, PlaywrightCheck } from "checkly/constructs";
import { aiContextGroup } from "./ai-context.group.ts";

new MultiStepCheck("checkly-skill-sync", {
new PlaywrightCheck("checkly-skill-sync", {
name: "Checkly skill sync",
description:
"Compares the Checkly skill included in checkly/checkly-plugin with the source skill in checkly/checkly-cli.",
code: {
entrypoint: "./checkly-skill-sync.spec.ts",
},
playwrightConfigPath: "../playwright.config.ts",
include: ["skills/checkly/**"],
activated: true,
retryStrategy: RetryStrategyBuilder.singleRetry({
baseBackoffSeconds: 60,
sameRegion: true,
}),
runParallel: false,
alertChannels: [AlertChannel.fromId(287691)],
group: aiContextGroup,
});
43 changes: 26 additions & 17 deletions checks/checkly-skill-sync.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { expect, test, type APIRequestContext } from "@playwright/test";
import { readFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { buildRawUrl } from "../scripts/sync.ts";
import { config } from "../skills.config.ts";

const files = ["SKILL.md", "README.md"] as const;
const includedBaseUrl =
"https://raw.githubusercontent.com/checkly/checkly-plugin/main/skills/checkly";
const originalBaseUrl = "https://raw.githubusercontent.com/checkly/checkly-cli/main/skills/checkly";
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");

async function fetchText(request: APIRequestContext, url: string) {
const response = await request.get(url);
Expand All @@ -13,17 +15,24 @@ async function fetchText(request: APIRequestContext, url: string) {
return response.text();
}

test.describe("included Checkly skill", () => {
for (const file of files) {
test(`${file} matches the checkly-cli source`, async ({ request }) => {
const includedUrl = `${includedBaseUrl}/${file}`;
const originalUrl = `${originalBaseUrl}/${file}`;
const [included, original] = await Promise.all([
fetchText(request, includedUrl),
fetchText(request, originalUrl),
]);
for (const skill of config.skills) {
test.describe(`included '${skill.name}' skill`, () => {
for (const file of skill.files) {
test(`${file} matches the ${skill.source.repo} source`, async ({ request }) => {
const localPath = resolve(repoRoot, "skills", skill.name, file);
const upstreamUrl = buildRawUrl({
repo: skill.source.repo,
ref: skill.source.ref,
path: skill.source.path,
file,
});
const [local, upstream] = await Promise.all([
readFile(localPath, "utf8"),
fetchText(request, upstreamUrl),
]);

expect(included, `${includedUrl} should match ${originalUrl}`).toBe(original);
});
}
});
expect(local, `${localPath} should match ${upstreamUrl}`).toBe(upstream);
});
}
});
}
6 changes: 6 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from "@playwright/test";

export default defineConfig({
testDir: "./checks",
retries: process.env.CHECKLY ? 1 : 0,
});
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"include": [
"checkly.config.ts",
"checks/**/*.ts",
"playwright.config.ts",
"skills.config.ts",
"scripts/**/*.ts",
"test/**/*.ts"
Expand Down
Loading