Skip to content

feat: Add oauth token persistence #58

feat: Add oauth token persistence

feat: Add oauth token persistence #58

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
jobs:
lint-and-format:
name: Lint & Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python
run: uv python install 3.14
- name: Install dependencies
run: uv sync
- name: Run ruff linting
run: uv run ruff check
- name: Run ruff format check
run: uv run ruff format --check
build-test:
name: Build Test
runs-on: ubuntu-latest
needs: lint-and-format
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python
run: uv python install 3.14
- name: Install dependencies
run: uv sync
- name: Test package build
run: uv build
- name: Test package installation
run: uv pip install dist/*.whl
- name: Test application startup
run: |
set -euo pipefail
# Start the server in background with dummy env vars
export FIREFLY_BASE_URL="https://demo.firefly-iii.org"
export FIREFLY_TOKEN="dummy_token_for_ci_testing"
export MCP_TRANSPORT="http"
# Avoid log buffering when redirecting to a file
export PYTHONUNBUFFERED="1"
# Run server in background and capture output
timeout 30s uv run lampyrid > startup.log 2>&1 &
PID=$!
cleanup() {
kill "$PID" 2>/dev/null || true
# Also terminate any child process spawned by timeout
pkill -TERM -P "$PID" 2>/dev/null || true
}
trap cleanup EXIT
# Wait for startup (max 30 seconds to match timeout)
echo "Waiting for server to start..."
for i in {1..30}; do
if grep -q "Application startup complete" startup.log; then
echo "✓ Server started successfully!"
cat startup.log
exit 0
fi
# Abort early if process already exited
if ! kill -0 "$PID" 2>/dev/null; then
echo "✗ Server process exited before completing startup"
echo "=== Server output ==="
cat startup.log || true
exit 1
fi
sleep 1
done
# If we get here, startup failed
echo "✗ Server failed to start within timeout"
echo "=== Server output ==="
cat startup.log
exit 1
docker-build-test:
name: Docker Build Test
runs-on: ubuntu-latest
needs: lint-and-format
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: lampyrid:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test Docker container startup
run: |
set -euo pipefail
# Setup cleanup trap
cleanup() {
docker rm -f lampyrid-test >/dev/null 2>&1 || true
}
trap cleanup EXIT
# Start container in background with dummy env vars
echo "Starting container..."
docker run -d --name lampyrid-test \
-e FIREFLY_BASE_URL="https://demo.firefly-iii.org" \
-e FIREFLY_TOKEN="dummy_token_for_ci_testing" \
-e MCP_TRANSPORT="http" \
lampyrid:test
# Wait for startup (max 20 seconds)
echo "Waiting for container to start..."
for i in {1..20}; do
if docker logs lampyrid-test 2>&1 | grep -q "Application startup complete"; then
echo "✓ Container started successfully!"
echo "=== Container logs ==="
docker logs lampyrid-test 2>&1
exit 0
fi
# Early exit if container died
if ! docker ps -q --filter "name=lampyrid-test" | grep -q .; then
echo "✗ Container exited unexpectedly"
echo "=== Container logs ==="
docker logs lampyrid-test 2>&1
exit 1
fi
sleep 1
done
# If we get here, startup failed
echo "✗ Container failed to start within timeout"
echo "=== Container logs ==="
docker logs lampyrid-test 2>&1
exit 1