mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
ci: reorganize project scripts and E2E workflows by type
This commit is contained in:
@@ -363,7 +363,7 @@ jobs:
|
||||
GITHUB_BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
||||
GITHUB_HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
run: |
|
||||
MATRIX=$(node scripts/test/select-e2e-suites-json.mjs)
|
||||
MATRIX=$(node scripts/e2e/select-matrix.mjs)
|
||||
echo "matrix=$(echo "$MATRIX" | jq -c .)" >> "$GITHUB_OUTPUT"
|
||||
echo "selected_suites=$(echo "$MATRIX" | jq -c .)"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
suite-id:
|
||||
description: "E2E suite id from scripts/test/e2e-suites.mjs (e.g. scanner-scenarios)"
|
||||
description: "E2E suite id from scripts/e2e/suite-registry.mjs (e.g. scanner-scenarios)"
|
||||
required: true
|
||||
type: string
|
||||
check-name:
|
||||
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
- name: Build matrix
|
||||
id: build
|
||||
shell: bash
|
||||
run: echo "matrix=$(node scripts/test/list-suites-json.mjs)" >> "$GITHUB_OUTPUT"
|
||||
run: echo "matrix=$(node scripts/e2e/list-matrix.mjs)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
e2e:
|
||||
needs: setup
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ pnpm run e2e:run -- scanner-scenarios --testNamePattern=book-per-folder-disc-fol
|
||||
|
||||
### E2E runner architecture
|
||||
|
||||
- All suite metadata lives in `scripts/test/e2e-suites.mjs` (suite id, spec file, JUnit output, DB prep mode).
|
||||
- All suite metadata lives in `scripts/e2e/suite-registry.mjs` (suite id, spec file, JUnit output, DB prep mode).
|
||||
- Local and CI use the same command: `pnpm run e2e:run -- <suite-id>`.
|
||||
- Use `all` as a composite suite id to run every configured suite in order, or use `pnpm run e2e:all`.
|
||||
- Dedicated-db suites auto-start local PostgreSQL when `CI != true`, then reset and migrate the e2e database through `pnpm run e2e:db:prepare`.
|
||||
|
||||
+6
-6
@@ -2,7 +2,7 @@
|
||||
"name": "projectx",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"setup": "bash ./scripts/setup.sh",
|
||||
"setup": "bash ./scripts/bootstrap/local.sh",
|
||||
"dev": "concurrently --names \"types,server,client\" --prefix-colors \"cyan,blue,green\" \"pnpm --filter @projectx/types dev\" \"npm run dev:server\" \"npm run dev:client\"",
|
||||
"dev:client": "cd client && npm run dev -- --host",
|
||||
"dev:server": "cd server && npm run start:dev",
|
||||
@@ -22,9 +22,9 @@
|
||||
"test": "pnpm run test:server && pnpm run test:client",
|
||||
"test:server": "pnpm --filter server test",
|
||||
"test:client": "pnpm --filter client test:unit --run",
|
||||
"e2e:run": "node ./scripts/test/run-e2e-suite.mjs",
|
||||
"e2e:all": "node ./scripts/test/run-e2e-suite.mjs all",
|
||||
"e2e:list": "node ./scripts/test/run-e2e-suite.mjs --list",
|
||||
"e2e:run": "node ./scripts/e2e/run-suite.mjs",
|
||||
"e2e:all": "node ./scripts/e2e/run-suite.mjs all",
|
||||
"e2e:list": "node ./scripts/e2e/run-suite.mjs --list",
|
||||
"coverage": "pnpm run coverage:server && pnpm run coverage:client",
|
||||
"coverage:server": "pnpm --filter server test:cov",
|
||||
"coverage:client": "pnpm --filter client test:cov --run",
|
||||
@@ -33,8 +33,8 @@
|
||||
"prod:down": "docker compose down",
|
||||
"db:migrate": "pnpm --filter server db:migrate",
|
||||
"db:reset": "bash ./scripts/db/reset.sh",
|
||||
"db:seed": "bash ./scripts/db/seed.sh",
|
||||
"e2e:db:prepare": "bash ./scripts/db/prepare-e2e.sh",
|
||||
"db:seed": "bash ./scripts/db/seed-baseline.sh",
|
||||
"e2e:db:prepare": "bash ./scripts/e2e/prepare-db.sh",
|
||||
"e2e:db:migrate": "pnpm --filter server e2e:db:migrate",
|
||||
"prepare": "husky"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
if [[ ! -f server/.env ]]; then
|
||||
@@ -1,3 +1,3 @@
|
||||
import { listE2ESuites } from "./e2e-suites.mjs";
|
||||
import { listE2ESuites } from "./suite-registry.mjs";
|
||||
|
||||
process.stdout.write(JSON.stringify(listE2ESuites().map(({ id, name, timeout }) => ({ id, name, timeout }))));
|
||||
@@ -6,7 +6,7 @@ import { dirname, join } from "node:path";
|
||||
import process from "node:process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { getE2ESuite, listE2ESuites } from "./e2e-suites.mjs";
|
||||
import { getE2ESuite, listE2ESuites } from "./suite-registry.mjs";
|
||||
|
||||
const DEFAULT_E2E_DATABASE_URL = "postgres://projectx:projectx@localhost:5432/projectx_e2e";
|
||||
|
||||
@@ -4,4 +4,4 @@ set -euo pipefail
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
node ./scripts/test/run-e2e-suite.mjs "$@"
|
||||
node ./scripts/e2e/run-suite.mjs "$@"
|
||||
@@ -2,7 +2,7 @@ import { execFileSync } from "node:child_process";
|
||||
import { matchesGlob } from "node:path";
|
||||
import process from "node:process";
|
||||
|
||||
import { E2E_GLOBAL_CHANGE_PATHS, listE2ESuites } from "./e2e-suites.mjs";
|
||||
import { E2E_GLOBAL_CHANGE_PATHS, listE2ESuites } from "./suite-registry.mjs";
|
||||
|
||||
const ZERO_SHA_PATTERN = /^0+$/;
|
||||
|
||||
@@ -9,7 +9,11 @@ export const E2E_GLOBAL_CHANGE_PATHS = Object.freeze([
|
||||
"docker/**",
|
||||
]);
|
||||
|
||||
const SHARED_DB_AND_HELPER_PATHS = Object.freeze(["server/src/db/schema/**", "scripts/test/**", "scripts/db/**"]);
|
||||
const SHARED_DB_AND_HELPER_PATHS = Object.freeze([
|
||||
"server/src/db/schema/**",
|
||||
"scripts/e2e/**",
|
||||
"scripts/db/**",
|
||||
]);
|
||||
|
||||
const SHARED_AUTH_TYPE_PATHS = Object.freeze(["packages/types/src/auth.ts", "packages/types/src/permissions.ts"]);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Safe to run multiple times - sessions are deduplicated by session_id and
|
||||
# daily stats are upserted. Running again adds more data on top.
|
||||
#
|
||||
# Usage: ./scripts/seed/reading-sessions.sh [USER_ID]
|
||||
# Usage: ./scripts/fixtures/seed-reading-sessions.sh [USER_ID]
|
||||
# USER_ID defaults to 1.
|
||||
|
||||
set -euo pipefail
|
||||
Reference in New Issue
Block a user