Skip to content

Commit db7b697

Browse files
committed
Reorganized workflows: added pre-production validation, staging & production deployment; removed old test report. Updated README with deployment instructions.
1 parent a1d67d5 commit db7b697

7 files changed

Lines changed: 297 additions & 26 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Release Request"
2+
description: "Request a deployment by specifying the evaluation function, changes, target commit/branch, and test confirmation."
3+
title: "Release Request"
4+
labels:
5+
- release
6+
- deployment
7+
assignees: []
8+
body:
9+
- type: textarea
10+
id: description_of_changes
11+
attributes:
12+
label: Description of changes
13+
description: "Summarize what is changing and why. Include links to PRs, issues, or changelogs."
14+
placeholder: |
15+
- What changed:
16+
- Why:
17+
- Related PRs/Issues: #123, #456
18+
render: markdown
19+
validations:
20+
required: true
21+
22+
- type: input
23+
id: branch_to_deploy
24+
attributes:
25+
label: Branch to deploy
26+
description: |
27+
Specify Branch name to deploy.
28+
placeholder: "e.g., release/2025-09-29"
29+
validations:
30+
required: true
31+
32+
- type: dropdown
33+
id: version-bump
34+
attributes:
35+
label: "🚀 What kind of update is this?"
36+
description: "Tell us how significant this change is. This helps us set the correct new version number."
37+
options:
38+
- "Patch: A small fix for a bug. It won't break anything for existing users. (e.g., 1.2.3 ➔ 1.2.4)"
39+
- "Minor: Adds a new feature, but doesn't change how existing ones work. A safe update. (e.g., 1.2.3 ➔ 1.3.0)"
40+
- "Major: A big change that alters existing features. Users may need to update their work to adapt. (e.g., 1.2.3 ➔ 2.0.0)"
41+
default: 0
42+
validations:
43+
required: true
44+
45+
- type: markdown
46+
attributes:
47+
value: |
48+
---
49+
### ⚡ Click the Link Below to Run the Workflow
50+
51+
Clicking the link will take you to the Actions page. You will need to click the **"Run workflow"** button there to start the process.
52+
53+
## [➡️ Go to Workflow Run Page](../actions/workflows/production-deploy.yml)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Run Pre-Production Validation Tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
eval_function:
7+
type: string
8+
description: "The name of the evaluation function to test"
9+
required: true
10+
sql_limit:
11+
type: number
12+
description: "The maximum number of SQL test cases to run"
13+
required: false
14+
default: 500
15+
seed:
16+
type: string
17+
description: "Random seed for reproducible sampling (float in [-1.0, 1.0]). Leave blank to auto-generate."
18+
required: false
19+
default: ''
20+
request_delay:
21+
type: string
22+
description: "Delay (seconds) between dispatching requests"
23+
required: false
24+
default: '0'
25+
max_concurrency:
26+
type: string
27+
description: "Max concurrent requests (lower for GPT-backed functions)"
28+
required: false
29+
default: '5'
30+
31+
jobs:
32+
run-pre-production-tests:
33+
name: 🧪 Run Staging Validation Tests
34+
uses: lambda-feedback/Database-Testing/.github/workflows/test_evaluation_function.yml@main
35+
with:
36+
eval_function: ${{ inputs.eval_function }}
37+
sql_limit: ${{ inputs.sql_limit }}
38+
seed: ${{ inputs.seed }}
39+
request_delay: ${{ inputs.request_delay }}
40+
max_concurrency: ${{ inputs.max_concurrency }}
41+
secrets:
42+
TEST_API_ENDPOINT: ${{ secrets.TEST_API_ENDPOINT }}
43+
DB_USER: ${{ secrets.DB_USER }}
44+
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
45+
DB_HOST: ${{ secrets.DB_HOST }}
46+
DB_PORT: ${{ secrets.DB_PORT }}
47+
DB_NAME: ${{ secrets.DB_NAME }}
48+
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_DB_CREDS }}
49+
GCP_PROJECT_ID: ${{ secrets.GCP_DB_PROJECT_ID }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy to Production
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version-bump:
7+
description: 'Version bump type'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
default: patch
15+
branch:
16+
description: 'Branch to release from'
17+
required: true
18+
type: string
19+
default: 'main'
20+
seed:
21+
description: 'Random seed for reproducible sampling (float in [-1.0, 1.0]). Leave blank to auto-generate.'
22+
required: false
23+
type: string
24+
default: ''
25+
request_delay:
26+
description: 'Delay (seconds) between dispatching requests'
27+
required: false
28+
type: string
29+
default: '0'
30+
max_concurrency:
31+
description: 'Max concurrent requests (lower for GPT-backed functions)'
32+
required: false
33+
type: string
34+
default: '5'
35+
jobs:
36+
deploy:
37+
uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request
38+
with:
39+
template-repository-name: 'lambda-feedback/evaluation-function-boilerplate-python'
40+
build-file: "app/Dockerfile"
41+
build-context: "./app"
42+
environment: "production"
43+
version-bump: ${{ inputs.version-bump }}
44+
branch: ${{ inputs.branch }}
45+
run-database-tests: false
46+
seed: ${{ inputs.seed }}
47+
request_delay: ${{ inputs.request_delay }}
48+
max_concurrency: ${{ inputs.max_concurrency }}
49+
50+
secrets:
51+
aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
52+
aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
53+
function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}}
54+
gcp_credentials: ${{ secrets.GCP_DEPLOY }}
55+
TEST_API_ENDPOINT: ${{ secrets.TEST_API_ENDPOINT }}
56+
DB_USER: ${{ secrets.DB_USER }}
57+
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
58+
DB_HOST: ${{ secrets.DB_HOST }}
59+
DB_PORT: ${{ secrets.DB_PORT }}
60+
DB_NAME: ${{ secrets.DB_NAME }}
61+
GCP_DB_CREDS: ${{ secrets.GCP_DB_CREDS }}
62+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deploy to Staging
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
actions: read
16+
checks: write
17+
pull-requests: write
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ["3.8"]
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Set up Python ${{ matrix.python-version }}
26+
id: python-setup
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m venv .venv
34+
.venv/bin/pip install pytest
35+
.venv/bin/pip install -r app/requirements.txt
36+
37+
38+
- name: Lint with flake8
39+
run: |
40+
source .venv/bin/activate
41+
.venv/bin/pip install flake8
42+
# stop the build if there are Python syntax errors or undefined names
43+
flake8 ./app --count --select=E9,F63,F7,F82 --show-source --statistics
44+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
45+
flake8 ./app --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
46+
47+
- name: Run tests
48+
if: always()
49+
run: |
50+
source .venv/bin/activate
51+
pytest --junit-xml=./reports/pytest.xml --tb=auto -v
52+
53+
- name: Upload test results
54+
uses: actions/upload-artifact@v4
55+
if: always()
56+
with:
57+
name: test-results-${{ matrix.python-version }}
58+
path: ./reports/pytest.xml
59+
if-no-files-found: warn
60+
deploy:
61+
needs: test
62+
uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request
63+
with:
64+
template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python"
65+
build-file: "app/Dockerfile"
66+
build-context: "./app"
67+
build-platforms: "aws"
68+
environment: "staging"
69+
lfs: false
70+
secrets:
71+
aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
72+
aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
73+
function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}}
74+
gcp_credentials: ${{ secrets.GCP_DEPLOY }}

.github/workflows/test-lint.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Test and Lint
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test:
8+
name: Test
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
actions: read
13+
checks: write
14+
pull-requests: write
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.8"]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Set up Python ${{ matrix.python-version }}
23+
id: python-setup
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m venv .venv
31+
.venv/bin/pip install pytest
32+
.venv/bin/pip install -r app/requirements.txt
33+
34+
- name: Lint with flake8
35+
run: |
36+
source .venv/bin/activate
37+
.venv/bin/pip install flake8
38+
# stop the build if there are Python syntax errors or undefined names
39+
flake8 ./app --count --select=E9,F63,F7,F82 --show-source --statistics
40+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
41+
flake8 ./app --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
42+
43+
- name: Run tests
44+
if: always()
45+
run: |
46+
source .venv/bin/activate
47+
pytest --junit-xml=./reports/pytest.xml --tb=auto -v
48+
49+
- name: Upload test results
50+
uses: actions/upload-artifact@v4
51+
if: always()
52+
with:
53+
name: test-results-${{ matrix.python-version }}
54+
path: ./reports/pytest.xml
55+
if-no-files-found: warn

.github/workflows/test-report.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This repository contains the boilerplate code needed to create a containerized evaluation function written in Python.
44

5+
## Deployment
6+
[![Create Release Request](https://img.shields.io/badge/Create%20Release%20Request-blue?style=for-the-badge)](https://github.com/lambda-feedback/{REPO_NAME_HERE}/issues/new?template=release-request.yml)
7+
To deploy to production, update the README button above to point to the correct repository.
8+
59
## Quickstart
610

711
This chapter helps you to quickly set up a new Python evaluation function using this template repository.

0 commit comments

Comments
 (0)