Add HTTP API server, Android app, and CI build/publish pipeline
build / build (push) Failing after 14s
build / build (push) Failing after 14s
- docker-compose.yml + tooling-container/src/server.py: serve
preprocess/OCR/extract over an async job API (POST /jobs, GET
/jobs/{id}) instead of manual host-script runs per receipt
- android/: Kotlin/Compose app - capture a receipt photo, poll job
progress, review/edit extracted fields, save locally (Room), export
to CSV/ODS
- .gitea/workflows/build.yml: build the debug APK and publish it to
dl.ladkau.de on push
- build-image.sh: also pull ollama/ollama so all pipeline images are
ready after one script
- add project logo (also used for the app's launcher icon/splash)
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
name: build
|
||||
|
||||
# Builds the Android app (android/) debug APK on every push/PR, plus
|
||||
# on-demand via the Gitea "Run workflow" button. Runs inside a public,
|
||||
# prebuilt Android CI image (JDK + Android SDK/cmdline-tools bundled -
|
||||
# fuelish's app has no native/NDK code, so it doesn't need a custom
|
||||
# builder image the way a project with native components would).
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Runner defaults `run:` steps to `sh`, which doesn't understand
|
||||
# `set -o pipefail` used below - force bash explicitly.
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
# Must match a label your act_runner is registered with.
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container:
|
||||
# JDK + Android SDK cmdline-tools, no platform/build-tools installed -
|
||||
# the "Install SDK components" step below fetches exactly what
|
||||
# compileSdk in android/app/build.gradle.kts needs. Much smaller than
|
||||
# kitchen-sink alternatives (~0.7GB vs. several GB), which matters
|
||||
# since every job pulls it fresh.
|
||||
image: thyrlian/android-sdk:10.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# APK naming below uses `git rev-parse --short HEAD` - harmless
|
||||
# with the default shallow clone, but fetch-depth: 0 keeps this
|
||||
# consistent if that ever switches to `git describe --tags`.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Preflight
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v java >/dev/null 2>&1 || { echo "PREFLIGHT FAIL: java not in PATH" >&2; exit 1; }
|
||||
[ -n "${ANDROID_HOME:-}" ] || { echo "PREFLIGHT FAIL: ANDROID_HOME not set" >&2; exit 1; }
|
||||
[ -x android/gradlew ] || { echo "PREFLIGHT FAIL: android/gradlew missing or not executable" >&2; exit 1; }
|
||||
|
||||
- name: Install SDK components
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# python3-pil: android/scripts/gen_app_icons.py's Pillow dependency
|
||||
# (see android/app/build.gradle.kts's generateAppIcons preBuild task)
|
||||
# - not bundled in this image.
|
||||
apt-get update -qq
|
||||
apt-get install -y --no-install-recommends python3-pil
|
||||
yes | sdkmanager --licenses >/dev/null 2>&1 || true
|
||||
# Keep in sync with android/app/build.gradle.kts's compileSdk.
|
||||
sdkmanager "platforms;android-36" "build-tools;36.0.0"
|
||||
|
||||
- name: Build
|
||||
working-directory: android
|
||||
run: ./gradlew :app:assembleDebug --console=plain
|
||||
|
||||
- name: Package
|
||||
# Renames the debug APK with the commit it was built from, so
|
||||
# multiple builds in dist/ (and on dl.ladkau.de) don't collide.
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p dist
|
||||
sha="$(git rev-parse --short HEAD)"
|
||||
cp android/app/build/outputs/apk/debug/app-debug.apk "dist/fuelish-$sha.apk"
|
||||
|
||||
- name: Upload build artifact
|
||||
# v4 uses the newer @actions/artifact backend, which this Gitea
|
||||
# instance's artifact storage doesn't support (GHESNotSupportedError) — v3 works.
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fuelish-android
|
||||
path: dist/fuelish-*.apk
|
||||
|
||||
- name: Publish to dl.ladkau.de
|
||||
# Uploads the APK over SFTP instead of using actions/upload-artifact
|
||||
# (whose zip wrapping can't be disabled). Only runs on push so PR
|
||||
# builds don't publish.
|
||||
if: gitea.event_name == 'push'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APK="$(ls dist/fuelish-*.apk)"
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DL_SFTP_KEY }}" > ~/.ssh/dl_sftp_key
|
||||
chmod 600 ~/.ssh/dl_sftp_key
|
||||
sftp -i ~/.ssh/dl_sftp_key -P 2223 \
|
||||
-o StrictHostKeyChecking=accept-new \
|
||||
uploader@dl.ladkau.de <<EOF
|
||||
-mkdir files/fuelish
|
||||
put $APK files/fuelish/$(basename "$APK")
|
||||
EOF
|
||||
Reference in New Issue
Block a user