- Android PWA/WASM launcher with glassmorphism UI - Loads https://admin.dark.side directly on launch - Complete GitLab CI/CD pipeline configuration - Automated builds for Debug, Release, and AAB - Full WASM support with optimized WebView - Material Design 3 theme - Comprehensive documentation Features: - Auto-load target URL on app launch - Glassmorphism components (frosted glass effects) - Full PWA/WASM support - Room database for future extensions - Jetpack Compose UI - CI/CD with artifact storage Built for SilverLABS
264 lines
6.1 KiB
YAML
264 lines
6.1 KiB
YAML
# GitLab CI/CD Pipeline for SilverDROID (Dark Side Admin)
|
|
# Android APK Build & Deployment
|
|
|
|
image: mingc/android-build-box:latest
|
|
|
|
variables:
|
|
ANDROID_COMPILE_SDK: "35"
|
|
ANDROID_BUILD_TOOLS: "34.0.0"
|
|
ANDROID_SDK_TOOLS: "9477386"
|
|
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.caching=true"
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
|
|
stages:
|
|
- prepare
|
|
- test
|
|
- build
|
|
- deploy
|
|
|
|
before_script:
|
|
- export GRADLE_USER_HOME=$(pwd)/.gradle
|
|
- chmod +x ./gradlew
|
|
|
|
# Cache Gradle dependencies
|
|
cache:
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
paths:
|
|
- .gradle/wrapper
|
|
- .gradle/caches
|
|
- build/
|
|
- app/build/
|
|
|
|
# ===========================
|
|
# STAGE: Prepare
|
|
# ===========================
|
|
|
|
prepare:dependencies:
|
|
stage: prepare
|
|
script:
|
|
- echo "Downloading Gradle dependencies..."
|
|
- ./gradlew --version
|
|
- ./gradlew dependencies
|
|
cache:
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
paths:
|
|
- .gradle/
|
|
policy: pull-push
|
|
only:
|
|
- main
|
|
- develop
|
|
- merge_requests
|
|
|
|
# ===========================
|
|
# STAGE: Test
|
|
# ===========================
|
|
|
|
lint:
|
|
stage: test
|
|
script:
|
|
- echo "Running Android Lint..."
|
|
- ./gradlew lint
|
|
artifacts:
|
|
name: "lint-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- app/build/reports/lint-results*.html
|
|
- app/build/reports/lint-results*.xml
|
|
expire_in: 1 week
|
|
when: always
|
|
only:
|
|
- main
|
|
- develop
|
|
- merge_requests
|
|
|
|
unit_tests:
|
|
stage: test
|
|
script:
|
|
- echo "Running unit tests..."
|
|
- ./gradlew test
|
|
artifacts:
|
|
name: "tests-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- app/build/reports/tests/
|
|
reports:
|
|
junit: app/build/test-results/test*UnitTest/**.xml
|
|
expire_in: 1 week
|
|
when: always
|
|
only:
|
|
- main
|
|
- develop
|
|
- merge_requests
|
|
|
|
# ===========================
|
|
# STAGE: Build
|
|
# ===========================
|
|
|
|
build:debug:
|
|
stage: build
|
|
script:
|
|
- echo "Building Debug APK..."
|
|
- ./gradlew assembleDebug
|
|
- echo "APK built successfully!"
|
|
- ls -lh app/build/outputs/apk/debug/
|
|
artifacts:
|
|
name: "silverdroid-debug-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- app/build/outputs/apk/debug/app-debug.apk
|
|
expire_in: 30 days
|
|
only:
|
|
- main
|
|
- develop
|
|
- merge_requests
|
|
- tags
|
|
|
|
build:release:
|
|
stage: build
|
|
script:
|
|
- echo "Building Release APK..."
|
|
- ./gradlew assembleRelease
|
|
- echo "Release APK built successfully!"
|
|
- ls -lh app/build/outputs/apk/release/
|
|
artifacts:
|
|
name: "silverdroid-release-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- app/build/outputs/apk/release/app-release-unsigned.apk
|
|
expire_in: 90 days
|
|
only:
|
|
- main
|
|
- tags
|
|
|
|
build:bundle:
|
|
stage: build
|
|
script:
|
|
- echo "Building Android App Bundle (AAB)..."
|
|
- ./gradlew bundleRelease
|
|
- echo "AAB built successfully!"
|
|
- ls -lh app/build/outputs/bundle/release/
|
|
artifacts:
|
|
name: "silverdroid-bundle-${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- app/build/outputs/bundle/release/app-release.aab
|
|
expire_in: 90 days
|
|
only:
|
|
- main
|
|
- tags
|
|
|
|
# ===========================
|
|
# STAGE: Deploy
|
|
# ===========================
|
|
|
|
deploy:staging:
|
|
stage: deploy
|
|
script:
|
|
- echo "Deploying to staging environment..."
|
|
- echo "APK available at: ${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/download"
|
|
- |
|
|
curl -X POST "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}" \
|
|
--header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" \
|
|
--data "state=success" \
|
|
--data "name=APK Build" \
|
|
--data "target_url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/download"
|
|
dependencies:
|
|
- build:debug
|
|
environment:
|
|
name: staging
|
|
url: https://gitlab.silverlabs.uk/${CI_PROJECT_PATH}/-/jobs/${CI_JOB_ID}/artifacts/download
|
|
only:
|
|
- develop
|
|
|
|
deploy:production:
|
|
stage: deploy
|
|
script:
|
|
- echo "Deploying to production..."
|
|
- echo "Release APK: app/build/outputs/apk/release/app-release-unsigned.apk"
|
|
- echo "Creating release tag..."
|
|
dependencies:
|
|
- build:release
|
|
environment:
|
|
name: production
|
|
url: https://gitlab.silverlabs.uk/${CI_PROJECT_PATH}/-/releases
|
|
only:
|
|
- tags
|
|
when: manual
|
|
|
|
# ===========================
|
|
# Additional Jobs
|
|
# ===========================
|
|
|
|
# Security scan
|
|
security:scan:
|
|
stage: test
|
|
script:
|
|
- echo "Running security scan..."
|
|
- ./gradlew dependencyCheckAnalyze || true
|
|
artifacts:
|
|
paths:
|
|
- build/reports/dependency-check-report.html
|
|
expire_in: 1 week
|
|
when: always
|
|
allow_failure: true
|
|
only:
|
|
- main
|
|
- develop
|
|
|
|
# Generate APK info
|
|
apk:info:
|
|
stage: deploy
|
|
script:
|
|
- echo "Extracting APK information..."
|
|
- |
|
|
APK_SIZE=$(du -h app/build/outputs/apk/debug/app-debug.apk | cut -f1)
|
|
echo "APK Size: $APK_SIZE"
|
|
echo "Commit: ${CI_COMMIT_SHORT_SHA}"
|
|
echo "Branch: ${CI_COMMIT_REF_NAME}"
|
|
echo "Build Time: $(date)"
|
|
echo "---" > apk-info.txt
|
|
echo "SilverDROID - Dark Side Admin" >> apk-info.txt
|
|
echo "Build: ${CI_COMMIT_SHORT_SHA}" >> apk-info.txt
|
|
echo "Size: $APK_SIZE" >> apk-info.txt
|
|
echo "Date: $(date)" >> apk-info.txt
|
|
dependencies:
|
|
- build:debug
|
|
artifacts:
|
|
paths:
|
|
- apk-info.txt
|
|
expire_in: 30 days
|
|
only:
|
|
- main
|
|
- develop
|
|
|
|
# Notification (optional - requires webhook setup)
|
|
notify:success:
|
|
stage: deploy
|
|
script:
|
|
- echo "Build successful! Sending notification..."
|
|
- |
|
|
curl -X POST "https://chat.silverlabs.uk/webhook" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"text\": \"✅ SilverDROID Build Successful\",
|
|
\"commit\": \"${CI_COMMIT_SHORT_SHA}\",
|
|
\"branch\": \"${CI_COMMIT_REF_NAME}\",
|
|
\"pipeline\": \"${CI_PIPELINE_URL}\"
|
|
}" || true
|
|
when: on_success
|
|
allow_failure: true
|
|
only:
|
|
- main
|
|
|
|
notify:failure:
|
|
stage: deploy
|
|
script:
|
|
- echo "Build failed! Sending notification..."
|
|
- |
|
|
curl -X POST "https://chat.silverlabs.uk/webhook" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"text\": \"❌ SilverDROID Build Failed\",
|
|
\"commit\": \"${CI_COMMIT_SHORT_SHA}\",
|
|
\"branch\": \"${CI_COMMIT_REF_NAME}\",
|
|
\"pipeline\": \"${CI_PIPELINE_URL}\"
|
|
}" || true
|
|
when: on_failure
|
|
allow_failure: true
|
|
only:
|
|
- main |