diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43590d5..afaab59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,4 +10,30 @@ jobs: ci: 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.x + with: + persist-credentials: false + + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.x + 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 5ab9b96..b475992 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,16 @@ 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]}
-