From 836d846dba66209a8dc8fe273139505d9a2e93b9 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 9 Nov 2026 15:09:56 +0000 Subject: [PATCH 1/2] Upgrade to Python 3.12 base layer and align workflows with survey - Base image baseevalutionfunctionlayer:main-3.8 -> main-3.12 (AL2023: dnf findutils, PYTHONPATH, pytest for healthcheck, module-style CMD) - Rename evaluation_test.py -> evaluation_tests.py so the base layer healthcheck can import it - Workflows copied from survey: Python 3.12, deploy.yml@main, PR-triggered test-lint, database tests on production deploy - Add pytest.ini Co-Authored-By: Claude Opus 5.5 --- .github/workflows/production-deploy.yml | 4 ++-- .github/workflows/staging-deploy.yml | 4 ++-- .github/workflows/test-lint.yml | 2 +- app/Dockerfile | 20 +++++++++++++------ ...evaluation_test.py => evaluation_tests.py} | 0 pytest.ini | 4 ++++ readme.md | 2 +- 7 files changed, 24 insertions(+), 12 deletions(-) rename app/{evaluation_test.py => evaluation_tests.py} (100%) create mode 100644 pytest.ini diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml index fe7fb79..012eb0c 100644 --- a/.github/workflows/production-deploy.yml +++ b/.github/workflows/production-deploy.yml @@ -34,7 +34,7 @@ on: default: '5' jobs: deploy: - uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request + 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" @@ -42,7 +42,7 @@ jobs: environment: "production" version-bump: ${{ inputs.version-bump }} branch: ${{ inputs.branch }} - run-database-tests: false + run-database-tests: true seed: ${{ inputs.seed }} request_delay: ${{ inputs.request_delay }} max_concurrency: ${{ inputs.max_concurrency }} diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index 9c354f2..4a8443b 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8"] + python-version: ["3.12"] steps: - name: Checkout uses: actions/checkout@v4 @@ -59,7 +59,7 @@ jobs: if-no-files-found: warn deploy: needs: test - uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request + 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" diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml index b9d4bce..0f1e91d 100644 --- a/.github/workflows/test-lint.yml +++ b/.github/workflows/test-lint.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8"] + python-version: ["3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/app/Dockerfile b/app/Dockerfile index 7832b6e..d3b1373 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,16 +1,23 @@ -# Base image that bundles AWS Lambda Python 3.8 image with some middleware functions -# FROM base-eval-tmp -FROM ghcr.io/lambda-feedback/baseevalutionfunctionlayer:main-3.8 +# Base image that bundles the AWS Lambda Python image with the lambda-feedback middleware (app.handler) +FROM ghcr.io/lambda-feedback/baseevalutionfunctionlayer:main-3.12 + +# The 3.12 image is Amazon Linux 2023, which doesn't ship `find` (used below) +RUN dnf install -y findutils && dnf clean all WORKDIR /app +ENV PYTHONPATH=/app + # Copy and install any packages/modules needed for your evaluation script. COPY requirements.txt . RUN pip3 install -r requirements.txt +# The healthcheck command runs the pytest suite +RUN pip3 install pytest + # Copy the evaluation and testing scripts COPY evaluation.py ./app/ -COPY evaluation_test.py ./app/ +COPY evaluation_tests.py ./app/ # Copy Documentation COPY docs/dev.md ./app/docs/dev.md @@ -20,5 +27,6 @@ COPY docs/user.md ./app/docs/user.md RUN chmod 644 $(find . -type f) RUN chmod 755 $(find . -type d) -# The entrypoint for AWS is to invoke the handler function within the app package -CMD [ "/app/app.handler" ] +# The entrypoint for AWS is to invoke the handler function within the app package. +# Python 3.12's Lambda runtime imports this as a module name, so it can't be a path. +CMD [ "app.handler" ] diff --git a/app/evaluation_test.py b/app/evaluation_tests.py similarity index 100% rename from app/evaluation_test.py rename to app/evaluation_tests.py diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..589497f --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +# evaluation_tests.py is the name the base layer's healthcheck imports, so +# include it alongside pytest's default patterns. +python_files = test_*.py *_test.py *_tests.py diff --git a/readme.md b/readme.md index 3d6bb89..7deba8a 100644 --- a/readme.md +++ b/readme.md @@ -142,7 +142,7 @@ Three pipelines are configured in `.github/workflows/`: To develop and test locally: -- Python 3.8 or higher +- Python 3.12 or higher - Docker - `git` CLI or GitHub Desktop - A code editor (VS Code, PyCharm, etc.) From 1983d8fb334f78b11f7bec3a5c1ce8c6c892dc0a Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 9 Nov 2026 15:12:21 +0000 Subject: [PATCH 2/2] Point staging and production workflows at master (the default branch) Co-Authored-By: Claude Opus 5.5 --- .github/workflows/production-deploy.yml | 2 +- .github/workflows/staging-deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml index 012eb0c..fd910ab 100644 --- a/.github/workflows/production-deploy.yml +++ b/.github/workflows/production-deploy.yml @@ -16,7 +16,7 @@ on: description: 'Branch to release from' required: true type: string - default: 'main' + default: 'master' seed: description: 'Random seed for reproducible sampling (float in [-1.0, 1.0]). Leave blank to auto-generate.' required: false diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index 4a8443b..caf18f5 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -3,7 +3,7 @@ name: Deploy to Staging on: push: branches: - - main + - master workflow_dispatch: jobs: