Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Autoblocks Simulations #43

Autoblocks Simulations

Autoblocks Simulations #43

name: Autoblocks Simulations
on:
push:
schedule:
- cron: "17 12 * * *"
env:
POETRY_VERSION: "1.5.1"
PYTHON_VERSION: "3.11"
# Use the simulation ingestion key so that Autoblocks knows we're sending simulated events
AUTOBLOCKS_INGESTION_KEY: ${{ secrets.AUTOBLOCKS_SIMULATION_INGESTION_KEY }}
# Any other environment variables the application needs to run
OPENAI_API_KEY: ${{ secrets.DEMO_OPENAI_API_KEY }}
jobs:
autoblocks-simulations:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: poetry install
- name: Run tests
run: poetry run pytest
- name: Start the app
run: poetry run start &
- name: Wait for the app to be ready
run: |
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5000/health)" != "200" ]]; do sleep 1; done
- name: Run simulation with production test cases
run: poetry run simulation-production-replay
env:
# Production events are fetched from the Autoblocks API,
# so we need the API key to authenticate.
AUTOBLOCKS_API_KEY: ${{ secrets.AUTOBLOCKS_API_KEY }}