mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-20 17:02:53 -04:00
ArtCraft Desktop (fresh start)
This is a fresh start for the `artcraft` repo. The old monorepo, which included our web API gateway, job services, SRE tools, various frontends, and more has moved to `artcraft-services` You can find the full git history here: https://github.com/storytold/artcraft-services This change was motivated by the fact that the entire git history was hundreds of gigabytes in size, which is unwieldy for anyone not in the core team that doesn't care about support services outside of the core artcraft app. We wanted to keep this repo in its well-known place since we already have users and activity here. Please update your remotes to either `artcraft-services` or make a fresh clone of this repo. History can be found at the artcraft-services repo.
This commit is contained in:
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
echo 'Looking for unused dependencies'
|
||||
|
||||
# NB(bt,2025-05-26): Previous version was "cargo-udeps 0.1.48"
|
||||
# https://github.com/est31/cargo-udeps
|
||||
# https://stackoverflow.com/a/72082679
|
||||
# Needs nightly to run
|
||||
cargo +nightly udeps --all-targets
|
||||
|
||||
# TODO: Ask for user input before applying some automated heuristics
|
||||
|
||||
echo 'Done.'
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
echo 'Run cargo check...'
|
||||
|
||||
#RUSTFLAGS=-Awarnings cargo check
|
||||
cargo check
|
||||
|
||||
echo 'Run lints...'
|
||||
./execute_lints.sh
|
||||
|
||||
echo 'Run tests...'
|
||||
./execute_tests.sh
|
||||
|
||||
echo 'All tests and lints passed successfully!'
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
echo 'Running lints...'
|
||||
|
||||
# TODO: 'fakeyou_client' is broken
|
||||
# TODO: 'sqlite_queries' and 'aichatbot-sidecar' are broken due to sqlite
|
||||
# newrelic excluded since we don't author it
|
||||
|
||||
# --no-deps prevents running on path dependencies within workspaces
|
||||
cargo cranky \
|
||||
--no-deps \
|
||||
--workspace \
|
||||
--exclude aichatbot-sidecar \
|
||||
--exclude fakeyou_client \
|
||||
--exclude sqlite_queries \
|
||||
--exclude newrelic-telemetry
|
||||
|
||||
echo 'Lints passed.'
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
echo 'Running tests...'
|
||||
|
||||
# TODO: Fix 'fakeyou_client' and 'billing_component'
|
||||
# TODO: Run 'sqlite_queries' and 'aichatbot-sidecar' after postgres migrations
|
||||
|
||||
cargo test \
|
||||
--workspace \
|
||||
--exclude aichatbot-sidecar \
|
||||
--exclude billing_component \
|
||||
--exclude fakeyou_client \
|
||||
--exclude inference-job \
|
||||
--exclude mysql_queries \
|
||||
--exclude sqlite_queries
|
||||
|
||||
# Single broken tests
|
||||
cargo test \
|
||||
--package inference-job \
|
||||
-- \
|
||||
--skip util::audiowmark::tests::test_audiowmark \
|
||||
--skip util::common_commands::audiowmark::tests::test_audiowmark
|
||||
|
||||
cargo test \
|
||||
--package mysql_queries \
|
||||
-- \
|
||||
--skip queries::model_weights::tests
|
||||
|
||||
echo 'Tests passed.'
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Fast, safe cleanup of the cargo ./target directory.
|
||||
#
|
||||
# Why this script exists:
|
||||
# - `rm -rf target` hangs on huge target dirs (millions of small files).
|
||||
# - `rm target/prefix*` blows up the shell glob with too many completions.
|
||||
#
|
||||
# Strategy:
|
||||
# - Resolve target dir relative to the repo root, then sanity-check we're
|
||||
# actually inside it before touching anything.
|
||||
# - Walk the tree with `find -delete` (a single in-process traversal that
|
||||
# unlinks as it goes — much faster than spawning rm per file).
|
||||
# - Stream progress to stdout every N entries so it's clear something is
|
||||
# happening.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# --- locate repo root and target dir -----------------------------------------
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd -- "$SCRIPT_DIR/../.." && pwd)"
|
||||
TARGET_DIR="${1:-$REPO_ROOT/target}"
|
||||
|
||||
# --- safety checks -----------------------------------------------------------
|
||||
|
||||
if [[ ! -d "$TARGET_DIR" ]]; then
|
||||
echo "target dir does not exist: $TARGET_DIR"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Resolve to absolute path and refuse anything that doesn't end in /target.
|
||||
TARGET_DIR="$(cd -- "$TARGET_DIR" && pwd)"
|
||||
case "$TARGET_DIR" in
|
||||
*/target) ;;
|
||||
*)
|
||||
echo "refusing to clean a path that doesn't end in /target: $TARGET_DIR"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Refuse paths suspiciously close to root.
|
||||
if [[ "$TARGET_DIR" == "/target" || "${#TARGET_DIR}" -lt 12 ]]; then
|
||||
echo "refusing to clean suspicious path: $TARGET_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cleaning: $TARGET_DIR"
|
||||
START=$(date +%s)
|
||||
|
||||
# --- delete with progress ----------------------------------------------------
|
||||
|
||||
# `find -delete` removes files and (now-empty) directories during traversal.
|
||||
# We pipe -print through awk to emit a progress line every 5000 entries.
|
||||
# Note: -print fires before -delete for files, after for dirs — fine for progress.
|
||||
COUNT=$(
|
||||
find "$TARGET_DIR" -mindepth 1 -print -delete 2>/dev/null \
|
||||
| awk -v start="$START" '
|
||||
{
|
||||
n++
|
||||
if (n % 5000 == 0) {
|
||||
elapsed = systime() - start
|
||||
rate = (elapsed > 0) ? n / elapsed : n
|
||||
printf " deleted %d entries (%.0f/s)\n", n, rate > "/dev/stderr"
|
||||
}
|
||||
}
|
||||
END { print n }
|
||||
'
|
||||
)
|
||||
|
||||
ELAPSED=$(( $(date +%s) - START ))
|
||||
echo "Done. Removed $COUNT entries in ${ELAPSED}s."
|
||||
|
||||
# Recreate empty target/ so cargo doesn't complain on next build.
|
||||
mkdir -p "$TARGET_DIR"
|
||||
@@ -0,0 +1,13 @@
|
||||
# This script is a little rough
|
||||
|
||||
# Step 1
|
||||
cargo sqlx migrate run \
|
||||
--database-url "sqlite:C:\Users\Bombay\AppData\Local\Temp\tasks.sqlite" \
|
||||
--source "C:\Users\Bombay\Documents\GitHub\storyteller-rust\_sql\artcraft_migrations"
|
||||
|
||||
# Step 2
|
||||
Push-Location -Path ".\crates\schema\database\sqlite_tasks"
|
||||
cargo sqlx prepare \
|
||||
--database-url "sqlite:C:\Users\Bombay\AppData\Local\Temp\tasks.sqlite"
|
||||
Pop-Location
|
||||
|
||||
Reference in New Issue
Block a user