123 lines
3.4 KiB
YAML
123 lines
3.4 KiB
YAML
version: "3"
|
|
silent: true
|
|
|
|
tasks:
|
|
default:
|
|
desc: Run all checks (analyze + unit tests + widget tests + integration, in parallel)
|
|
deps: [check]
|
|
|
|
_nix-check:
|
|
internal: true
|
|
run: once
|
|
preconditions:
|
|
- sh: test "${DIRENV_DIR#-}" = "{{.TASKFILE_DIR}}"
|
|
msg: "Not in nix dev shell. Run: nix develop"
|
|
|
|
_flutter-check:
|
|
internal: true
|
|
run: once
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- cmd: command -v flutter >/dev/null 2>&1 || fvm install
|
|
|
|
_pub-get:
|
|
internal: true
|
|
run: once
|
|
deps: [_flutter-check]
|
|
cmds:
|
|
- flutter pub get --suppress-analytics 2>/dev/null
|
|
|
|
install-hooks:
|
|
desc: Install pre-commit hooks (requires pre-commit; see .pre-commit-config.yaml)
|
|
cmds:
|
|
- pre-commit install
|
|
|
|
codegen:
|
|
desc: Generate Drift DB code (run after any schema change)
|
|
deps: [_nix-check, _pub-get]
|
|
cmds:
|
|
- flutter pub run build_runner build --delete-conflicting-outputs
|
|
|
|
analyze:
|
|
desc: Static analysis (flutter analyze)
|
|
deps: [_nix-check, _pub-get]
|
|
cmds:
|
|
- scripts/run_analyze.sh
|
|
|
|
analyze-fix:
|
|
desc: Auto-fix lint issues with dart fix --apply
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- dart fix --apply
|
|
|
|
test:
|
|
desc: Unit tests + coverage gate (fails if any non-excluded lib/ file is missing)
|
|
deps: [_nix-check, _pub-get]
|
|
cmds:
|
|
- scripts/run_unit_tests.sh
|
|
|
|
test-widget:
|
|
desc: Widget tests — headless, no display or network required
|
|
deps: [_nix-check, _pub-get]
|
|
cmds:
|
|
- scripts/run_widget_tests.sh
|
|
|
|
test-flutter:
|
|
desc: Full Flutter test suite (unit + widget + integration)
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- flutter test
|
|
|
|
integration:
|
|
desc: Integration tests against a local Stalwart mail server
|
|
deps: [_flutter-check]
|
|
cmds:
|
|
- stalwart-dev/test.sh
|
|
|
|
_check-libsecret:
|
|
internal: true
|
|
cmds:
|
|
- |
|
|
if pkg-config --exists libsecret-1; then
|
|
exit 0
|
|
elif dpkg -s libsecret-1-dev >/dev/null 2>&1; then
|
|
echo "Error: libsecret-1-dev is installed but pkg-config cannot find it."
|
|
echo "Your nix shell was opened before the package was installed."
|
|
echo "Fix: exit the nix shell and re-enter with: nix develop"
|
|
else
|
|
echo "Error: libsecret-1-dev is not installed."
|
|
echo "Fix: sudo apt install libsecret-1-dev"
|
|
fi
|
|
exit 1
|
|
|
|
build-linux:
|
|
desc: Build the Linux desktop app (debug)
|
|
deps: [_nix-check, _pub-get, _check-libsecret]
|
|
cmds:
|
|
- flutter build linux --debug --no-pub
|
|
- |
|
|
binary=build/linux/x64/debug/bundle/sharedinbox
|
|
missing=$(LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu ldd "$binary" 2>/dev/null | grep 'not found' || true)
|
|
if [ -n "$missing" ]; then
|
|
echo "Error: built binary has unresolvable runtime dependencies:"
|
|
echo "$missing"
|
|
echo "Fix: sudo apt install libsecret-1-0"
|
|
exit 1
|
|
fi
|
|
|
|
build-android:
|
|
desc: Build a release APK (output in build/app/outputs/flutter-apk/)
|
|
deps: [_nix-check, _pub-get]
|
|
cmds:
|
|
- flutter build apk --release --no-pub
|
|
|
|
run:
|
|
desc: Run the app on Linux desktop
|
|
deps: [_nix-check, _pub-get]
|
|
cmds:
|
|
- flutter run -d linux --no-pub
|
|
|
|
check:
|
|
desc: All fast checks — analyze + unit tests + widget tests + build-linux + integration in parallel
|
|
deps: [analyze, test, test-widget, build-linux, integration]
|