Skip to content

Periodic Tests

Periodic Tests #9001

Workflow file for this run

name: Periodic Tests
on:
schedule:
- cron: '*/10 * * * *'
workflow_dispatch:
inputs:
dev:
description: 'Only testing the workflow'
required: false
default: false
type: boolean
push:
branches:
- main
# only run on changes to periodic-test dir
paths:
- 'tests/periodic-test/**'
- '.github/workflows/periodic-test.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
jobs:
changes:
name: Check
runs-on: ubuntu-22.04
strategy:
matrix:
# each domain is a different cluster
e2b-domain:
- "e2b-foxtrot.dev"
- "e2b-juliett.dev"
- "e2b-staging.dev"
include:
- e2b-domain: "e2b-foxtrot.dev"
api_key: E2B_API_KEY
access_token: E2B_ACCESS_TOKEN
slack_channel: monitoring-infra
- e2b-domain: "e2b-juliett.dev"
api_key: E2B_API_KEY_JULIETT
access_token: E2B_ACCESS_TOKEN_JULIETT
slack_channel: monitoring-infra
- e2b-domain: "e2b-staging.dev"
api_key: E2B_API_KEY
access_token: E2B_ACCESS_TOKEN
slack_channel: monitoring-infra-staging
test-command:
- command: "tests/periodic-test/run-code.ts"
name: "run code in sandbox"
- command: "index.ts"
name: "template builds && time is synchronized"
dir: "tests/periodic-test/time-is-synchronized/"
- command: "tests/periodic-test/snapshot-and-resume.ts"
name: "pause and resume sandbox"
- command: "tests/periodic-test/internet-works.ts"
name: "internet connectivity inside of sandbox"
# - command: "tests/periodic-test/cli-logs.ts"
# name: "cli logs"
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install deno
uses: denoland/setup-deno@v2
- name: GitHub Action for npx
uses: mikeal/npx@1.0.0
- name: Set env variables from secrets
if: always()
run: |
echo "E2B_API_KEY=${{ secrets[format('{0}', matrix.api_key)] }}" >> $GITHUB_ENV
echo "E2B_ACCESS_TOKEN=${{ secrets[format('{0}', matrix.access_token)] }}" >> $GITHUB_ENV
- name: Set Slack channel based on dev input
if: always()
run: |
if [ "${{ inputs.dev }}" == "true" ]; then
echo "SLACK_CHANNEL=monitoring-infra-testing" >> $GITHUB_ENV
else
echo "SLACK_CHANNEL=${{ matrix.slack_channel }}" >> $GITHUB_ENV
fi
- name: ${{ matrix.test-command.name }}
run: deno run --allow-all ${{ matrix.test-command.command }}
working-directory: ${{ matrix.test-command.dir }}
env:
E2B_API_KEY: ${{ env.E2B_API_KEY }}
E2B_ACCESS_TOKEN: ${{ env.E2B_ACCESS_TOKEN }}
E2B_DOMAIN: ${{ matrix.e2b-domain }}
- name: Periodic check failed - Slack Notification
uses: rtCamp/action-slack-notify@v2
if: failure()
env:
SLACK_COLOR: "#ff0000"
SLACK_USERNAME: "Periodic Check"
MSG_MINIMAL: true
SLACK_FOOTER: ""
SLACKIFY_MARKDOWN: true
# $name failed $link to workflow run
SLACK_MESSAGE: "Check for **${{ matrix.test-command.name }}** failed \n ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
SLACK_TITLE: "[${{ matrix.e2b-domain }}] check failed"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ env.SLACK_CHANNEL }}