Compare commits

...

6 Commits

Author SHA1 Message Date
arnie b97e6f930b Update labels 2026-06-13 09:19:45 +02:00
arnie a196336f26 Add tests to flake 2026-06-12 21:02:34 +02:00
arnie 21819c4a9b Fix weburl for house conditions 2026-06-12 20:56:23 +02:00
arnie 99323694a3 Remove CI 2026-06-12 20:54:45 +02:00
arnie a3bbac72d6 Add banners
build / build (push) Failing after 8s
2026-06-12 20:45:28 +02:00
arnie 038cb51ba4 Update build process 2026-06-12 20:44:32 +02:00
9 changed files with 71 additions and 52 deletions
-25
View File
@@ -1,25 +0,0 @@
name: build
on:
push:
branches: [main]
tags: ['*']
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
container:
image: docksee/nixos-gitea:${{ vars.NIX_IMAGE_VERSION }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Unit tests
run: nix develop --command gradle --no-daemon :app:test
- name: Build release APKs
run: nix develop --command gradle --no-daemon :app:assembleRelease
- uses: actions/upload-artifact@v3
with:
name: android-webview-kiosk-apk
path: app/build/outputs/apk/*/release/*.apk
+5 -3
View File
@@ -13,8 +13,8 @@ Build toolchain: AGP 9.2.1, Gradle 9 (nixpkgs 26.05), build-tools 36, compileSdk
This is a lab project (`lab` skill conventions apply) EXCEPT: This is a lab project (`lab` skill conventions apply) EXCEPT:
- No container image, no helm chart, no /livez//readyz — artifact is an APK. - No container image, no helm chart, no /livez//readyz — artifact is an APK.
- No `nix build`: gradle needs network for Maven deps. The flake is a dev - No `nix build`: gradle needs network for Maven deps. Builds run via devshell
shell only. All builds run as `nix develop --command gradle ...`. or `nix run` (see Commands below).
- Agents cannot run nix/gradle/adb here — ask the user to run commands - Agents cannot run nix/gradle/adb here — ask the user to run commands
and report output. and report output.
@@ -33,7 +33,9 @@ post-25.11). No file rewriting; `gradle.properties` stays untouched.
- All APKs: `gradle --no-daemon :app:assembleRelease` - All APKs: `gradle --no-daemon :app:assembleRelease`
`app/build/outputs/apk/<flavor>/release/<flavor>-release.apk` `app/build/outputs/apk/<flavor>/release/<flavor>-release.apk`
- Single APK: `gradle --no-daemon :app:assembleWeatherRelease` - Single APK: `gradle --no-daemon :app:assembleWeatherRelease`
- Deploy all: `tv-deploy` — connects, installs all flavor APKs, disconnects - Build + deploy: `nix run` or `tv-deploy` (after manual build)
- Build only: `nix run .#build`
- Deploy only: `nix run .#deploy` or `tv-deploy` (in devshell)
(bump `versionCode` in app/build.gradle.kts first for upgrades) (bump `versionCode` in app/build.gradle.kts first for upgrades)
- Fresh install: `adb connect $TV_IP:5555 && adb uninstall cz.c3c.webviewkiosk.<flavor> && adb install app/build/outputs/apk/<flavor>/release/<flavor>-release.apk` - Fresh install: `adb connect $TV_IP:5555 && adb uninstall cz.c3c.webviewkiosk.<flavor> && adb install app/build/outputs/apk/<flavor>/release/<flavor>-release.apk`
+2 -2
View File
@@ -17,7 +17,7 @@ android {
applicationId = "cz.c3c.webviewkiosk" applicationId = "cz.c3c.webviewkiosk"
minSdk = 26 // Sony KD-65XE9305 final firmware = Android 8.0 minSdk = 26 // Sony KD-65XE9305 final firmware = Android 8.0
targetSdk = 35 targetSdk = 35
versionCode = 1 // bump on every release; adb install -r refuses downgrades versionCode = 3 // bump on every release; adb install -r refuses downgrades
versionName = "0.1.0" versionName = "0.1.0"
} }
@@ -50,7 +50,7 @@ android {
dimension = "webview" dimension = "webview"
applicationIdSuffix = ".$name" applicationIdSuffix = ".$name"
buildConfigField("String", "WEBVIEW_URL", "\"${config["url"]}\"") buildConfigField("String", "WEBVIEW_URL", "\"${config["url"]}\"")
resValue("string", "app_name", "C3C ${config["label"] ?: name}") resValue("string", "app_name", "${config["ui_label"] ?: config["label"] ?: name}")
} }
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+57 -16
View File
@@ -2,10 +2,11 @@
# android-webview-kiosk — Android TV fullscreen WebView kiosk showing a # android-webview-kiosk — Android TV fullscreen WebView kiosk showing a
# hardcoded Grafana dashboard, remote-launched via Sony Bravia IP control. # hardcoded Grafana dashboard, remote-launched via Sony Bravia IP control.
# #
# Deviation from lab Go template: this flake provides a DEV SHELL ONLY. # Deviation from lab Go template: APK is built impurely (Gradle fetches Maven
# Gradle fetches Maven deps from the network, so the APK is built impurely: # deps from the network). No `nix build` output; use nix run instead:
# nix develop --command gradle :app:assembleRelease # nix run — build all APKs then deploy to TV
# There is no `nix build` output and no container/push pipeline. # nix run .#build — build only
# nix run .#deploy — deploy already-built APKs to TV
description = "Android TV fullscreen WebView kiosk for the Grafana house dashboard"; description = "Android TV fullscreen WebView kiosk for the Grafana house dashboard";
inputs = { inputs = {
@@ -19,7 +20,7 @@
nixpkgs, nixpkgs,
flake-utils, flake-utils,
}: }:
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachSystem [ "x86_64-linux" ] (
system: system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
@@ -44,16 +45,64 @@
fonts = with pkgs; [ noto-fonts dejavu_fonts freefont_ttf ]; fonts = with pkgs; [ noto-fonts dejavu_fonts freefont_ttf ];
tvDeploy = pkgs.writeShellScriptBin "tv-deploy" '' gradleEnv = {
set -euo pipefail ANDROID_HOME = sdkRoot;
ANDROID_SDK_ROOT = sdkRoot;
JAVA_HOME = "${pkgs.jdk21}";
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${sdkRoot}/build-tools/${buildToolsVersion}/aapt2";
FONTCONFIG_FILE = pkgs.makeFontsConf { fontDirectories = fonts; };
};
deployScript = ''
trap 'adb disconnect "$TV_IP:5555"' EXIT trap 'adb disconnect "$TV_IP:5555"' EXIT
adb connect "$TV_IP:5555" adb connect "$TV_IP:5555"
for apk in app/build/outputs/apk/*/release/*.apk; do for apk in app/build/outputs/apk/*/release/*.apk; do
adb install -r "$apk" adb install -r "$apk"
done done
''; '';
exportGradleEnv = ''
export ANDROID_HOME="${sdkRoot}"
export ANDROID_SDK_ROOT="${sdkRoot}"
export JAVA_HOME="${pkgs.jdk21}"
export GRADLE_OPTS="${gradleEnv.GRADLE_OPTS}"
export FONTCONFIG_FILE="${gradleEnv.FONTCONFIG_FILE}"
'';
tvDeploy = pkgs.writeShellApplication {
name = "tv-deploy";
runtimeInputs = [ pkgs.android-tools ];
text = deployScript;
};
buildApp = pkgs.writeShellApplication {
name = "build";
runtimeInputs = [ androidSdk pkgs.jdk21 pkgs.gradle_9 ];
text = ''
${exportGradleEnv}
gradle --no-daemon :app:test
gradle --no-daemon :app:assembleRelease
'';
};
buildAndDeploy = pkgs.writeShellApplication {
name = "build-and-deploy";
runtimeInputs = [ androidSdk pkgs.jdk21 pkgs.gradle_9 pkgs.android-tools ];
text = ''
${exportGradleEnv}
gradle --no-daemon :app:test
gradle --no-daemon :app:assembleRelease
${deployScript}
'';
};
in in
{ {
apps = {
default = { type = "app"; program = "${buildAndDeploy}/bin/build-and-deploy"; };
build = { type = "app"; program = "${buildApp}/bin/build"; };
deploy = { type = "app"; program = "${tvDeploy}/bin/tv-deploy"; };
};
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = [ packages = [
androidSdk androidSdk
@@ -64,15 +113,7 @@
tvDeploy tvDeploy
] ++ fonts; ] ++ fonts;
ANDROID_HOME = sdkRoot; inherit (gradleEnv) ANDROID_HOME ANDROID_SDK_ROOT JAVA_HOME GRADLE_OPTS FONTCONFIG_FILE;
ANDROID_SDK_ROOT = sdkRoot;
JAVA_HOME = "${pkgs.jdk21}";
# NixOS gotcha: AGP downloads a dynamically-linked aapt2 from Maven
# that can't run on NixOS. Set android.aapt2FromMavenOverride via
# GRADLE_OPTS so AGP uses the SDK's aapt2 instead. Works since
# nixpkgs PR #449037 (merged post-25.11, present in 26.05+).
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${sdkRoot}/build-tools/${buildToolsVersion}/aapt2";
FONTCONFIG_FILE = pkgs.makeFontsConf { fontDirectories = fonts; };
}; };
} }
+4 -3
View File
@@ -1,7 +1,8 @@
weather: weather:
url: https://grafana.c3c.cz/public-dashboards/381fe3e71e164eb99dd0b10e246a36e2 url: https://grafana.c3c.cz/public-dashboards/381fe3e71e164eb99dd0b10e246a36e2
label: Weather ui_label: Počasí
house_condition: house_condition:
url: http://grafana.c3c.cz/public-dashboards/7d94ddc4493741debf49d0a301e1a757 url: https://grafana.c3c.cz/public-dashboards/7d94ddc4493741debf49d0a301e1a757
label: House Condition ui_label: Stav domu