mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-19 18:45:15 +02:00
chore: enhance E2E tests workflow by adding caching for Next.js build and updating test command
This commit is contained in:
parent
548e574f1a
commit
292b4d70ac
4 changed files with 21 additions and 7 deletions
13
.github/workflows/e2e-tests.yml
vendored
13
.github/workflows/e2e-tests.yml
vendored
|
|
@ -21,8 +21,7 @@ jobs:
|
||||||
if: github.event.pull_request.draft == false
|
if: github.event.pull_request.draft == false
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
|
|
||||||
# Postgres runs as a step (not a service) so we can pass `-c wal_level=logical`,
|
# Postgres runs as a step (not a service)
|
||||||
# required for migration 117's zero-cache publications.
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis:8-alpine
|
image: redis:8-alpine
|
||||||
|
|
@ -246,9 +245,17 @@ jobs:
|
||||||
working-directory: surfsense_web
|
working-directory: surfsense_web
|
||||||
run: pnpm exec playwright install-deps chromium
|
run: pnpm exec playwright install-deps chromium
|
||||||
|
|
||||||
|
- name: Cache Next.js build
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: surfsense_web/.next/cache
|
||||||
|
key: nextjs-${{ runner.os }}-${{ hashFiles('surfsense_web/pnpm-lock.yaml') }}-${{ hashFiles('surfsense_web/**/*.{js,jsx,ts,tsx}') }}
|
||||||
|
restore-keys: |
|
||||||
|
nextjs-${{ runner.os }}-${{ hashFiles('surfsense_web/pnpm-lock.yaml') }}-
|
||||||
|
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
working-directory: surfsense_web
|
working-directory: surfsense_web
|
||||||
run: pnpm test:e2e
|
run: pnpm test:e2e:prod
|
||||||
|
|
||||||
- name: Upload Playwright HTML report
|
- name: Upload Playwright HTML report
|
||||||
if: always()
|
if: always()
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,11 @@ def run_migrations_offline() -> None:
|
||||||
|
|
||||||
|
|
||||||
def do_run_migrations(connection: Connection) -> None:
|
def do_run_migrations(connection: Connection) -> None:
|
||||||
context.configure(connection=connection, target_metadata=target_metadata)
|
context.configure(
|
||||||
|
connection=connection,
|
||||||
|
target_metadata=target_metadata,
|
||||||
|
transaction_per_migration=True,
|
||||||
|
)
|
||||||
|
|
||||||
with context.begin_transaction():
|
with context.begin_transaction():
|
||||||
context.run_migrations()
|
context.run_migrations()
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
"db:studio": "drizzle-kit studio",
|
"db:studio": "drizzle-kit studio",
|
||||||
"format:fix": "npx @biomejs/biome check --fix",
|
"format:fix": "npx @biomejs/biome check --fix",
|
||||||
"test:e2e": "playwright test",
|
"test:e2e": "playwright test",
|
||||||
|
"test:e2e:prod": "cross-env CI=1 playwright test",
|
||||||
"test:e2e:ui": "playwright test --ui",
|
"test:e2e:ui": "playwright test --ui",
|
||||||
"test:e2e:headed": "playwright test --headed",
|
"test:e2e:headed": "playwright test --headed",
|
||||||
"test:e2e:debug": "playwright test --debug",
|
"test:e2e:debug": "playwright test --debug",
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,13 @@ export default defineConfig({
|
||||||
webServer: process.env.PLAYWRIGHT_NO_WEB_SERVER
|
webServer: process.env.PLAYWRIGHT_NO_WEB_SERVER
|
||||||
? undefined
|
? undefined
|
||||||
: {
|
: {
|
||||||
// Pin to webpack dev (Turbopack has caused stale-lock panics in E2E).
|
// Local stays on webpack dev (Turbopack caused stale-lock panics in E2E).
|
||||||
command: "pnpm exec next dev",
|
command: process.env.CI
|
||||||
|
? "pnpm build && pnpm start"
|
||||||
|
: "pnpm exec next dev",
|
||||||
url: `http://localhost:${PORT}`,
|
url: `http://localhost:${PORT}`,
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
timeout: 180_000,
|
timeout: process.env.CI ? 300_000 : 180_000,
|
||||||
env: {
|
env: {
|
||||||
NEXT_PUBLIC_FASTAPI_BACKEND_URL: `http://localhost:${BACKEND_PORT}`,
|
NEXT_PUBLIC_FASTAPI_BACKEND_URL: `http://localhost:${BACKEND_PORT}`,
|
||||||
NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE: "LOCAL",
|
NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE: "LOCAL",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue