split: CI workflows, scripts, root tooling, and docs
Forgejo workflows (new), GitHub workflow tweaks, .gitignore/.vscode, root package-lock, rustfmt.toml, scripts/* updates, docs/ updates including data-flow / authentication / server-setup, CLAUDE.md and README updates.
This commit is contained in:
parent
9a75569e83
commit
70f97c4b16
29 changed files with 3571 additions and 3152 deletions
|
|
@ -35,7 +35,8 @@ cd ..
|
|||
|
||||
cp frontend/obsidian-plugin/manifest.json manifest.json # for BRAT, otherwise it wouldn't update
|
||||
|
||||
git ls-files | xargs npx eclint fix
|
||||
# Format all files across the project (frontend and backend)
|
||||
npx -C frontend prettier --write "**/*.{ts,js,json,md,yml,yaml}"
|
||||
|
||||
# Commit and tag
|
||||
git add .
|
||||
|
|
|
|||
|
|
@ -30,8 +30,11 @@ fi
|
|||
which cargo-machete || cargo install cargo-machete
|
||||
cargo machete --with-metadata
|
||||
|
||||
cd ..
|
||||
scripts/update-api-types.sh # this will dirty up the git state if not up-to-date
|
||||
|
||||
echo "Running checks in frontend"
|
||||
cd ../frontend
|
||||
cd frontend
|
||||
|
||||
if [[ "$FIX_MODE" == true ]]; then
|
||||
npm install
|
||||
|
|
@ -45,10 +48,11 @@ cd frontend
|
|||
npm run build
|
||||
npm run test
|
||||
npm run lint
|
||||
cd ..
|
||||
|
||||
# Use git ls-files to only check tracked files, respecting .gitignore
|
||||
# We always run in fix mode and then check with git status
|
||||
git ls-files | xargs npx eclint fix
|
||||
# Format all files across the project (frontend and backend)
|
||||
# Prettier respects .gitignore by default
|
||||
npx -C frontend prettier --write "**/*.{ts,js,json,md,yml,yaml}"
|
||||
|
||||
if [[ "$FIX_MODE" == false ]] && [[ $(git status --porcelain) ]]; then
|
||||
git status --porcelain
|
||||
|
|
@ -56,6 +60,4 @@ if [[ "$FIX_MODE" == false ]] && [[ $(git status --porcelain) ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "Success"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -rf sync-server/databases
|
||||
rm -rf /host/tmp/vaultlink-e2e-databases
|
||||
rm -rf logs
|
||||
|
|
|
|||
|
|
@ -19,35 +19,51 @@ process_count=$1
|
|||
|
||||
mkdir -p logs
|
||||
|
||||
# Build and restart the server
|
||||
echo "Building server..."
|
||||
cd sync-server
|
||||
cargo build --release
|
||||
|
||||
# Kill any existing server process
|
||||
echo "Stopping existing server..."
|
||||
pkill -f "sync_server" 2>/dev/null || true
|
||||
sleep 1
|
||||
|
||||
# Clean databases (uses tmpfs via /dev/shm for zero disk I/O)
|
||||
echo "Cleaning databases..."
|
||||
rm -rf /host/tmp/vaultlink-e2e-databases
|
||||
|
||||
# Start the server in the background
|
||||
echo "Starting server..."
|
||||
./target/release/sync_server config-e2e.yml &
|
||||
server_pid=$!
|
||||
echo "Server started with PID: $server_pid"
|
||||
|
||||
# Ensure server is killed on script exit
|
||||
cleanup_server() {
|
||||
if [ -n "$server_pid" ]; then
|
||||
echo "Stopping server (PID: $server_pid)..."
|
||||
kill $server_pid 2>/dev/null || true
|
||||
wait $server_pid 2>/dev/null || true
|
||||
server_pid=""
|
||||
fi
|
||||
}
|
||||
trap cleanup_server EXIT
|
||||
|
||||
cd ..
|
||||
|
||||
cd frontend
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
../scripts/utils/wait-for-server.sh
|
||||
|
||||
cd ..
|
||||
scripts/update-api-types.sh
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
git status --porcelain
|
||||
echo "Failing CI because the working directory is not clean after generating api types"
|
||||
exit 1
|
||||
fi
|
||||
cd frontend
|
||||
|
||||
pids=()
|
||||
for i in $(seq 1 $process_count); do
|
||||
# Create a named pipe for this process
|
||||
pipe="/tmp/vaultlink_pipe_$$_$i"
|
||||
mkfifo "$pipe"
|
||||
|
||||
# Start the node process writing to the pipe
|
||||
node test-client/dist/cli.js > "$pipe" 2>&1 &
|
||||
node test-client/dist/cli.js > "../logs/log_${i}.log" 2>&1 &
|
||||
pid=$!
|
||||
pids+=($pid)
|
||||
echo "Started process $i with PID: $pid"
|
||||
|
||||
# Read from pipe, prefix with PID
|
||||
(sed "s/^/[PID $pid] /" < "$pipe" > "../logs/log_${i}.log"; rm "$pipe") &
|
||||
echo "Started process $i with PID: $pid (log: logs/log_${i}.log)"
|
||||
done
|
||||
|
||||
cd ..
|
||||
|
|
@ -75,10 +91,25 @@ print_failed_log() {
|
|||
return 1
|
||||
}
|
||||
|
||||
echo "Monitoring $process_count processes"
|
||||
E2E_TIMEOUT=${2:-3600}
|
||||
start_time=$(date +%s)
|
||||
echo "Monitoring $process_count processes (timeout: ${E2E_TIMEOUT}s)"
|
||||
|
||||
# Monitor processes
|
||||
while true; do
|
||||
# Script-level timeout to prevent indefinite hangs
|
||||
current_time=$(date +%s)
|
||||
elapsed=$((current_time - start_time))
|
||||
if [ $elapsed -ge $E2E_TIMEOUT ]; then
|
||||
echo "E2E timeout reached (${E2E_TIMEOUT}s). Killing remaining processes."
|
||||
for pid in "${pids[@]}"; do
|
||||
if [ -n "$pid" ]; then
|
||||
kill $pid 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if print_failed_log; then
|
||||
# Kill remaining processes
|
||||
for pid in "${pids[@]}"; do
|
||||
|
|
@ -99,6 +130,7 @@ while true; do
|
|||
done
|
||||
|
||||
if $all_done; then
|
||||
cleanup_server
|
||||
echo "All processes completed successfully"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -8,9 +8,15 @@ cd sync-server
|
|||
cargo test export_bindings
|
||||
cd -
|
||||
|
||||
# Both target directories contain only generated bindings — wipe and copy
|
||||
rm -f frontend/sync-client/src/services/types/*.ts
|
||||
rm -f frontend/history-ui/src/lib/types/*.ts
|
||||
cp -r sync-server/bindings/* frontend/sync-client/src/services/types/
|
||||
cp -r sync-server/bindings/* frontend/history-ui/src/lib/types/
|
||||
|
||||
cd frontend
|
||||
npm run lint
|
||||
git ls-files | xargs npx eclint fix
|
||||
cd -
|
||||
cd ..
|
||||
|
||||
# Format all files across the project (frontend and backend)
|
||||
npx -C frontend prettier --write "**/*.{ts,js,json,md,yml,yaml}"
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
set -e
|
||||
|
||||
TARGET_NODE_VERSION=25
|
||||
|
||||
node_version=$(node -v | sed 's/^v\([0-9]*\).*/\1/')
|
||||
if [ "$node_version" != "22" ]; then
|
||||
echo "Error: This script requires Node.js version 22, found: $node_version"
|
||||
if [ "$node_version" != "$TARGET_NODE_VERSION" ]; then
|
||||
echo "Error: This script requires Node.js version $TARGET_NODE_VERSION, found: $node_version"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
set -e
|
||||
|
||||
SERVER_URL="http://localhost:3000"
|
||||
SERVER_URL="http://localhost:3010"
|
||||
MAX_RETRIES=30
|
||||
RETRY_INTERVAL_IN_SECONDS=5
|
||||
|
||||
echo "Waiting for $SERVER_URL to become available..."
|
||||
count=0
|
||||
while [ $count -lt $MAX_RETRIES ]; do
|
||||
if curl -s -f -o /dev/null $SERVER_URL; then
|
||||
if curl -s -o /dev/null $SERVER_URL; then
|
||||
echo "$SERVER_URL is now available!"
|
||||
break
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue