- ci.yml: dart run/dart test → flutter pub run/flutter test (all 3 jobs) - hooks/pre-commit: runs flutter analyze + flutter test before every commit - Taskfile: add install-hooks task (copies hooks/pre-commit → .git/hooks/) - LATER.md: remove resolved items (enough_mail fork, pre-commit, GH CI) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
106 lines
2.8 KiB
YAML
106 lines
2.8 KiB
YAML
version: "3"
|
|
|
|
tasks:
|
|
default:
|
|
desc: Run all checks (analyze + unit tests, 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"
|
|
|
|
install-hooks:
|
|
desc: Install git hooks from hooks/ into .git/hooks/
|
|
cmds:
|
|
- cp hooks/pre-commit .git/hooks/pre-commit
|
|
- chmod +x .git/hooks/pre-commit
|
|
- echo "Installed hooks/pre-commit → .git/hooks/pre-commit"
|
|
|
|
codegen:
|
|
desc: Generate Drift DB code (run after any schema change)
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- |
|
|
START=$(date +%s)
|
|
flutter pub run build_runner build --delete-conflicting-outputs
|
|
END=$(date +%s)
|
|
echo "codegen: $((END - START))s"
|
|
|
|
analyze:
|
|
desc: Static analysis with flutter analyze + analysis_options.yaml rules
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- |
|
|
START=$(date +%s)
|
|
flutter analyze
|
|
END=$(date +%s)
|
|
echo "analyze: $((END - START))s"
|
|
|
|
analyze-fix:
|
|
desc: Auto-fix lint issues with dart fix --apply
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- dart fix --apply
|
|
|
|
test:
|
|
desc: Run unit tests (no device needed) and enforce ≥100% line coverage
|
|
deps: [_nix-check]
|
|
vars:
|
|
COVERAGE_THRESHOLD: "100"
|
|
cmds:
|
|
- |
|
|
START=$(date +%s)
|
|
flutter test test/unit/ --coverage
|
|
END=$(date +%s)
|
|
echo "test: $((END - START))s"
|
|
- |
|
|
COVERED=$(awk '/^DA:/{split($0,a,":");split(a[2],b,",");t++;if(b[2]>0)h++} END{printf "%d", (t>0 ? int(h*100/t) : 0)}' coverage/lcov.info)
|
|
echo "coverage: ${COVERED}% (threshold: {{.COVERAGE_THRESHOLD}}%)"
|
|
if [ "${COVERED}" -lt "{{.COVERAGE_THRESHOLD}}" ]; then
|
|
echo "ERROR: coverage ${COVERED}% is below threshold {{.COVERAGE_THRESHOLD}}%"
|
|
exit 1
|
|
fi
|
|
|
|
test-flutter:
|
|
desc: Run Flutter widget tests
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- |
|
|
START=$(date +%s)
|
|
flutter test
|
|
END=$(date +%s)
|
|
echo "flutter test: $((END - START))s"
|
|
|
|
integration:
|
|
desc: Run integration tests (starts and stops Stalwart automatically)
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- |
|
|
START=$(date +%s)
|
|
stalwart-dev/test.sh
|
|
END=$(date +%s)
|
|
echo "integration: $((END - START))s"
|
|
|
|
build-android:
|
|
desc: Build a release APK (output in build/app/outputs/flutter-apk/)
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- |
|
|
START=$(date +%s)
|
|
flutter build apk --release
|
|
END=$(date +%s)
|
|
echo "build-android: $((END - START))s"
|
|
|
|
run:
|
|
desc: Run the app on Linux desktop
|
|
deps: [_nix-check]
|
|
cmds:
|
|
- flutter run -d linux
|
|
|
|
check:
|
|
desc: All fast checks — analyze + unit tests in parallel
|
|
deps: [analyze, test, integration]
|