diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml index fe7fb79..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 @@ -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 686ba3f..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: @@ -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-on-dev + 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 b1d9165..d3b1373 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,13 +1,20 @@ -# 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_tests.py ./app/ @@ -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/requirements.txt b/app/requirements.txt index 74d1c6b..bd4f455 100755 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,2 +1,2 @@ -numpy==1.21.2 -evaluation-function-utils \ No newline at end of file +numpy>=1.26 +evaluation-function-utils 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 a3cf100..43dd62d 100644 --- a/readme.md +++ b/readme.md @@ -170,7 +170,7 @@ Three automated pipelines are configured under `.github/workflows/`: To develop locally you will need: -- Python 3.8 or higher +- Python 3.12 or higher - `git` CLI or GitHub Desktop - A code editor (VS Code, PyCharm, etc.) - Docker (optional — only needed to build/test the image locally)