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
49 changes: 49 additions & 0 deletions .github/workflows/pre_production_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run Pre-Production Validation Tests

on:
workflow_dispatch:
inputs:
eval_function:
type: string
description: "The name of the evaluation function to test"
required: true
sql_limit:
type: number
description: "The maximum number of SQL test cases to run"
required: false
default: 500
seed:
type: string
description: "Random seed for reproducible sampling (float in [-1.0, 1.0]). Leave blank to auto-generate."
required: false
default: ''
request_delay:
type: string
description: "Delay (seconds) between dispatching requests"
required: false
default: '0'
max_concurrency:
type: string
description: "Max concurrent requests (lower for GPT-backed functions)"
required: false
default: '5'

jobs:
run-pre-production-tests:
name: 🧪 Run Staging Validation Tests
uses: lambda-feedback/Database-Testing/.github/workflows/test_evaluation_function.yml@main
with:
eval_function: ${{ inputs.eval_function }}
sql_limit: ${{ inputs.sql_limit }}
seed: ${{ inputs.seed }}
request_delay: ${{ inputs.request_delay }}
max_concurrency: ${{ inputs.max_concurrency }}
secrets:
TEST_API_ENDPOINT: ${{ secrets.TEST_API_ENDPOINT }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_NAME: ${{ secrets.DB_NAME }}
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_DB_CREDS }}
GCP_PROJECT_ID: ${{ secrets.GCP_DB_PROJECT_ID }}
63 changes: 63 additions & 0 deletions .github/workflows/production-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy to Production

on:
workflow_dispatch:
inputs:
version-bump:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major
default: patch
branch:
description: 'Branch to release from'
required: true
type: string
default: 'main'
seed:
description: 'Random seed for reproducible sampling (float in [-1.0, 1.0]). Leave blank to auto-generate.'
required: false
type: string
default: ''
request_delay:
description: 'Delay (seconds) between dispatching requests'
required: false
type: string
default: '0'
max_concurrency:
description: 'Max concurrent requests (lower for GPT-backed functions)'
required: false
type: string
default: '5'
jobs:
deploy:
uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@main
with:
template-repository-name: 'lambda-feedback/evaluation-function-boilerplate-python'
build-file: "app/Dockerfile"
build-context: "./app"
environment: "production"
version-bump: ${{ inputs.version-bump }}
branch: ${{ inputs.branch }}
run-database-tests: false # LLM-backed: database tests call OpenAI
seed: ${{ inputs.seed }}
request_delay: ${{ inputs.request_delay }}
max_concurrency: ${{ inputs.max_concurrency }}

secrets:
aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
function-admin-api-key-staging: ${{ secrets.FUNCTION_ADMIN_API_KEY_STAGING }}
function-admin-api-key-production: ${{ secrets.FUNCTION_ADMIN_API_KEY_PRODUCTION }}
gcp_credentials: ${{ secrets.GCP_DEPLOY }}
TEST_API_ENDPOINT: ${{ secrets.TEST_API_ENDPOINT }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_NAME: ${{ secrets.DB_NAME }}
GCP_DB_CREDS: ${{ secrets.GCP_DB_CREDS }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
62 changes: 62 additions & 0 deletions .github/workflows/staging-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Deploy to Staging

on:
push:
branches:
- main
workflow_dispatch:

jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
checks: write
pull-requests: write
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: python-setup
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m venv .venv
.venv/bin/pip install pytest
.venv/bin/pip install -r app/requirements.txt


- name: Lint with flake8
run: |
source .venv/bin/activate
.venv/bin/pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 ./app --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./app --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# Tests are disabled in CI: they call the OpenAI API.
deploy:
needs: test
uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@main
with:
template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python"
build-file: "app/Dockerfile"
build-context: "./app"
build-platforms: "aws"
environment: "staging"
lfs: false
secrets:
aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
function-admin-api-key-staging: ${{ secrets.FUNCTION_ADMIN_API_KEY_STAGING }}
gcp_credentials: ${{ secrets.GCP_DEPLOY }}
195 changes: 0 additions & 195 deletions .github/workflows/test-and-deploy.yml

This file was deleted.

Loading
Loading