mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Automated testing for setup instructions in README.md (#399)
* add setup tests * continue, even on error * add build:packages * add automated branch for setup testing * add delay * combine commands * rollback * update README * use action to run in background * try running in foreground for testing * set shell * check if running codegen before works * fix quetzal file missing * swap the order * use background action * fix * try this instead * modify readme * add sleep * raise the timeout * run on faster machine * use jarvus instead * Update packages/stack/scripts/merge-quetzal-translations.ts Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com> * Update README.md Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com> * fix run on all branches * Update .github/workflows/setup-tests.yaml Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com> --------- Co-authored-by: root <TheCactusBlue> Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
This commit is contained in:
parent
1c35695a66
commit
e27173d27e
51
.github/workflows/setup-tests.yaml
vendored
Normal file
51
.github/workflows/setup-tests.yaml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: "Run setup tests"
|
||||
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
- main
|
||||
|
||||
env:
|
||||
SHELL: /usr/bin/bash
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubicloud-standard-8
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js v20
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9.1.2
|
||||
|
||||
- name: Install packages
|
||||
run: pnpm install
|
||||
|
||||
- run: pnpm run build:packages
|
||||
- run: pnpm run codegen
|
||||
- run: pnpm run start-deps
|
||||
|
||||
- uses: JarvusInnovations/background-action@v1.0.7
|
||||
with:
|
||||
run: pnpm run dev &
|
||||
wait-on: |
|
||||
http://localhost:8102
|
||||
tail: true
|
||||
wait-for: 120s
|
||||
log-output-if: true
|
||||
# - run: pnpm run dev & sleep 120
|
||||
- run: pnpm test
|
||||
|
||||
13
README.md
13
README.md
@ -122,21 +122,22 @@ In a new terminal:
|
||||
```sh
|
||||
pnpm install
|
||||
|
||||
# Run build to build everything once
|
||||
pnpm run build:dev
|
||||
# Build the packages and generate code. We only need to do this once, as `pnpm dev` will do this from now on
|
||||
pnpm build:packages
|
||||
pnpm codegen
|
||||
|
||||
# reset & start the dependencies (DB, Inbucket, etc.) as Docker containers, seeding the DB with the Prisma schema
|
||||
pnpm run start-deps
|
||||
# Reset & start the dependencies (DB, Inbucket, etc.) as Docker containers, seeding the DB with the Prisma schema
|
||||
pnpm start-deps
|
||||
# pnpm run restart-deps
|
||||
# pnpm run stop-deps
|
||||
|
||||
# Start the dev server
|
||||
pnpm run dev
|
||||
pnpm dev
|
||||
# For systems with limited resources, you can run a minimal development setup with just the backend and dashboard
|
||||
# pnpm run dev:basic
|
||||
|
||||
# In a different terminal, run tests in watch mode
|
||||
pnpm run test
|
||||
pnpm test
|
||||
```
|
||||
|
||||
You can now open the dev launchpad at [http://localhost:8100](http://localhost:8100). From there, you can navigate to the dashboard at [http://localhost:8101](http://localhost:8101), API on port 8102, demo on port 8103, docs on port 8104, Inbucket (e-mails) on port 8105, and Prisma Studio on port 8106. See the dev launchpad for a list of all running services.
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
"build:backend": "only-allow pnpm && turbo run build --filter=@stackframe/stack-backend...",
|
||||
"build:dashboard": "only-allow pnpm && turbo run build --filter=@stackframe/stack-dashboard...",
|
||||
"build:demo": "only-allow pnpm && turbo run build --filter=demo-app...",
|
||||
"build:packages": "only-allow pnpm && turbo run build --filter=./packages/*",
|
||||
"clean": "only-allow pnpm && turbo run clean && rimraf --glob **/.next && rimraf --glob **/.turbo && rimraf .turbo && rimraf --glob **/node_modules",
|
||||
"codegen": "only-allow pnpm && turbo run codegen",
|
||||
"deps-compose": "docker compose -f dependencies.compose.yaml",
|
||||
|
||||
@ -1,12 +1,20 @@
|
||||
import { deindent, stringCompare } from "@stackframe/stack-shared/dist/utils/strings";
|
||||
import * as fs from "fs";
|
||||
import quetzalKeys from "../quetzal-translations/keystore.json";
|
||||
import supportedLocales from "../quetzal-translations/supported-locales.json";
|
||||
import * as path from "path";
|
||||
|
||||
async function main() {
|
||||
let quetzalKeys, supportedLocales
|
||||
try {
|
||||
quetzalKeys = JSON.parse(fs.readFileSync(path.join(__dirname, "../quetzal-translations/keystore.json"), 'utf-8'));
|
||||
supportedLocales = JSON.parse(fs.readFileSync(path.join(__dirname, "../quetzal-translations/supported-locales.json"), 'utf-8'));
|
||||
} catch (e: unknown) {
|
||||
console.warn('Quetzal translation files not found, assuming Quetzal failed. The translations will not be updated.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const locales = Object.fromEntries(await Promise.all(supportedLocales.map(async (locale) => [
|
||||
locale,
|
||||
(await import(`../quetzal-translations/${locale}.json`)).default
|
||||
JSON.parse(fs.readFileSync(path.join(__dirname, `../quetzal-translations/${locale}.json`), 'utf-8'))
|
||||
] as const)));
|
||||
|
||||
// replace Quetzal's auto-generated IDs (like k-0, k-1, etc.) with our own
|
||||
|
||||
Loading…
Reference in New Issue
Block a user