diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43590d5..b1d72ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,31 @@ permissions: contents: read jobs: - ci: + lint: uses: Sea-Haven-Industries/.github/.github/workflows/ci-python-sam.yaml@0170a57c0d99b542cfafd1f3e1d369c32643f486 # v1.0.2 with: - run-tests: true + run-tests: false + + test: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-python@v7 + with: + python-version: "3.12" + + - name: Install Python dependencies + shell: bash + run: | + pip install pytest + while IFS= read -r -d '' req; do + pip install -r "$req" + done < <(find . -name requirements.txt -not -path './.aws-sam/*' -print0) + + - name: Install Playwright Chromium + run: playwright install --with-deps chromium + + - name: Run tests + run: pytest diff --git a/requirements.txt b/requirements.txt index d3ca079..721c3af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ playwright==1.61.0 flask==3.1.3 boto3==1.43.58 +jinja2==3.1.6 diff --git a/src/server/generate_form.py b/src/server/generate_form.py index 567ea57..6b2b8b3 100644 --- a/src/server/generate_form.py +++ b/src/server/generate_form.py @@ -15,9 +15,12 @@ import sys from datetime import datetime from pathlib import Path +from jinja2 import Environment, FileSystemLoader, select_autoescape + PROJECT_ROOT = Path(__file__).resolve().parents[2] OUTPUT_DIR = PROJECT_ROOT / "output" CONFIG_PATH = PROJECT_ROOT / "config.json" +TEMPLATES_DIR = Path(__file__).resolve().parent / "templates" def load_config(): @@ -34,6 +37,11 @@ def latest_menu() -> dict: return json.load(f) +def _json_for_script(value) -> str: + """Serialize for embedding in a ' - if use_google_auth - else "" - } - -
- -{ - '' - if use_google_auth - else "" - } -Week of {week} · Menu scraped {scraped_at[:10]}
-