Skip to content

feat(monitoring): weekly canary cron to verify Sentry alerting chain #92

feat(monitoring): weekly canary cron to verify Sentry alerting chain

feat(monitoring): weekly canary cron to verify Sentry alerting chain #92

Workflow file for this run

name: CI / Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
repository_dispatch:
types: [contract-updated]
jobs:
check:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Type check
run: npm run check
- name: Run tests with coverage
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
use_oidc: true
files: ./coverage/coverage-final.json
flags: unittests
name: openboot-web-coverage
fail_ci_if_error: false
- name: Build
run: npm run build
- name: Contract schema validation
run: |
git clone --depth 1 https://github.com/openbootdotdev/openboot-contract.git /tmp/contract
pip install jsonschema
python3 -c "
import json, jsonschema, sys
checks = [
('/tmp/contract/schemas/remote-config.json', '/tmp/contract/fixtures/config-v1.json'),
('/tmp/contract/schemas/snapshot.json', '/tmp/contract/fixtures/snapshot-v1.json'),
]
failed = 0
for schema_path, fixture_path in checks:
schema = json.load(open(schema_path))
data = json.load(open(fixture_path))
try:
jsonschema.validate(data, schema)
print(f' ✓ {fixture_path.split(\"/\")[-1]} matches {schema_path.split(\"/\")[-1]}')
except jsonschema.ValidationError as e:
print(f' ✗ {fixture_path.split(\"/\")[-1]}: {e.message}')
failed += 1
# Also validate the packages schema structure against package-metadata expectations
pkg_schema = json.load(open('/tmp/contract/schemas/packages.json'))
required_fields = set(pkg_schema['properties']['packages']['items']['required'])
expected = {'name', 'desc', 'category', 'type', 'installer'}
if required_fields != expected:
print(f' ✗ packages schema required fields mismatch: {required_fields} vs {expected}')
failed += 1
else:
print(f' ✓ packages schema has correct required fields')
sys.exit(1 if failed else 0)
"
deploy:
needs: check
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Build
run: npm run build
- name: Run D1 Migrations
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: npx wrangler d1 migrations apply openboot --remote
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Health Check
run: |
echo "Waiting 10 seconds for deployment to propagate..."
sleep 10
echo "Running health check..."
HEALTH_RESPONSE=$(curl -s https://openboot.dev/api/health)
echo "Health check response: $HEALTH_RESPONSE"
STATUS=$(echo $HEALTH_RESPONSE | jq -r '.status')
if [ "$STATUS" != "healthy" ]; then
echo "Health check failed! Status: $STATUS"
echo "Full response: $HEALTH_RESPONSE"
exit 1
fi
echo "Health check passed!"
echo "API: $(echo $HEALTH_RESPONSE | jq -r '.checks.api')"
echo "Database: $(echo $HEALTH_RESPONSE | jq -r '.checks.database')"
echo "Version: $(echo $HEALTH_RESPONSE | jq -r '.version')"
- name: Post-deploy smoke test
run: ./scripts/smoke-test-api.sh https://openboot.dev
- name: Post-deploy contract validation
run: |
pip install jsonschema
git clone --depth 1 https://github.com/openbootdotdev/openboot-contract.git /tmp/contract
SERVER_URL=https://openboot.dev /tmp/contract/golden-path/contract-smoke.sh