Skip to content

Commit 15d62bf

Browse files
committed
Add backend & frontend tests
1 parent aa7eaaf commit 15d62bf

204 files changed

Lines changed: 19270 additions & 1764 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ddev/addon-metadata/ddev-playwright/manifest.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.ddev/commands/web/playwright

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
#!/bin/sh
2-
#ddev-generated
32

4-
cd test/playwright || exit 1
3+
set -eu
54

6-
if [ -f bun.lock ]; then
7-
bun && bun playwright "$@"
8-
elif [ -f yarn.lock ]; then
9-
yarn && yarn playwright "$@"
10-
else
11-
npx playwright "$@"
12-
fi
5+
export PW_TEST_CONNECT_WS_ENDPOINT="${PW_TEST_CONNECT_WS_ENDPOINT:-ws://playwright:3000/}"
6+
7+
exec bunx playwright "$@"

.ddev/config.playwright.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.ddev/config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@ database:
1313
webimage_extra_packages: [ffmpeg, libgl1]
1414
use_dns_when_possible: true
1515
composer_version: '2'
16-
web_environment: []
16+
web_environment:
17+
- PW_TEST_CONNECT_WS_ENDPOINT=ws://playwright:3000/
18+
- PEST_BROWSER_PLAYWRIGHT_HOST=playwright
19+
- PEST_BROWSER_PLAYWRIGHT_PORT=3000
20+
- RENPY_ANALYSIS_MODE=sandbox
21+
- RENPY_ANALYZER_URL=http://stats-runner:8080/api/renpy-analyzer/analyze
22+
- RENPY_ANALYZER_TOKEN=ddev-renpy-analyzer
23+
- RENPY_ANALYZER_TIMEOUT=300
24+
- RENPY_ANALYZER_HOST_WORK_DIR=${DDEV_APPROOT}/.ddev/.renpy-analyzer
25+
- RENPY_ANALYZER_CONTAINER_WORK_DIR=/runner-work
26+
- RENPY_SDK_DOCKER_HOST_PATH=${RENPY_SDK_HOST_PATH:-/tmp/fvn-empty-renpy-sdk}
1727
corepack_enable: false
1828
web_extra_exposed_ports:
1929
- name: vite
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
services:
2+
playwright:
3+
container_name: ddev-${DDEV_SITENAME}-playwright
4+
image: mcr.microsoft.com/playwright:v1.59.1-noble
5+
init: true
6+
ipc: host
7+
working_dir: /home/pwuser
8+
user: pwuser
9+
command:
10+
- /bin/sh
11+
- -c
12+
- npx -y playwright@1.59.1 run-server --port 3000 --host 0.0.0.0
13+
expose:
14+
- "3000"
15+
external_links:
16+
- ddev-router:${DDEV_HOSTNAME}
17+
labels:
18+
com.ddev.site-name: ${DDEV_SITENAME}
19+
com.ddev.approot: ${DDEV_APPROOT}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
services:
22
web:
33
volumes:
4-
- ${RENPY_SDK_HOST_PATH}:/opt/renpy-sdk
4+
- ${RENPY_SDK_HOST_PATH:-/tmp/fvn-empty-renpy-sdk}:/opt/renpy-sdk:ro
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
services:
2+
stats-runner:
3+
container_name: ddev-${DDEV_SITENAME}-stats-runner
4+
image: ddev/ddev-webserver:${DDEV_VERSION}-${DDEV_SITENAME}-built
5+
user: root
6+
working_dir: /var/www/html/public
7+
command:
8+
- php8.5
9+
- -S
10+
- 0.0.0.0:8080
11+
- ../vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php
12+
expose:
13+
- "8080"
14+
healthcheck:
15+
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8080/health >/dev/null"]
16+
interval: 1s
17+
timeout: 5s
18+
retries: 120
19+
start_period: 5s
20+
environment:
21+
APP_KEY: ${APP_KEY:-base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=}
22+
RENPY_ANALYZER_SERVER: "true"
23+
RENPY_ANALYZER_TOKEN: ddev-renpy-analyzer
24+
RENPY_ANALYZER_IMAGE: ddev/ddev-webserver:${DDEV_VERSION}-${DDEV_SITENAME}-built
25+
RENPY_ANALYZER_PHP_BINARY: php8.5
26+
RENPY_ANALYZER_HOST_WORK_DIR: ${DDEV_APPROOT}/.ddev/.renpy-analyzer
27+
RENPY_ANALYZER_CONTAINER_WORK_DIR: /runner-work
28+
RENPY_SDK_DOCKER_HOST_PATH: ${RENPY_SDK_HOST_PATH:-/tmp/fvn-empty-renpy-sdk}
29+
RENPY_SDK_PATH: /opt/renpy-sdk
30+
APP_ENV: local
31+
volumes:
32+
- ${DDEV_APPROOT}:/var/www/html:cached
33+
- ${DDEV_APPROOT}/.ddev/.renpy-analyzer:/runner-work
34+
- ${RENPY_SDK_HOST_PATH:-/tmp/fvn-empty-renpy-sdk}:/opt/renpy-sdk:ro
35+
- /var/run/docker.sock:/var/run/docker.sock
36+
labels:
37+
com.ddev.site-name: ${DDEV_SITENAME}
38+
com.ddev.approot: ${DDEV_APPROOT}

.ddev/web-build/Dockerfile.archive-tools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
RUN apt-get update \
2-
&& apt-get install -y --no-install-recommends pipx \
2+
&& apt-get install -y --no-install-recommends docker-cli pipx \
33
&& PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install unrpa \
44
&& PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install rpycdec \
55
&& apt-get clean \

.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ ITCHIO_CLIENT_ID=
105105
ITCHIO_CLIENT_SECRET=
106106

107107
RENPY_SDK_PATH=/opt/renpy-sdk
108+
RENPY_ANALYSIS_MODE=sandbox
109+
RENPY_ANALYZER_URL=http://stats-runner:8080/api/renpy-analyzer/analyze
110+
RENPY_ANALYZER_TOKEN=
111+
RENPY_ANALYZER_TIMEOUT=300
112+
RENPY_ANALYZER_PHP_BINARY=php
113+
RENPY_ANALYZER_STALE_CLEANUP_SECONDS=7200
114+
RENPY_ANALYZER_HOST_WORK_DIR=/var/lib/fvn-renpy-analyzer
115+
RENPY_ANALYZER_CONTAINER_WORK_DIR=/runner-work
116+
RENPY_SDK_DOCKER_HOST_PATH=/opt/renpy-sdk
108117

109118
NIGHTWATCH_TOKEN=
110119
NIGHTWATCH_REQUEST_SAMPLE_RATE=0.05

.github/workflows/deploy.yml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,68 @@ concurrency:
1414
cancel-in-progress: false
1515

1616
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v6
24+
with:
25+
fetch-depth: 2
26+
27+
- name: Setup DDEV
28+
uses: ddev/github-action-setup-ddev@v1
29+
with:
30+
autostart: false
31+
32+
- name: Start DDEV
33+
run: |
34+
sudo mkdir -p /tmp/fvn-empty-renpy-sdk
35+
ddev start -y
36+
ddev describe
37+
38+
- name: Install Composer dependencies
39+
run: ddev composer install --no-interaction --prefer-dist
40+
41+
- name: Install Bun dependencies
42+
run: ddev bun install --frozen-lockfile
43+
44+
- name: Validate Composer config
45+
run: ddev composer validate --no-check-publish
46+
47+
- name: Check patch whitespace
48+
run: |
49+
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
50+
git diff --check HEAD^ HEAD
51+
else
52+
git diff --check
53+
fi
54+
55+
- name: Type check frontend
56+
run: ddev bun types
57+
58+
- name: Lint frontend
59+
run: ddev bun lint:check
60+
61+
- name: Run test suite
62+
run: ddev composer test
63+
64+
- name: Upload test artifacts
65+
if: failure()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: test-artifacts
69+
if-no-files-found: ignore
70+
path: |
71+
build/frontend-coverage
72+
playwright-report
73+
test-results
74+
tests/e2e/reports
75+
storage/logs
76+
1777
deploy:
78+
needs: test
1879
runs-on: ubuntu-latest
1980
permissions:
2081
contents: read
@@ -23,7 +84,7 @@ jobs:
2384
- name: Checkout code
2485
uses: actions/checkout@v6
2586
with:
26-
fetch-depth: 2 # Needed to check for file changes
87+
fetch-depth: 2 # Needed to check for file changes
2788

2889
- name: Set deployment variables
2990
id: vars

0 commit comments

Comments
 (0)