Skip to content
Open
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
72 changes: 72 additions & 0 deletions .github/workflows/build-tc-helper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Compiles the tc_helper Rust native library from source (instead of relying on
# the pre-built .so committed under android/app/src/main/jniLibs/) and then
# builds the production APK against the freshly-compiled library.
#
# This is the "proper" fix for stale committed binaries: the .so is regenerated
# from rust/ on every run, so it can never drift from the Rust source. Once this
# is green, the committed jniLibs/*.so can be git-ignored and purged from history.
#
# NOTE: This workflow has not yet been run on CI — action versions, the NDK
# version, and the cargo-ndk invocation are transcribed from a verified LOCAL
# build (macOS) and may need small adjustments on the first CI run.
#
# Both arm64-v8a and armeabi-v7a are built. taskchampion is configured with only
# the server-sync backend (see rust/Cargo.toml), so there's no aws-lc-sys — hence
# no cmake/ninja/bindgen/libclang toolchain needed; ring builds with just the
# Rust + NDK toolchain.
name: Build tc_helper (compile from source)

on:
workflow_dispatch:
pull_request:
branches: [main, reports]
paths:
- "rust/**"
- "android/**"
- ".github/workflows/build-tc-helper.yml"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"

# Android SDK + NDK. cargo-ndk reads ANDROID_NDK_HOME to find the toolchain.
- uses: android-actions/setup-android@v3
- name: Install NDK
run: |
sdkmanager "ndk;26.1.10909125"
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/26.1.10909125" >> "$GITHUB_ENV"

- name: Install Rust + Android targets + cargo-ndk
run: |
rustup toolchain install stable --profile minimal
rustup target add aarch64-linux-android armv7-linux-androideabi
cargo install cargo-ndk --version ^4

- name: Compile tc_helper (arm64-v8a + armeabi-v7a) from source
working-directory: rust
run: |
cargo ndk -t arm64-v8a -t armeabi-v7a \
-o ../android/app/src/main/jniLibs \
build --release

- name: Show freshly-built libs
run: ls -lhR android/app/src/main/jniLibs/

- uses: subosito/flutter-action@v2
with:
flutter-version: "3.44.5"

- run: flutter pub get
- run: flutter build apk --release --flavor production

- uses: actions/upload-artifact@v4
with:
name: production-apk-from-source
path: build/app/outputs/flutter-apk/app-production-release.apk
Loading
Loading