From b77cda99518478f8adcd45d0975f2bae2c2c2efd Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Thu, 18 Dec 2025 15:31:59 +0000 Subject: [PATCH 01/14] Added new staging/prod deployment workflow including database testing --- .github/ISSUE_TEMPLATE/config.yml | 2 + .github/ISSUE_TEMPLATE/release-request.yml | 53 ++++++ .github/workflows/deploy.yml | 105 +++++++++++ .github/workflows/production-deploy.yml | 42 +++++ .github/workflows/staging-deploy.yml | 98 +++++++++++ .github/workflows/test-and-deploy.yml | 194 --------------------- .github/workflows/test-report.yml | 26 +++ README.md | 4 + 8 files changed, 330 insertions(+), 194 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/release-request.yml create mode 100755 .github/workflows/deploy.yml create mode 100644 .github/workflows/production-deploy.yml create mode 100644 .github/workflows/staging-deploy.yml delete mode 100644 .github/workflows/test-and-deploy.yml create mode 100644 .github/workflows/test-report.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..8e9f916 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +blank_issues_enabled: false +contact_links: [] \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/release-request.yml b/.github/ISSUE_TEMPLATE/release-request.yml new file mode 100644 index 0000000..2ed9717 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/release-request.yml @@ -0,0 +1,53 @@ +name: "Release Request" +description: "Request a deployment by specifying the evaluation function, changes, target commit/branch, and test confirmation." +title: "Release Request" +labels: + - release + - deployment +assignees: [] +body: + - type: textarea + id: description_of_changes + attributes: + label: Description of changes + description: "Summarize what is changing and why. Include links to PRs, issues, or changelogs." + placeholder: | + - What changed: + - Why: + - Related PRs/Issues: #123, #456 + render: markdown + validations: + required: true + + - type: input + id: branch_to_deploy + attributes: + label: Branch to deploy + description: | + Specify Branch name to deploy. + placeholder: "e.g., release/2025-09-29" + validations: + required: true + + - type: dropdown + id: version-bump + attributes: + label: "🚀 What kind of update is this?" + description: "Tell us how significant this change is. This helps us set the correct new version number." + options: + - "Patch: A small fix for a bug. It won't break anything for existing users. (e.g., 1.2.3 ➔ 1.2.4)" + - "Minor: Adds a new feature, but doesn't change how existing ones work. A safe update. (e.g., 1.2.3 ➔ 1.3.0)" + - "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)" + default: 0 + validations: + required: true + + - type: markdown + attributes: + value: | + --- + ### ⚡ Click the Link Below to Run the Workflow + + Clicking the link will take you to the Actions page. You will need to click the **"Run workflow"** button there to start the process. + + ## [➡️ Go to Workflow Run Page](../actions/workflows/production-deploy.yml) \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100755 index 0000000..ec94d1e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,105 @@ +name: Build, Test and Deploy + +on: + push: + branches: + - main + pull_request: + 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 + with: + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + id: python-setup + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Load cached Poetry installation + id: poetry-cache + uses: actions/cache@v4 + with: + path: ~/.local + key: poetry-0 + + - name: Install and configure Poetry + if: steps.poetry-cache.outputs.cache-hit != 'true' + uses: snok/install-poetry@v1 + with: + virtualenvs-in-project: true + + - name: Load cached venv + id: dependencies-cache + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + if: steps.dependencies-cache.outputs.cache-hit != 'true' + run: | + poetry install --no-interaction --no-root + + # TODO: add linting / black / flake8 + # - name: Lint with flake8 + # run: | + # source .venv/bin/activate + # # stop the build if there are Python syntax errors or undefined names + # flake8 ./evaluation_function --count --select=E9,F63,F7,F82 --show-source --statistics + # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 ./evaluation_function --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 + path: ./reports/pytest.xml + if-no-files-found: warn + + build: + name: Build Docker Image + uses: lambda-feedback/evaluation-function-workflows/.github/workflows/build.yml@main + needs: test + permissions: + contents: read + id-token: write + packages: write + + deploy: + name: Deploy to Lambda Feedback + uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@main + needs: test + with: + template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python" + permissions: + contents: read + id-token: write + packages: write + secrets: + aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }} + aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}} + function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}} diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml new file mode 100644 index 0000000..aca38a1 --- /dev/null +++ b/.github/workflows/production-deploy.yml @@ -0,0 +1,42 @@ +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' +jobs: + deploy: + uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request + with: + template-repository-name: 'lambda-feedback/evaluation-function-boilerplate-wolfram' + environment: "production" + version-bump: ${{ inputs.version-bump }} + branch: ${{ inputs.branch }} + run-tests: true + + secrets: + aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }} + aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}} + function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}} + 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 }} \ No newline at end of file diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml new file mode 100644 index 0000000..76862b8 --- /dev/null +++ b/.github/workflows/staging-deploy.yml @@ -0,0 +1,98 @@ +name: Deploy to Staging + +on: + push: + branches: + - main + - master + 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 + with: + fetch-depth: 0 + lfs: true + - name: pull lfs files + run: git lfs pull + - name: Verify LFS files + run: git lfs ls-files + - name: Set up Python ${{ matrix.python-version }} + id: python-setup + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Load cached Poetry installation + id: poetry-cache + uses: actions/cache@v4 + with: + path: ~/.local + key: poetry-0 + + - name: Install and configure Poetry + if: steps.poetry-cache.outputs.cache-hit != 'true' + uses: snok/install-poetry@v1 + with: + virtualenvs-in-project: true + + - name: Load cached venv + id: dependencies-cache + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + if: steps.dependencies-cache.outputs.cache-hit != 'true' + run: | + poetry install --with dev --no-interaction --no-root + + # TODO: add linting / black / flake8 + # - name: Lint with flake8 + # run: | + # source .venv/bin/activate + # # stop the build if there are Python syntax errors or undefined names + # flake8 ./evaluation_function --count --select=E9,F63,F7,F82 --show-source --statistics + # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 ./evaluation_function --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 + path: ./reports/pytest.xml + if-no-files-found: warn + deploy: + needs: test + uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request + with: + template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python" + 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: ${{ secrets.FUNCTION_ADMIN_API_KEY}} + gcp_credentials: ${{ secrets.GCP_DEPLOY }} diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml deleted file mode 100644 index 8329f93..0000000 --- a/.github/workflows/test-and-deploy.yml +++ /dev/null @@ -1,194 +0,0 @@ -name: Test & Deploy Evaluation Function to AWS Lambda - -on: - push: - branches: - - master - - main - workflow_dispatch: - -jobs: - test: - name: Test - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - python-version: [3.8] - - defaults: - run: - working-directory: app/ - - env: - REQUEST_SCHEMA_URL: https://raw.githubusercontent.com/lambda-feedback/request-response-schemas/master/request.json - RESPONSE_SCHEMA_URL: https://raw.githubusercontent.com/lambda-feedback/request-response-schemas/master/responsev2.json - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest - python -m pip install -r requirements.txt - - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Test Evaluation Function - run: | - pytest -v evaluation_tests.py::TestEvaluationFunction - - - name: Test Preview Function - run: | - pytest -v preview_tests.py::TestPreviewFunction - - deploy-staging: - name: Deploy Staging - needs: test - runs-on: ubuntu-latest - environment: production - env: - ECR_REPOSITORY: lambda-feedback-staging-functions-repository - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set config.json output - id: set_config_var - run: | - content=`cat ./config.json` - # the following lines are only required for multi line json - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - content="${content//$'\r'/'%0D'}" - # end of optional handling for multi line json - echo "::set-output name=configJson::$content" - - - name: set Evaluation Function Name - id: set_function_name - run: | - functionName="${{fromJson(steps.set_config_var.outputs.configJson).EvaluationFunctionName}}" - [[ -z "$functionName" ]] && { echo "Add EvaluationFunctionName to config.json" ; exit 1; } - echo "::set-output name=function_name::$functionName" - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }} - aws-secret-access-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET }} - aws-region: eu-west-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, tag, and push image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ steps.set_function_name.outputs.function_name }} - run: | - # Build docker image from algorithm, schema and requirements - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG app/ - # Push image to ECR - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" - - - name: deploy evaluation function - id: deploy-evaluation-function - env: - BACKEND_API_URL: https://staging-api.lambdafeedback.com - API_KEY: ${{ secrets.FUNCTION_ADMIN_API_KEY }} - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ steps.set_function_name.outputs.function_name }} - run: | - curl --location --request POST "$BACKEND_API_URL/grading-function/ensure" \ - --header 'content-type: application/json' \ - --data-raw "{ - \"apiKey\": \"$API_KEY\", - \"dockerImageUri\": \"$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG\", - \"functionName\": \"$IMAGE_TAG\" - }" - - deploy-production: - name: Deploy Production - needs: deploy-staging - runs-on: ubuntu-latest - environment: production - env: - ECR_REPOSITORY: lambda-feedback-production-functions-repository - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set config.json output - id: set_config_var - run: | - content=`cat ./config.json` - # the following lines are only required for multi line json - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - content="${content//$'\r'/'%0D'}" - # end of optional handling for multi line json - echo "::set-output name=configJson::$content" - - - name: set Evaluation Function Name - id: set_function_name - run: | - functionName="${{fromJson(steps.set_config_var.outputs.configJson).EvaluationFunctionName}}" - [[ -z "$functionName" ]] && { echo "Add EvaluationFunctionName to config.json" ; exit 1; } - echo "::set-output name=function_name::$functionName" - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }} - aws-secret-access-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET }} - aws-region: eu-west-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, tag, and push image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ steps.set_function_name.outputs.function_name }} - run: | - # Build docker image from algorithm, schema and requirements - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG app/ - # Push image to ECR - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" - - - name: deploy evaluation function - id: deploy-evaluation-function - env: - BACKEND_API_URL: https://prod-api.lambdafeedback.com - API_KEY: ${{ secrets.FUNCTION_ADMIN_API_KEY }} - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ steps.set_function_name.outputs.function_name }} - run: | - curl --location --request POST "$BACKEND_API_URL/grading-function/ensure" \ - --header 'content-type: application/json' \ - --data-raw "{ - \"apiKey\": \"$API_KEY\", - \"dockerImageUri\": \"$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG\", - \"functionName\": \"$IMAGE_TAG\" - }" diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 0000000..1d885ed --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,26 @@ +name: Test Report + +on: + workflow_run: + workflows: ["Build, Test and Deploy"] + types: + - completed + +permissions: + contents: read + actions: read + checks: write + +jobs: + report: + runs-on: ubuntu-latest + steps: + - name: Test Report + uses: dorny/test-reporter@v1 + if: always() + with: + name: Pytest Report + artifact: test-results + path: '*.xml' + reporter: java-junit + fail-on-error: false \ No newline at end of file diff --git a/README.md b/README.md index 0de5731..c9040e9 100755 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ For more information, look at the docs [here](https://lambda-feedback.github.io/ This version is specifically for python, however the ultimate goal is to make similar boilerplate repositories in any language, allowing tutors the freedom to code in what they feel most comfortable with. +## Deployment +[![Create Release Request](https://img.shields.io/badge/Create%20Release%20Request-blue?style=for-the-badge)](https://github.com/lambda-feedback/compareExpressions/issues/new?template=release-request.yml) + + ### Getting Started 1. Clone this repository From 7ae404622b2eb7af0625da54e85e3203fde35f2b Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Thu, 18 Dec 2025 15:34:33 +0000 Subject: [PATCH 02/14] Switched template repo name --- .github/workflows/production-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml index aca38a1..d4ec031 100644 --- a/.github/workflows/production-deploy.yml +++ b/.github/workflows/production-deploy.yml @@ -21,7 +21,7 @@ jobs: deploy: uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request with: - template-repository-name: 'lambda-feedback/evaluation-function-boilerplate-wolfram' + template-repository-name: 'lambda-feedback/evaluation-function-boilerplate-python' environment: "production" version-bump: ${{ inputs.version-bump }} branch: ${{ inputs.branch }} From 435e509960b4dec0d7b3e4d1b6fc8dc68e598697 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Thu, 15 Jan 2026 12:56:21 +0000 Subject: [PATCH 03/14] Removed old workflows --- .github/workflows/deploy.yml | 105 ------------------------------ .github/workflows/test-report.yml | 26 -------- 2 files changed, 131 deletions(-) delete mode 100755 .github/workflows/deploy.yml delete mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100755 index ec94d1e..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Build, Test and Deploy - -on: - push: - branches: - - main - pull_request: - 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 - with: - fetch-depth: 0 - - - name: Set up Python ${{ matrix.python-version }} - id: python-setup - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Load cached Poetry installation - id: poetry-cache - uses: actions/cache@v4 - with: - path: ~/.local - key: poetry-0 - - - name: Install and configure Poetry - if: steps.poetry-cache.outputs.cache-hit != 'true' - uses: snok/install-poetry@v1 - with: - virtualenvs-in-project: true - - - name: Load cached venv - id: dependencies-cache - uses: actions/cache@v3 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - - name: Install dependencies - if: steps.dependencies-cache.outputs.cache-hit != 'true' - run: | - poetry install --no-interaction --no-root - - # TODO: add linting / black / flake8 - # - name: Lint with flake8 - # run: | - # source .venv/bin/activate - # # stop the build if there are Python syntax errors or undefined names - # flake8 ./evaluation_function --count --select=E9,F63,F7,F82 --show-source --statistics - # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # flake8 ./evaluation_function --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 - path: ./reports/pytest.xml - if-no-files-found: warn - - build: - name: Build Docker Image - uses: lambda-feedback/evaluation-function-workflows/.github/workflows/build.yml@main - needs: test - permissions: - contents: read - id-token: write - packages: write - - deploy: - name: Deploy to Lambda Feedback - uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@main - needs: test - with: - template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python" - permissions: - contents: read - id-token: write - packages: write - secrets: - aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }} - aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}} - function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}} diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml deleted file mode 100644 index 1d885ed..0000000 --- a/.github/workflows/test-report.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Test Report - -on: - workflow_run: - workflows: ["Build, Test and Deploy"] - types: - - completed - -permissions: - contents: read - actions: read - checks: write - -jobs: - report: - runs-on: ubuntu-latest - steps: - - name: Test Report - uses: dorny/test-reporter@v1 - if: always() - with: - name: Pytest Report - artifact: test-results - path: '*.xml' - reporter: java-junit - fail-on-error: false \ No newline at end of file From 6dad87af170122a390f48d44309aceb8c8f19ba9 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 2 Mar 2026 16:35:22 +0000 Subject: [PATCH 04/14] Switched to use pip instead of poetry --- .github/workflows/staging-deploy.yml | 33 +++------------------------- 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index 76862b8..f675d29 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -19,47 +19,20 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.12"] + python-version: ["3.8", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - - name: pull lfs files - run: git lfs pull - - name: Verify LFS files - run: git lfs ls-files - name: Set up Python ${{ matrix.python-version }} id: python-setup uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Load cached Poetry installation - id: poetry-cache - uses: actions/cache@v4 - with: - path: ~/.local - key: poetry-0 - - - name: Install and configure Poetry - if: steps.poetry-cache.outputs.cache-hit != 'true' - uses: snok/install-poetry@v1 - with: - virtualenvs-in-project: true - - - name: Load cached venv - id: dependencies-cache - uses: actions/cache@v3 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - name: Install dependencies - if: steps.dependencies-cache.outputs.cache-hit != 'true' run: | - poetry install --with dev --no-interaction --no-root + python -m venv .venv + .venv/bin/pip install -r requirements.txt # TODO: add linting / black / flake8 # - name: Lint with flake8 From 851b19bda60e4c5115d5761a27a6b5768c4b0475 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 2 Mar 2026 16:39:32 +0000 Subject: [PATCH 05/14] Added Pull Request trigger --- .github/workflows/staging-deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index f675d29..ac43c85 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -4,7 +4,9 @@ on: push: branches: - main - - master + pull_request: + branches: + - main workflow_dispatch: jobs: From 7335dceb6cf1e70d9ed3d6bd69146fdd4799bb6c Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 2 Mar 2026 16:41:09 +0000 Subject: [PATCH 06/14] Fixed path for requirements.txt --- .github/workflows/staging-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index ac43c85..3a804cf 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -34,7 +34,7 @@ jobs: - name: Install dependencies run: | python -m venv .venv - .venv/bin/pip install -r requirements.txt + .venv/bin/pip install -r app/requirements.txt # TODO: add linting / black / flake8 # - name: Lint with flake8 From ca0451cfe727657262d28666f9a5034168b58b3f Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 2 Mar 2026 16:43:38 +0000 Subject: [PATCH 07/14] Added pytest requirement --- .github/workflows/staging-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index 3a804cf..eb81f0c 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -34,6 +34,7 @@ jobs: - name: Install dependencies run: | python -m venv .venv + .venv/bin/pip install pytest .venv/bin/pip install -r app/requirements.txt # TODO: add linting / black / flake8 From 95f4d4bae8be6f3b3cd6853eb4fb4356d7cc886e Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 2 Mar 2026 16:49:04 +0000 Subject: [PATCH 08/14] Added python version to test report --- .github/workflows/staging-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index eb81f0c..bec4d61 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -56,7 +56,7 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: test-results + name: test-results-${{ matrix.python-version }} path: ./reports/pytest.xml if-no-files-found: warn deploy: From 941cea4916f28a95efff750ab6e3d78cf9dca28c Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Mon, 2 Mar 2026 16:56:11 +0000 Subject: [PATCH 09/14] Refactored test file names to match pytest requirements --- app/Dockerfile | 16 ++++++++-------- app/{evaluation_tests.py => evaluation_test.py} | 6 +++--- app/{preview_tests.py => preview_test.py} | 4 ++-- app/tests/{example_tests.py => example_test.py} | 0 ...s.py => physical_quantity_evaluation_test.py} | 4 ++-- ...ests.py => physical_quantity_preview_test.py} | 2 +- ...lr_quantity_tests.py => slr_quantity_test.py} | 0 ...tion_tests.py => symbolic_evaluation_test.py} | 0 ...preview_tests.py => symbolic_preview_test.py} | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) rename app/{evaluation_tests.py => evaluation_test.py} (96%) rename app/{preview_tests.py => preview_test.py} (98%) rename app/tests/{example_tests.py => example_test.py} (100%) rename app/tests/{physical_quantity_evaluation_tests.py => physical_quantity_evaluation_test.py} (99%) rename app/tests/{physical_quantity_preview_tests.py => physical_quantity_preview_test.py} (97%) rename app/tests/{slr_quantity_tests.py => slr_quantity_test.py} (100%) rename app/tests/{symbolic_evaluation_tests.py => symbolic_evaluation_test.py} (100%) rename app/tests/{symbolic_preview_tests.py => symbolic_preview_test.py} (99%) diff --git a/app/Dockerfile b/app/Dockerfile index f032540..9f5ca25 100755 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -13,9 +13,9 @@ RUN pip3 install -r requirements.txt # Copy main scripts COPY evaluation.py ./app/ -COPY evaluation_tests.py ./app/ +COPY evaluation_test.py ./app/ COPY preview.py ./app/ -COPY preview_tests.py ./app/ +COPY preview_test.py ./app/ # Copy contexts COPY context/physical_quantity.py ./app/context/ @@ -30,12 +30,12 @@ COPY preview_implementations/physical_quantity_preview.py ./app/preview_implemen COPY preview_implementations/symbolic_preview.py ./app/preview_implementations/ # Copy tests -COPY tests/example_tests.py ./app/tests/ -COPY tests/physical_quantity_evaluation_tests.py ./app/tests/ -COPY tests/physical_quantity_preview_tests.py ./app/tests/ -COPY tests/slr_quantity_tests.py ./app/tests/ -COPY tests/symbolic_evaluation_tests.py ./app/tests/ -COPY tests/symbolic_preview_tests.py ./app/tests/ +COPY tests/example_test.py ./app/tests/ +COPY tests/physical_quantity_evaluation_test.py ./app/tests/ +COPY tests/physical_quantity_preview_test.py ./app/tests/ +COPY tests/slr_quantity_test.py ./app/tests/ +COPY tests/symbolic_evaluation_test.py ./app/tests/ +COPY tests/symbolic_preview_test.py ./app/tests/ # Copy utility code COPY utility/criteria_graph_utilities.py ./app/utility/ diff --git a/app/evaluation_tests.py b/app/evaluation_test.py similarity index 96% rename from app/evaluation_tests.py rename to app/evaluation_test.py index d8473c7..8bb6c45 100755 --- a/app/evaluation_tests.py +++ b/app/evaluation_test.py @@ -25,13 +25,13 @@ class TestEvaluationFunction(): """ # Import tests that makes sure that mathematical expression comparison works as expected - from .tests.symbolic_evaluation_tests import TestEvaluationFunction as TestSymbolicComparison + from .tests.symbolic_evaluation_test import TestEvaluationFunction as TestSymbolicComparison # Import tests that makes sure that physical quantities are handled as expected - from .tests.physical_quantity_evaluation_tests import TestEvaluationFunction as TestQuantities + from .tests.physical_quantity_evaluation_test import TestEvaluationFunction as TestQuantities # Import tests that corresponds to examples in documentation and examples module - from .tests.example_tests import TestEvaluationFunction as TestExamples + from .tests.example_test import TestEvaluationFunction as TestExamples def test_eval_function_can_handle_latex_input(self): response = r"\sin x + x^{7}" diff --git a/app/preview_tests.py b/app/preview_test.py similarity index 98% rename from app/preview_tests.py rename to app/preview_test.py index c9291d9..5cbcdfa 100644 --- a/app/preview_tests.py +++ b/app/preview_test.py @@ -25,10 +25,10 @@ class TestPreviewFunction(): """ # Import tests that makes sure that mathematical expression comparison works as expected - from .tests.symbolic_preview_tests import TestPreviewFunction as TestSymbolicComparison + from .tests.symbolic_preview_test import TestPreviewFunction as TestSymbolicComparison # Import tests that makes sure that physical quantities are handled as expected - from .tests.physical_quantity_preview_tests import TestPreviewFunction as TestQuantityComparison + from .tests.physical_quantity_preview_test import TestPreviewFunction as TestQuantityComparison def test_empty_latex_expression(self): response = "" diff --git a/app/tests/example_tests.py b/app/tests/example_test.py similarity index 100% rename from app/tests/example_tests.py rename to app/tests/example_test.py diff --git a/app/tests/physical_quantity_evaluation_tests.py b/app/tests/physical_quantity_evaluation_test.py similarity index 99% rename from app/tests/physical_quantity_evaluation_tests.py rename to app/tests/physical_quantity_evaluation_test.py index ba1bed5..d7e1fef 100644 --- a/app/tests/physical_quantity_evaluation_tests.py +++ b/app/tests/physical_quantity_evaluation_test.py @@ -2,7 +2,7 @@ import os # Import necessary data and reference cases for tests -from .slr_quantity_tests import slr_strict_si_syntax_test_cases, slr_natural_si_syntax_test_cases +from .slr_quantity_test import slr_strict_si_syntax_test_cases, slr_natural_si_syntax_test_cases from ..evaluation import evaluation_function from ..utility.unit_system_conversions import ( set_of_SI_prefixes, @@ -32,7 +32,7 @@ class TestEvaluationFunction(): """ # Import tests that makes sure that physical quantity parsing works as expected - from .slr_quantity_tests import TestEvaluationFunction as TestStrictSLRSyntax + from .slr_quantity_test import TestEvaluationFunction as TestStrictSLRSyntax log_details = True diff --git a/app/tests/physical_quantity_preview_tests.py b/app/tests/physical_quantity_preview_test.py similarity index 97% rename from app/tests/physical_quantity_preview_tests.py rename to app/tests/physical_quantity_preview_test.py index d343e39..f44f7f4 100644 --- a/app/tests/physical_quantity_preview_tests.py +++ b/app/tests/physical_quantity_preview_test.py @@ -2,7 +2,7 @@ import pytest from ..preview_implementations.physical_quantity_preview import preview_function -from .slr_quantity_tests import slr_strict_si_syntax_test_cases, slr_natural_si_syntax_test_cases +from .slr_quantity_test import slr_strict_si_syntax_test_cases, slr_natural_si_syntax_test_cases class TestPreviewFunction(): diff --git a/app/tests/slr_quantity_tests.py b/app/tests/slr_quantity_test.py similarity index 100% rename from app/tests/slr_quantity_tests.py rename to app/tests/slr_quantity_test.py diff --git a/app/tests/symbolic_evaluation_tests.py b/app/tests/symbolic_evaluation_test.py similarity index 100% rename from app/tests/symbolic_evaluation_tests.py rename to app/tests/symbolic_evaluation_test.py diff --git a/app/tests/symbolic_preview_tests.py b/app/tests/symbolic_preview_test.py similarity index 99% rename from app/tests/symbolic_preview_tests.py rename to app/tests/symbolic_preview_test.py index c6e6fcb..cb86d62 100644 --- a/app/tests/symbolic_preview_tests.py +++ b/app/tests/symbolic_preview_test.py @@ -3,7 +3,7 @@ from ..utility.preview_utilities import Params, extract_latex from ..preview_implementations.symbolic_preview import preview_function -from .symbolic_evaluation_tests import elementary_function_test_cases +from .symbolic_evaluation_test import elementary_function_test_cases class TestPreviewFunction(): From 068a5987d8b045e361250b4c2e06d1d9f11267c9 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Tue, 3 Mar 2026 12:39:52 +0000 Subject: [PATCH 10/14] Removed Python 3.12 from CI/CD as Sympy has version issues --- .github/workflows/staging-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index bec4d61..a560ace 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.12"] + python-version: ["3.8"] steps: - name: Checkout uses: actions/checkout@v4 From c186eac2a6c168517d2be7a3d01cff2e9fbc3566 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Tue, 3 Mar 2026 15:21:10 +0000 Subject: [PATCH 11/14] Changed to build file to point to the dockerfile --- .github/workflows/staging-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index a560ace..ceb7462 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -64,6 +64,7 @@ jobs: uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request with: template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python" + build-file: "app/Dockerfile" build-platforms: "aws" environment: "staging" lfs: false From c04792e3b14bc38cf669a5fc86310d140c5ae656 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Tue, 3 Mar 2026 15:22:24 +0000 Subject: [PATCH 12/14] Added build file path to production --- .github/workflows/production-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml index d4ec031..3578bdd 100644 --- a/.github/workflows/production-deploy.yml +++ b/.github/workflows/production-deploy.yml @@ -22,6 +22,7 @@ jobs: uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request with: template-repository-name: 'lambda-feedback/evaluation-function-boilerplate-python' + build-file: "app/Dockerfile" environment: "production" version-bump: ${{ inputs.version-bump }} branch: ${{ inputs.branch }} From 0cb222492de8dab35199f96e3faf6a988d68a773 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Tue, 3 Mar 2026 15:34:10 +0000 Subject: [PATCH 13/14] Added build context --- .github/workflows/staging-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/staging-deploy.yml b/.github/workflows/staging-deploy.yml index ceb7462..eef61cc 100644 --- a/.github/workflows/staging-deploy.yml +++ b/.github/workflows/staging-deploy.yml @@ -65,6 +65,7 @@ jobs: with: template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python" build-file: "app/Dockerfile" + build-context: "./app" build-platforms: "aws" environment: "staging" lfs: false From 276269193caf51a07bb548a24fb74a35da941f28 Mon Sep 17 00:00:00 2001 From: Marcus Messer Date: Tue, 3 Mar 2026 15:34:25 +0000 Subject: [PATCH 14/14] Added build context to prod --- .github/workflows/production-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/production-deploy.yml b/.github/workflows/production-deploy.yml index 3578bdd..4e0b374 100644 --- a/.github/workflows/production-deploy.yml +++ b/.github/workflows/production-deploy.yml @@ -23,6 +23,7 @@ jobs: 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 }}