-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
7,324 additions
and
1,863 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: API Checks | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }} | ||
CHECKLY_ACCOUNT_ID: ${{ vars.CHECKLY_ACCOUNT_ID }} | ||
ENVIRONMENT_URL: https://0ad703f2f45143aea75b9a469dc41338.api.mockbin.io | ||
CHECKLY_TEST_ENVIRONMENT: production | ||
GITHUB_NPM_TOKEN: ${{ secrets.GH_NPM_PACKAGE_READ_TOKEN }} | ||
|
||
jobs: | ||
checkly: | ||
name: Deploy Checks | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
environment: production | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Deploy checks | ||
id: deploy-checks | ||
run: npx checkly deploy --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { defineConfig } from "checkly"; | ||
|
||
/** | ||
* See https://www.checklyhq.com/docs/cli/project-structure/ | ||
*/ | ||
const config = defineConfig({ | ||
projectName: "Mockbin", | ||
logicalId: "mockbin", | ||
repoUrl: "https://github.com/zuplo/mockbin", | ||
checks: { | ||
runtimeId: "2024.02", | ||
checkMatch: "checks/**/*.check.ts", | ||
tags: ["service-mockbin", "priority-in-hours"], | ||
}, | ||
cli: { | ||
runLocation: "us-east-1", | ||
reporters: ["list"], | ||
retries: 0, | ||
}, | ||
}); | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { asserts, check } from "./group"; | ||
|
||
check({ | ||
name: "Should 200 requesting a mock", | ||
shouldFail: false, | ||
request: { | ||
url: `/`, | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}, | ||
assertions: [asserts().statusCode().equals(200)], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* eslint-disable node/no-process-env */ | ||
/** | ||
* This is a Checkly CLI CheckGroup construct. To learn more, visit: | ||
* - https://www.checklyhq.com/docs/cli/ | ||
* - https://www.checklyhq.com/docs/cli/constructs-reference/#checkgroup | ||
*/ | ||
|
||
import { ApiCheckOptions, asserts, check as baseCheck } from "@zuplo/checkly"; | ||
import { | ||
AlertEscalationBuilder, | ||
CheckGroup, | ||
Frequency, | ||
RetryStrategyBuilder, | ||
WebhookAlertChannel, | ||
} from "checkly/constructs"; | ||
|
||
export const incidentChannel = WebhookAlertChannel.fromId(231732); | ||
|
||
// Alert after 2 failed runs | ||
const alertEscalationPolicy = AlertEscalationBuilder.runBasedEscalation(2); | ||
|
||
export const group = new CheckGroup("mockbin", { | ||
name: "Mockbin", | ||
activated: true, | ||
muted: false, | ||
runParallel: true, | ||
locations: ["us-east-1", "eu-west-1", "ap-southeast-2"], | ||
tags: [], | ||
alertChannels: [incidentChannel], | ||
alertEscalationPolicy, | ||
frequency: Frequency.EVERY_1H, | ||
concurrency: 1, | ||
apiCheckDefaults: { | ||
url: process.env.ENVIRONMENT_URL ?? "http://localhost:3000", | ||
queryParameters: [], | ||
}, | ||
retryStrategy: RetryStrategyBuilder.linearStrategy({ | ||
baseBackoffSeconds: 30, | ||
maxRetries: 2, | ||
maxDurationSeconds: 600, | ||
sameRegion: true, | ||
}), | ||
}); | ||
|
||
const check = (props: Omit<ApiCheckOptions, "group">) => | ||
baseCheck({ ...props, group }); | ||
|
||
export { asserts, check }; |
Oops, something went wrong.