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
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ jobs:
- uses: actions/checkout@v7
- run: swift --version
- run: swift build
# CI links a newer SDK than local SwiftPM builds record, which can change AppKit behavior
# (v0.1.0 crashed at launch only when built here), so launch what CI built.
- name: Launch smoke test
run: ./scripts/smoke-test.sh "$(swift build --show-bin-path)/MacDirStat"
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
- name: Build and sign
run: UNIVERSAL=1 VERSION="${GITHUB_REF_NAME#v}" ./scripts/build-app.sh

- name: Launch smoke test
run: ./scripts/smoke-test.sh .build/MacDirStat.app/Contents/MacOS/MacDirStat

- name: Notarize
env:
NOTARY_API_KEY: ${{ secrets.NOTARY_API_KEY }}
Expand Down
21 changes: 21 additions & 0 deletions scripts/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Launches MacDirStat and fails if it exits within a few seconds, to catch crashes at launch.
# Usage: scripts/smoke-test.sh PATH_TO_BINARY [SECONDS]
set -uo pipefail

BINARY="${1:?usage: $0 PATH_TO_BINARY [SECONDS]}"
WAIT_SECONDS="${2:-10}"

"$BINARY" >/dev/null 2>&1 &
PID=$!
sleep "$WAIT_SECONDS"

if kill -0 "$PID" 2>/dev/null; then
kill "$PID"
echo "MacDirStat was still running after ${WAIT_SECONDS}s"
else
STATUS=0
wait "$PID" || STATUS=$?
echo "MacDirStat exited during launch with status $STATUS" >&2
exit 1
fi
Loading