Files
immich-sdk/scripts/run-example.sh
Joakim Hulthe 2e7db3b35a Add integration testing infrastructure with Podman Compose
- Add docker/podman-compose.yml for Immich server (no ML)
- Add test-data/sample-photos/ with 3 public domain images
- Add scripts/start-immich.sh for container startup + admin/API key creation
- Add scripts/seed-data.sh for uploading test photos and creating albums
- Add scripts/stop-immich.sh for cleanup with volume destruction
- Add scripts/run-example.sh wrapper (fixed env var export)
- Update examples to use IMMICH_URL and IMMICH_API_KEY env vars
- Add .github/workflows/integration-test.yml for CI
- Update assets.list() to use /search/metadata endpoint
- Update AGENTS.md with example running instructions
- Add 5 new examples: search_metadata, album_management, timeline_browsing,
  delete_assets, server_info
2026-04-14 20:13:30 +00:00

43 lines
909 B
Bash
Executable File

#!/bin/bash
set -e
EXAMPLE=$1
if [ -z "$EXAMPLE" ]; then
echo "Usage: $0 <example_name>"
echo "Available examples:"
ls examples/*.rs | sed 's/examples\///' | sed 's/\.rs$//' | sed 's/^/ - /'
exit 1
fi
# Check if example exists
if [ ! -f "examples/${EXAMPLE}.rs" ]; then
echo "Error: Example 'examples/${EXAMPLE}.rs' not found"
exit 1
fi
cd "$(dirname "$0")/.."
# Start immich if not running
if ! curl -s http://localhost:2283/api/server/ping > /dev/null 2>&1; then
echo "Immich is not running. Starting..."
./scripts/start-immich.sh
fi
# Seed data if not already done
if [ ! -f .seeded ]; then
echo "Seeding test data..."
./scripts/seed-data.sh
touch .seeded
fi
# Load environment variables
# set -a exports all variables defined from here on
set -a
source .env.test
set +a
# Run the example
echo "Running example: $EXAMPLE"
cargo run --example "$EXAMPLE"