From 83d6f4503ab7848dfa5b9e4933bb8eb5281f7451 Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 16:14:36 +0700 Subject: [PATCH 1/9] feat: add Android test runs to CI workflow --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 09b53cf..a04dbf5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,8 +17,8 @@ jobs: strategy: fail-fast: false matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.platform }} + platform: [ubuntu-latest, macos-latest, windows-latest, android] + runs-on: ${{ matrix.platform == 'android' && 'ubuntu-latest' || matrix.platform }} steps: - name: Set git to use LF @@ -37,6 +37,7 @@ jobs: choco install openssl -y - name: Setup environment + if: ${{ matrix.platform != 'android' }} shell: bash run: | mkdir -p ~/.ssh @@ -45,10 +46,30 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 + if: ${{ matrix.platform != 'android' }} with: channel: stable - - run: | - flutter test + + - name: Run tests on desktop platforms + if: ${{ matrix.platform != 'android' }} + run: | + flutter test + + - name: Run tests on Android + if: ${{ matrix.platform == 'android' }} + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 30 + arch: x86_64 + profile: Nexus 6 + ram-size: 2048M + disk-size: 4096M + script: | + mkdir -p ~/.ssh + ssh-keyscan github.com >> ~/.ssh/known_hosts + + flutter pub get + flutter test publish: needs: test From 8e4cb40de46646cce648eb1737b4ad171d9008c4 Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 16:17:10 +0700 Subject: [PATCH 2/9] chore: update AGENTS.md for Flutter integration and coding conventions --- AGENTS.md | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0d66c6a..8ee7409 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,28 +23,28 @@ Provide idiomatic, null-safe Dart bindings for **libgit2** that feel like native ```bash # Install dependencies -dart pub get - -# Generate FFI bindings (requires clang) -dart run ffigen +flutter pub get # Format, analyze, and test dart format . --set-exit-if-changed -dart analyze -dart test +flutter analyze +flutter test ``` -if you need to install flutter - use script `scripts/install_flutter.sh` +If you need to install Flutter, use script `scripts/install_flutter.sh`. + +**Note**: FFI bindings are provided by the `git2dart_binaries` package and do not need to be regenerated in this repository. -All targets **must** pass on Linux, macOS & Windows using Dart 3.7+ and Flutter stable. +All targets **must** pass on Linux, macOS, Windows, and Android using Dart 3.7.2+ and Flutter stable (3.29.3+). ## 5. Coding Conventions -* Follow *Effective Dart* for style and naming. +* Follow *Effective Dart* for style and naming. * Always run `dart format .` before committing. -* `dart analyze` must report **zero** warnings. +* `flutter analyze` must report **zero** warnings. * Document public symbols with `///` comments. * Throw specific `GitError` subclasses. Avoid returning `null` unless explicitly required. +* **All code, comments, commit messages, and git artifacts must be in English.** ## 6. Testing Policy @@ -62,7 +62,7 @@ All targets **must** pass on Linux, macOS & Windows using Dart 3.7+ and Flutter 2. Update `CHANGELOG.md`. 3. Tag the commit `vx.y.z`. 4. Ensure `dart pub publish --dry-run` succeeds locally and in CI. -5. Use `gh release create` to attach binaries from `tool/build_artefacts.dart`. +5. Create GitHub release with `gh release create vx.y.z` (binaries are handled by CI workflow). ## 8. Common Pitfalls @@ -70,10 +70,16 @@ All targets **must** pass on Linux, macOS & Windows using Dart 3.7+ and Flutter `dart run build_runner build --delete-conflicting-outputs` * Do not vendor full libgit2 source; use submodules or binary archives. * On Windows, ensure `libgit2.dll` is copied to `bin/` for tests to pass. +* All code, documentation, commit messages, branch names, and git artifacts must be in English. ## 9. Agent Checklist (Each Commit) -* +* [ ] Code formatted with `dart format .` +* [ ] `flutter analyze` reports zero warnings +* [ ] All tests pass (`flutter test`) +* [ ] Public API changes include documentation +* [ ] Commit message follows Conventional Commits format +* [ ] All code, comments, and commit messages are in English ## 10. Architecture @@ -85,7 +91,7 @@ Companion package with: * `ffigen` config * Generated Dart headers and auto-generated FFI code for the **libgit2** C API -Separating heavy artefacts ensures versioned, reproducible builds while letting the high-level API evolve. ensures versioned, reproducible builds while letting the high-level API evolve. +Separating heavy artefacts ensures versioned, reproducible builds while letting the high-level API evolve. ### 10.2 `lib/src/bindings` @@ -93,7 +99,7 @@ Separating heavy artefacts ensures versioned, reproducible builds while letting * Defines the Dart-level interface to C functions and structures * Handles all interaction with native memory: allocations, pointer math, conversions * All raw C calls and memory operations happen here -* No raw `Pointer` escapes; must be converted to safe Dart typesContains **bindings** to the auto-generated FFI code from `git2dart_binaries` +* No raw `Pointer` escapes; must be converted to safe Dart types ### 10.3 `lib/src` @@ -102,7 +108,21 @@ Separating heavy artefacts ensures versioned, reproducible builds while letting * Hides FFI details from end users * Contains helpers/mixins not part of public API -## 11. Contact Points +## 11. Language Requirements + +**All artifacts in code and git must be in English:** + +* Source code (variable names, function names, class names) +* Comments and documentation +* Commit messages +* Branch names +* Pull request titles and descriptions +* Issue titles and descriptions +* Code review comments + +This ensures consistency, maintainability, and accessibility for the international developer community. + +## 12. Contact Points * Open issues or PRs on GitHub * Prefix commits with Conventional Commit types (`feat:`, `fix:`, etc.) From 291935fbf03099cdeba7df75edb18c9a740dcea3 Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 16:24:15 +0700 Subject: [PATCH 3/9] fix: install Flutter in Android emulator script The android-emulator-runner runs scripts in an isolated environment where Flutter may not be available. Add Flutter installation check and setup if needed. --- .github/workflows/publish.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a04dbf5..afee845 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,7 +46,6 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 - if: ${{ matrix.platform != 'android' }} with: channel: stable @@ -68,6 +67,14 @@ jobs: mkdir -p ~/.ssh ssh-keyscan github.com >> ~/.ssh/known_hosts + # Install Flutter if not available + if ! command -v flutter &> /dev/null; then + echo "Installing Flutter..." + git clone https://github.com/flutter/flutter.git -b stable --depth 1 $HOME/flutter + export PATH="$HOME/flutter/bin:$PATH" + flutter doctor + fi + flutter pub get flutter test From 34cd5a1fa74e215d95ad911042330e2cbc58026e Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 16:41:28 +0700 Subject: [PATCH 4/9] fix: improve Flutter setup for Android emulator tests - Save PATH to environment variables before emulator runner - Pass PATH through env to android-emulator-runner - Remove flutter doctor that could fail with exit code 2 - Add set -e for immediate error handling - Add Flutter version verification before tests --- .github/workflows/publish.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index afee845..2b55d0e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -54,9 +54,18 @@ jobs: run: | flutter test + - name: Setup Flutter path for Android + if: ${{ matrix.platform == 'android' }} + id: flutter-path + run: | + echo "FLUTTER_PATH=$(which flutter || echo '')" >> $GITHUB_ENV + echo "PATH=$PATH" >> $GITHUB_ENV + - name: Run tests on Android if: ${{ matrix.platform == 'android' }} uses: reactivecircus/android-emulator-runner@v2 + env: + PATH: ${{ env.PATH }} with: api-level: 30 arch: x86_64 @@ -64,17 +73,21 @@ jobs: ram-size: 2048M disk-size: 4096M script: | + set -e + mkdir -p ~/.ssh ssh-keyscan github.com >> ~/.ssh/known_hosts - # Install Flutter if not available + # Install Flutter if not available in PATH if ! command -v flutter &> /dev/null; then - echo "Installing Flutter..." + echo "Flutter not found in PATH, installing..." git clone https://github.com/flutter/flutter.git -b stable --depth 1 $HOME/flutter export PATH="$HOME/flutter/bin:$PATH" - flutter doctor fi + # Verify Flutter is available + flutter --version + flutter pub get flutter test From 75d7bd41f955b11ed3c94246cd8a53875c5822fb Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 17:10:53 +0700 Subject: [PATCH 5/9] refactor: streamline Flutter installation in CI workflow - Remove conditional check for Flutter installation - Ensure Flutter is always cloned and added to PATH - Simplify setup process for running tests --- .github/workflows/publish.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2b55d0e..e6281a1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -73,20 +73,13 @@ jobs: ram-size: 2048M disk-size: 4096M script: | - set -e mkdir -p ~/.ssh ssh-keyscan github.com >> ~/.ssh/known_hosts # Install Flutter if not available in PATH - if ! command -v flutter &> /dev/null; then - echo "Flutter not found in PATH, installing..." - git clone https://github.com/flutter/flutter.git -b stable --depth 1 $HOME/flutter - export PATH="$HOME/flutter/bin:$PATH" - fi - - # Verify Flutter is available - flutter --version + git clone https://github.com/flutter/flutter.git -b stable --depth 1 $HOME/flutter + export PATH="$HOME/flutter/bin:$PATH" flutter pub get flutter test From 8cb08a909959d2686cce97d567150bd8a15c9765 Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 19:31:43 +0700 Subject: [PATCH 6/9] feat: add arm64-v8a architecture tests for Android Add arm64-v8a to Android test matrix alongside x86_64 to test both supported architectures. Use matrix include syntax to define separate Android configurations for each architecture. --- .github/workflows/publish.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e6281a1..01253e1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,14 @@ jobs: strategy: fail-fast: false matrix: - platform: [ubuntu-latest, macos-latest, windows-latest, android] + include: + - platform: ubuntu-latest + - platform: macos-latest + - platform: windows-latest + - platform: android + arch: x86_64 + - platform: android + arch: arm64-v8a runs-on: ${{ matrix.platform == 'android' && 'ubuntu-latest' || matrix.platform }} steps: @@ -68,7 +75,7 @@ jobs: PATH: ${{ env.PATH }} with: api-level: 30 - arch: x86_64 + arch: ${{ matrix.arch }} profile: Nexus 6 ram-size: 2048M disk-size: 4096M From 6a0bbc0a5163ff0800a4e9925ceb72a314900e8e Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 19:50:36 +0700 Subject: [PATCH 7/9] fix: increase emulator boot timeout for arm64-v8a architecture arm64-v8a emulator requires more time to boot than x86_64. Increase timeout to 600 seconds for arm64-v8a while keeping default 300 seconds for x86_64. --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 01253e1..d63d0d3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -79,6 +79,7 @@ jobs: profile: Nexus 6 ram-size: 2048M disk-size: 4096M + emulator-boot-timeout: ${{ matrix.arch == 'arm64-v8a' && 600 || 300 }} script: | mkdir -p ~/.ssh From 7e93436ffaece976459ae302d8ea84a1ac4f8dc8 Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 20:29:01 +0700 Subject: [PATCH 8/9] fix: increase timeout and RAM for arm64-v8a emulator Increase emulator-boot-timeout to 900 seconds (15 minutes) and RAM to 3072M for arm64-v8a architecture, as it requires more resources and time to boot than x86_64. --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d63d0d3..daee9ac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -77,9 +77,9 @@ jobs: api-level: 30 arch: ${{ matrix.arch }} profile: Nexus 6 - ram-size: 2048M + ram-size: ${{ matrix.arch == 'arm64-v8a' && '3072M' || '2048M' }} disk-size: 4096M - emulator-boot-timeout: ${{ matrix.arch == 'arm64-v8a' && 600 || 300 }} + emulator-boot-timeout: ${{ matrix.arch == 'arm64-v8a' && 900 || 300 }} script: | mkdir -p ~/.ssh From 0f45a53158f19365771d2558684f3a6448d195f5 Mon Sep 17 00:00:00 2001 From: Viktor Borisov <4207463+vik-borisov@users.noreply.github.com> Date: Thu, 1 Jan 2026 20:48:45 +0700 Subject: [PATCH 9/9] fix: remove arm64-v8a emulator tests from CI arm64-v8a emulation on x86_64 host in GitHub Actions is too slow and unreliable, causing timeout issues. Keep only x86_64 emulator tests which are stable and sufficient to verify Android platform compatibility. The project still supports arm64-v8a architecture for end users, but CI testing on x86_64 emulator is sufficient to validate Android platform functionality. --- .github/workflows/publish.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index daee9ac..b442cd6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,8 +23,6 @@ jobs: - platform: windows-latest - platform: android arch: x86_64 - - platform: android - arch: arm64-v8a runs-on: ${{ matrix.platform == 'android' && 'ubuntu-latest' || matrix.platform }} steps: @@ -75,11 +73,10 @@ jobs: PATH: ${{ env.PATH }} with: api-level: 30 - arch: ${{ matrix.arch }} + arch: x86_64 profile: Nexus 6 - ram-size: ${{ matrix.arch == 'arm64-v8a' && '3072M' || '2048M' }} + ram-size: 2048M disk-size: 4096M - emulator-boot-timeout: ${{ matrix.arch == 'arm64-v8a' && 900 || 300 }} script: | mkdir -p ~/.ssh