CI / lint-backend (push) Successful in 1m27s
CI / lint-mobile (push) Successful in 10m24s
CI / test-backend (push) Successful in 1m33s
CI / test-mobile (push) Failing after 12m6s
CI / build-backend (push) Successful in 59s
CI / docker (push) Successful in 8s
119 lines
3.5 KiB
TOML
119 lines
3.5 KiB
TOML
[tasks.up_backend]
|
|
description = "Start PostgreSQL + backend API (Go/Gin)"
|
|
run = [
|
|
"docker compose up -d postgres --wait",
|
|
"cd backend && go run cmd/server/main.go",
|
|
]
|
|
|
|
[tasks.up_mobile]
|
|
description = "Build + install Android debug app (device or emulator)"
|
|
dir = "mobile-kotlin"
|
|
usage = '''
|
|
arg "[target]" {
|
|
help "Where to install"
|
|
choices "device" "emulator"
|
|
default "emulator"
|
|
}
|
|
'''
|
|
run = '''
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
./gradlew :app:assembleDebug -q
|
|
APK="app/build/outputs/apk/debug/app-debug.apk"
|
|
if [ "${usage_target?}" = "emulator" ]; then
|
|
ADB_FLAGS=(-e)
|
|
else
|
|
ADB_FLAGS=(-d)
|
|
fi
|
|
# adb natif s'il fonctionne (PATH + binaire exécutable sur cet OS)...
|
|
if command -v adb >/dev/null 2>&1 && adb version >/dev/null 2>&1; then
|
|
adb "${ADB_FLAGS[@]}" install -r "$APK"
|
|
# ...sinon repli NixOS : l'adb du SDK est un binaire FHS dynamiquement
|
|
# lié, on l'exécute via steam-run (cf. local.properties pour sdk.dir).
|
|
elif command -v steam-run >/dev/null 2>&1; then
|
|
SDK_DIR="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}"
|
|
if [ -z "$SDK_DIR" ] && [ -f local.properties ]; then
|
|
SDK_DIR="$(sed -n 's/^sdk\.dir=//p' local.properties | head -n 1)"
|
|
fi
|
|
if [ -z "$SDK_DIR" ] && [ -d "$HOME/Android/Sdk" ]; then
|
|
SDK_DIR="$HOME/Android/Sdk"
|
|
fi
|
|
if [ -z "$SDK_DIR" ] || [ ! -x "$SDK_DIR/platform-tools/adb" ]; then
|
|
echo "adb introuvable : définissez ANDROID_HOME ou sdk.dir dans local.properties." >&2
|
|
exit 1
|
|
fi
|
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:$HOME/.nix-profile/lib:/run/opengl-driver/lib"
|
|
steam-run "$SDK_DIR/platform-tools/adb" "${ADB_FLAGS[@]}" install -r "$APK"
|
|
else
|
|
echo "adb ne fonctionne pas sur cet OS et steam-run est absent (NixOS)." >&2
|
|
exit 1
|
|
fi
|
|
'''
|
|
|
|
[tasks.test]
|
|
description = "Run all tests (Go + Kotlin)"
|
|
run = '''
|
|
set -euo pipefail
|
|
cd backend && go test ./...
|
|
cd ../mobile-kotlin && ./gradlew :app:testDebugUnitTest -q
|
|
'''
|
|
|
|
[tasks.build]
|
|
description = "Build all artifacts (Go binary + Android APK)"
|
|
run = '''
|
|
set -euo pipefail
|
|
VERSION=$(cat VERSION)
|
|
mkdir -p backend/bin
|
|
cd backend && go build -ldflags "-X main.version=$VERSION" -o bin/kazier-server cmd/server/main.go
|
|
cd ../mobile-kotlin && ./gradlew :app:assembleDebug -q
|
|
'''
|
|
|
|
[tasks.lint]
|
|
description = "Lint all code (staticcheck + Android Lint)"
|
|
run = '''
|
|
set -euo pipefail
|
|
cd backend && staticcheck ./...
|
|
cd ../mobile-kotlin && ./gradlew :app:lint -q
|
|
'''
|
|
|
|
[tasks."build:release"]
|
|
description = "Build signed release APK (assembleRelease)"
|
|
dir = "mobile-kotlin"
|
|
run = '''
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [ ! -f app/signing.properties ] && [ -z "${SIGNING_STORE_FILE:-}" ]; then
|
|
echo "signing.properties absent — copiez app/signing.properties.example et"
|
|
echo "préparez un keystore, ou fournissez SIGNING_STORE_FILE (CI)." >&2
|
|
exit 1
|
|
fi
|
|
./gradlew :app:assembleRelease -q
|
|
echo "APK : app/build/outputs/apk/release/app-release.apk"
|
|
'''
|
|
|
|
[tasks."docker:build"]
|
|
description = "Build the backend Docker image (tagged with VERSION)"
|
|
run = '''
|
|
set -euo pipefail
|
|
VERSION=$(cat VERSION)
|
|
docker build \\
|
|
--build-arg VERSION="$VERSION" \\
|
|
--build-arg BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \\
|
|
-t kazier-server:"$VERSION" \\
|
|
./backend
|
|
echo "Image : kazier-server:$VERSION"
|
|
'''
|
|
|
|
[tasks.release]
|
|
description = "Local release checklist: test, build artifacts, tag, push"
|
|
run = '''
|
|
set -euo pipefail
|
|
VERSION=$(cat VERSION)
|
|
echo ">>> Version : $VERSION (tag cible v$VERSION)"
|
|
mise run test
|
|
mise run build
|
|
mise run docker:build
|
|
echo
|
|
echo "Prêt à tagger ? La CI GitLab construira la release finale à partir du tag."
|
|
echo " git tag v$VERSION && git push origin v$VERSION"
|
|
''' |