Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 5 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,42 +200,11 @@ jobs:
path: android/app/build/reports/tests/
if-no-files-found: ignore

android-build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Free disk space
# The native C++ builds (react-native-audio-api, op-sqlite) exhausted the runner
# disk ("LLVM ERROR: IO failure on output stream: No space left on device").
# Reclaim large preinstalled toolchains we don't use; keep the Android SDK/NDK.
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL || true
sudo docker image prune --all --force || true
df -h

- name: Install dependencies
run: npm ci

- name: Build Android Debug
run: cd android && ./gradlew assembleDebug

- name: Build Android Release
run: cd android && ./gradlew assembleRelease
# NOTE: the Android build is NOT run in CI — it is a LOCAL pre-merge gate instead (the hosted
# runner repeatedly hung for 3+ hours on the native C++ builds and burned hours). Run it locally
# before merging any change that touches native/Android/gradle/deps:
# cd android && ./gradlew assembleDebug assembleRelease
# (see rules.md → On-device testing & verification). Docs-only / JS-only PRs don't need it.
Comment on lines +203 to +207

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Narrow “Android build is NOT run in CI” to the removed assemble job.

The test job still installs the Android NDK and runs :app:testDebugUnitTest at Line [168]. As written, this note may imply that CI performs no Android validation at all.

Proposed wording
-  # NOTE: the Android build is NOT run in CI — it is a LOCAL pre-merge gate instead (the hosted
+  # NOTE: the hosted assembleDebug/assembleRelease Android build job is NOT run in CI; Android
+  # unit tests still run in the `test` job above. The full build is a LOCAL pre-merge gate (the hosted
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# NOTE: the Android build is NOT run in CI — it is a LOCAL pre-merge gate instead (the hosted
# runner repeatedly hung for 3+ hours on the native C++ builds and burned hours). Run it locally
# before merging any change that touches native/Android/gradle/deps:
# cd android && ./gradlew assembleDebug assembleRelease
# (see rules.md → On-device testing & verification). Docs-only / JS-only PRs don't need it.
# NOTE: the hosted assembleDebug/assembleRelease Android build job is NOT run in CI; Android
# unit tests still run in the `test` job above. The full build is a LOCAL pre-merge gate (the hosted
# runner repeatedly hung for 3+ hours on the native C++ builds and burned hours). Run it locally
# before merging any change that touches native/Android/gradle/deps:
# cd android && ./gradlew assembleDebug assembleRelease
# (see rules.md → On-device testing & verification). Docs-only / JS-only PRs don't need it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 203 - 207, Revise the comment near the
removed Android assemble job to state specifically that the Android assemble
build is not run in CI, while acknowledging that the test job still installs the
NDK and runs :app:testDebugUnitTest. Keep the local pre-merge assemble commands
and scope guidance unchanged.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
test -f rules.md
rg -n -F 'cd android && ./gradlew assembleDebug assembleRelease' rules.md
rg -n -i 'On-device testing|docs-only|JS-only|native|Android|Gradle|depend' rules.md

Repository: off-grid-ai/OGAM

Length of output: 154


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf 'Tracked candidate files:\n'
git ls-files | rg '(^|/)rules\.md$|(^|/)ci\.yml$|(^|/)github/workflows/.*\.ya?ml$' || true

printf '\nSearch exact command:\n'
rg -n -F 'cd android && ./gradlew assembleDebug assembleRelease' || true

printf '\nSearch nearby terms:\n'
rg -n -i 'assembleDebug|assembleRelease|On-device testing|on-device testing|docs-only|js-only|JS-only|native|Android|gradle|dependenc' . || true

Repository: off-grid-ai/OGAM

Length of output: 227


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf 'rules.md present in working tree and tracked files:\n'
test -f rules.md && echo "rules.md exists" || echo "rules.md does not exist"
git ls-tree -r HEAD --name-only | rg '(^|/)rules\.md$|(^|/)ci\.ya?ml$|^\.github/workflows/' || true

printf '\nExact command across repository:\n'
rg -n -F 'cd android && ./gradlew assembleDebug assembleRelease' || true

printf '\nAll ./gradlew/assemble references:\n'
rg -n -E '\./gradlew|assembleDebug|assembleRelease|On-device|docs-only|JS-only|js-only|gradle|dependenc' . --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' || true

printf '\ndotgithub workflow relevant sections if present:\n'
if [ -f .github/workflows/ci.yml ]; then
  wc -l .github/workflows/ci.yml
  sed -n '180,220p' .github/workflows/ci.yml
fi

Repository: off-grid-ai/OGAM

Length of output: 427


Remove or fix the stale references.

rules.md is not present, and the referenced cd android && ./gradlew assembleDebug assembleRelease command is not in the repository. Keep the comment only if the exact gate command and exceptions are added to rules.md; otherwise, update it to a real, discoverable pre-merge process.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 203 - 207, Update the Android CI note
near the workflow comments to remove stale references to rules.md and the
unverified Gradle command, or replace them with a real, discoverable pre-merge
process and exact repository-supported gate command. Preserve the stated
exceptions only if they match the documented process.


# NOTE: SonarCloud runs via Automatic Analysis (SonarCloud-side, on the public core project) —
# no CI job. A CI scan would only add coverage import, which Codecov (in the `test` job) already
Expand Down
24 changes: 24 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ PUSHED_JS=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.(ts|tsx|js|jsx)$' || tru
PUSHED_SWIFT=$(printf '%s\n' "$CHANGED_FILES" | grep '\.swift$' | grep -v 'Pods/' | grep -v 'build/' || true)
PUSHED_KOTLIN=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.(kt|kts)$' || true)

# Native BUILD gate — moved OUT of CI (the hosted android-build runner hung for 3+ hours on the
# native C++ builds). Run the full native builds LOCALLY on push when native / gradle / pods / deps
# change. JS-only and docs-only pushes skip these (they stay fast).
PUSHED_ANDROID_NATIVE=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.(kt|kts)$|^android/|^package(-lock)?\.json$' | grep -v '/build/' || true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Include all declared Android gate inputs.

This matcher misses native C++ files and Gradle inputs outside android/ (for example root gradlew, gradle/, or *.gradle). Those changes can bypass the replacement Android gate despite the documented native/Gradle scope.

Proposed fix
-PUSHED_ANDROID_NATIVE=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.(kt|kts)$|^android/|^package(-lock)?\.json$' | grep -v '/build/' || true)
+PUSHED_ANDROID_NATIVE=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.(kt|kts|c|cc|cpp|cxx|h|hpp)$|^android/|^gradle/|^gradlew$|(^|/)gradle\.properties$|\.gradle$|^package(-lock)?\.json$' | grep -v '/build/' || true)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
PUSHED_ANDROID_NATIVE=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.(kt|kts)$|^android/|^package(-lock)?\.json$' | grep -v '/build/' || true)
PUSHED_ANDROID_NATIVE=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.(kt|kts|c|cc|cpp|cxx|h|hpp)$|^android/|^gradle/|^gradlew$|(^|/)gradle\.properties$|\.gradle$|^package(-lock)?\.json$' | grep -v '/build/' || true)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.husky/pre-push at line 46, Update the PUSHED_ANDROID_NATIVE matcher to
include all documented Android gate inputs: native C/C++ source and header
files, root Gradle wrapper files, the gradle/ directory, and Gradle build
scripts, while retaining Kotlin, existing Android, package manifest, and
build-directory exclusions.

PUSHED_IOS_NATIVE=$(printf '%s\n' "$CHANGED_FILES" | grep -E '\.swift$|^ios/|Podfile' | grep -v 'Pods/' | grep -v '/build/' || true)

if [ -n "$PUSHED_JS" ]; then
echo "▶ JS/TS lint (push range)..."
echo "$PUSHED_JS" | tr '\n' '\0' | xargs -0 eslint --max-warnings=999
Expand Down Expand Up @@ -83,6 +89,24 @@ if [ -n "$PUSHED_KOTLIN" ]; then
npm run test:android
fi

if [ -n "$PUSHED_ANDROID_NATIVE" ]; then
echo "▶ Android build (assembleDebug + assembleRelease) — local gate, replaces CI android-build..."
(cd android && ./gradlew assembleDebug assembleRelease)
fi

if [ -n "$PUSHED_IOS_NATIVE" ]; then
echo "▶ iOS build (simulator, no code-signing) — local gate..."
(cd ios && xcodebuild \
-workspace OffgridMobile.xcworkspace \
-scheme OffgridMobile \
-configuration Debug \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath build/prepush-ios \
CODE_SIGNING_ALLOWED=NO \
build)
fi
Comment on lines +92 to +108

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/sh
sed -n '1,115p' .husky/pre-push

Repository: off-grid-ai/OGAM

Length of output: 4068


Make native build failures fail the pre-push hook.

.husky/pre-push does not run with set -e, and each native build runs in a subshell. If ./gradlew assembleDebug assembleRelease or xcodebuild fails, the hook can continue past that checkpoint or return success while the native gate did not block the push. Add explicit failure handling such as set -e at the top of the hook or check/exit on nonzero_status for those build commands.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.husky/pre-push around lines 92 - 108, Ensure the native build gates in
.husky/pre-push propagate failures by enabling fail-fast handling for the hook
or explicitly checking the statuses of the Android Gradle and iOS xcodebuild
subshell commands and exiting nonzero when either fails. Preserve the existing
conditional execution based on PUSHED_ANDROID_NATIVE and PUSHED_IOS_NATIVE.


if [ -n "$PUSHED_JS$PUSHED_SWIFT$PUSHED_KOTLIN" ]; then
echo "▶ Sonar scan..."
npm run sonar
Expand Down
Loading