Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ jobs:

- name: Build
run: just build

- name: Desktop e2e
run: just e2e
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ brew install just

# 루트 품질 게이트 (justfile이 태스크 단일 진입점)
just lint
just test
just test # Python pytest + Swift 유닛 테스트
just e2e # desktop e2e 스모크 (fixture DB + 실제 앱 부팅)
just build # desktop 앱 빌드
just dev # desktop 앱 실행

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ On macOS, credentials can be stored in Keychain. SQLite keeps only the Keychain

```bash
just lint
just test
just test # Python pytest + Swift unit tests
just e2e # desktop e2e smoke (fixture DB + real app boot)
just build # desktop app
just dev # run desktop app
just format
Expand Down
7 changes: 6 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ lint:
uv run flake8 packages tests scripts
uv run pylint packages/skim-core/src/skim_core packages/skim-cli/src/skim_cli scripts

# Python 테스트
# 테스트 (Python + Swift)
test:
uv run pytest tests -q
swift test --package-path apps/desktop

# 데스크톱 e2e 스모크 (fixture DB + 실제 앱 부팅)
e2e:
sh scripts/desktop-e2e.sh

# 데스크톱 앱 빌드
build:
Expand Down
42 changes: 42 additions & 0 deletions scripts/desktop-e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
# Desktop e2e smoke: 실제 바이너리를 fixture 워크스페이스로 부팅시켜 검증한다.
# 1) SkimDesktopSmoke가 빈 fixture에 스키마를 만들고 0건을 읽는지
# 2) sqlite3로 시드한 포스트 1건을 같은 바이너리가 읽어내는지
# 3) SkimDesktop 앱이 fixture 워크스페이스로 부팅해 죽지 않는지
set -eu

ROOT="$(cd "$(dirname "$0")/.." && pwd)"
BIN="$(swift build --package-path "$ROOT/apps/desktop" --show-bin-path)"
swift build --package-path "$ROOT/apps/desktop"

FIXTURE="$(mktemp -d)"
APP_PID=""
cleanup() {
[ -n "$APP_PID" ] && kill "$APP_PID" 2>/dev/null || true
[ -n "$FIXTURE" ] && /bin/rm -rf -- "$FIXTURE"
}
trap cleanup EXIT

export SKIM_WORKSPACE_ROOT="$FIXTURE"
mkdir -p "$FIXTURE/data"

echo "== smoke: empty fixture =="
"$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

현재 파이프라인("$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=0")은 set -o pipefail이 설정되어 있지 않아, SkimDesktopSmoke가 실행 중 에러(non-zero exit code)를 내며 크래시가 발생하더라도 grep이 성공하면 전체 파이프라인이 성공한 것으로 간주됩니다. 또한 grep -q는 매칭되는 즉시 파이프를 닫으므로 teeSkimDesktopSmokeSIGPIPE로 인해 비정상 종료될 위험이 있습니다.

이를 방지하기 위해 출력을 변수에 담아 실행 성공 여부를 set -e로 보장받은 뒤, grep으로 검증하는 방식이 더 안전합니다.

Suggested change
"$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=0"
SMOKE_OUT=$("$BIN/SkimDesktopSmoke")
echo "$SMOKE_OUT"
echo "$SMOKE_OUT" | grep -q "recent_posts=0"


echo "== seed one post =="
sqlite3 "$FIXTURE/data/skim.db" "INSERT INTO posts (platform, external_id, author, title, content, content_markdown, url, timestamp)
VALUES ('hackernews', 'e2e-1', 'e2e', 'E2E fixture post', 'body', '# E2E fixture post', 'https://example.com', datetime('now'));"

echo "== smoke: seeded fixture =="
"$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

이전 단계와 마찬가지로, SkimDesktopSmoke가 실패하더라도 파이프라인이 성공으로 간주되는 것을 방지하고 SIGPIPE 오류를 피하기 위해 출력을 변수에 담아 검증하는 방식을 권장합니다.

Suggested change
"$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=1"
SEEDED_OUT=$("$BIN/SkimDesktopSmoke")
echo "$SEEDED_OUT"
echo "$SEEDED_OUT" | grep -q "recent_posts=1"


echo "== app boot =="
"$BIN/SkimDesktop" &
APP_PID=$!
sleep 5
kill -0 "$APP_PID" || { echo "FAIL: SkimDesktop exited within 5s"; exit 1; }
kill "$APP_PID"
wait "$APP_PID" 2>/dev/null || true
APP_PID=""

echo "OK: desktop e2e passed"
Loading