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
2 changes: 1 addition & 1 deletion .github/workflows/production-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
environment: "production"
version-bump: ${{ inputs.version-bump }}
branch: ${{ inputs.branch }}
run-database-tests: false
run-database-tests: false # LLM-backed: database tests call OpenAI
seed: ${{ inputs.seed }}
request_delay: ${{ inputs.request_delay }}
max_concurrency: ${{ inputs.max_concurrency }}
Expand Down
90 changes: 39 additions & 51 deletions .github/workflows/staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,46 @@ on:
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.8"]
# 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
#
# - name: Run tests
# if: always()
# run: |
# source .venv/bin/activate
# pytest --junit-xml=./reports/pytest.xml --tb=auto -v
#
# - name: Upload test results
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: test-results-${{ matrix.python-version }}
# path: ./reports/pytest.xml
# if-no-files-found: warn
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
needs: test
uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@main
with:
template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python"
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/test-lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Test and Lint

on:
# pull_request:
workflow_dispatch:
pull_request:

jobs:
test:
Expand Down Expand Up @@ -41,16 +40,4 @@ jobs:
# 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

- name: Run tests
if: always()
run: |
source .venv/bin/activate
pytest --junit-xml=./reports/pytest.xml --tb=auto -v

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.python-version }}
path: ./reports/pytest.xml
if-no-files-found: warn
# Tests are disabled in CI: they call the OpenAI API.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Once the code passes all these tests, it will then be uploaded to AWS and will b
## Pre-requisites
Although all programming can be done through the GitHub interface, it is recommended you do this locally on your machine. To do this, you must have installed:

- Python 3.8 or higher.
- Python 3.12 or higher.

- GitHub Desktop or the `git` CLI.

Expand Down
16 changes: 10 additions & 6 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Base image that bundles AWS Lambda Python 3.8 image with some middleware functions
# FROM base-eval-tmp
# FROM rabidsheep55/python-base-eval-layer
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
Expand All @@ -25,5 +28,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" ]
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -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
Loading