generated from westfarn/web_django_template
## Summary - Rebrand the Django client template as Print Forge (`client_site` → `print_forge`) with shop + shipping enabled. - Product listings support multiple photos, color variants (shared price/description/STL, per-color stock and photos), and a photo-first / 3D-second gallery. - Public pages use 3D printer / printed-toy photography instead of leftover t-shirt mockups; beta CI deploys on `master`. Closes #1 Infra: [server-infra#27](ai_ml_operations/server-infra#27) (easy deploy beta). ## Test plan - [ ] Product page shows photo first, 3D model second; color swatches swap photos and stock - [ ] Portal can upload multiple photos and per-color qty/images; STL stays shared - [ ] Public home/about/gallery have no t-shirt mockups - [ ] `manage.py test` passes - [ ] After server-infra#27: beta deploy to `print-forge-preview.aimloperations.com` Reviewed-on: #2
74 lines
2.1 KiB
YAML
74 lines
2.1 KiB
YAML
name: Deploy Prod
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
unit-tests:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
run: |
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --frozen
|
|
|
|
- name: Run unit tests
|
|
env:
|
|
DJANGO_ENV: dev
|
|
DJANGO_SECRET_KEY: test-secret-key
|
|
DATABASE_URL: ""
|
|
DB_HOST: ""
|
|
run: |
|
|
cd site
|
|
uv run python manage.py test
|
|
|
|
docker:
|
|
needs: unit-tests
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
run: docker compose build
|
|
|
|
- name: Run containerized tests
|
|
run: |
|
|
set -euo pipefail
|
|
unset DATABASE_URL DB_HOST DB_NAME DB_USER DB_PASSWORD DB_PORT \
|
|
COMPOSE_DATABASE_URL DJANGO_ENV DJANGO_SECRET_KEY DJANGO_DEBUG \
|
|
DJANGO_ALLOWED_HOSTS || true
|
|
|
|
PROJECT="print-forge-ci-${{ gitea.sha }}"
|
|
cleanup() { docker compose -p "$PROJECT" down -v --remove-orphans || true; }
|
|
trap cleanup EXIT
|
|
|
|
docker compose -p "$PROJECT" up -d --wait db
|
|
docker compose -p "$PROJECT" run --rm --no-deps --entrypoint "" \
|
|
-e DJANGO_ENV=dev \
|
|
-e DJANGO_SECRET_KEY=test-secret-key \
|
|
-e DJANGO_DEBUG=true \
|
|
-e DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,testserver \
|
|
-e DATABASE_URL=postgres://print_forge:print_forge@db:5432/print_forge \
|
|
-e SITE_UNDER_CONSTRUCTION=false \
|
|
web uv run python manage.py test
|
|
|
|
deploy-prod:
|
|
needs: docker
|
|
runs-on: self-hosted
|
|
env:
|
|
SERVER_INFRA_ROOT: /home/westfarn/Documents/repos/server-infra
|
|
ANSIBLE_PRIVATE_KEY_FILE: /home/westfarn/.ssh/ansible_deploy
|
|
steps:
|
|
# --app must match server-infra app_catalog (print_forge).
|
|
- name: Deploy print_forge prod to all webservers
|
|
run: |
|
|
"$SERVER_INFRA_ROOT/scripts/deploy.sh" \
|
|
--app print_forge \
|
|
--env prod \
|
|
--ref "${{ gitea.sha }}"
|