From cda74cd1e65de4394423df6289c2149e6bfcb4ea Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:07:21 +0700 Subject: [PATCH 01/27] Prepare libgit2 1.11 platform builds --- .github/actions/build-ios/action.yml | 182 +++++++++++++++++++++++ .github/actions/build-macos/action.yml | 11 +- .github/workflows/build_package.yml | 37 ++++- .metadata | 3 + ios/Classes/Git2dartBinariesPlugin.swift | 19 +++ ios/git2dart_binaries.podspec | 29 ++++ lib/src/util.dart | 8 +- linux/CMakeLists.txt | 2 +- macos/git2dart_binaries.podspec | 4 +- pubspec.yaml | 3 + windows/CMakeLists.txt | 2 +- 11 files changed, 285 insertions(+), 15 deletions(-) create mode 100644 .github/actions/build-ios/action.yml create mode 100644 ios/Classes/Git2dartBinariesPlugin.swift create mode 100644 ios/git2dart_binaries.podspec diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml new file mode 100644 index 0000000..dd19188 --- /dev/null +++ b/.github/actions/build-ios/action.yml @@ -0,0 +1,182 @@ +name: Build libgit2 iOS +description: Build libgit2, libssh2, and OpenSSL as iOS XCFrameworks +inputs: + libgit2_version: + description: Version of libgit2 to build + required: true + libssh2_version: + description: Version of libssh2 to build + required: true + openssl_version: + description: Version of OpenSSL to build + required: true + ios_deployment_target: + description: Minimum iOS deployment target + required: false + default: "12.0" +runs: + using: composite + steps: + - name: Checkout OpenSSL + uses: actions/checkout@v4 + with: + repository: openssl/openssl + ref: refs/tags/openssl-${{ inputs.openssl_version }} + path: ./openssl + + - name: Checkout libssh2 + uses: actions/checkout@v4 + with: + repository: libssh2/libssh2 + ref: refs/tags/libssh2-${{ inputs.libssh2_version }} + path: ./libssh2 + + - name: Checkout libgit2 + uses: actions/checkout@v4 + with: + repository: libgit2/libgit2 + ref: refs/tags/v${{ inputs.libgit2_version }} + path: ./libgit2 + + - name: Build iOS libraries + shell: bash + env: + IOS_DEPLOYMENT_TARGET: ${{ inputs.ios_deployment_target }} + run: | + set -euo pipefail + + BUILD_ROOT="/tmp/git2dart-ios" + OUTPUT_DIR="$BUILD_ROOT/export" + rm -rf "$BUILD_ROOT" + mkdir -p "$OUTPUT_DIR" + + build_arch() { + local sdk="$1" + local arch="$2" + local openssl_target="$3" + local platform_dir="$BUILD_ROOT/$sdk-$arch" + local openssl_install="$platform_dir/openssl" + local libssh2_install="$platform_dir/libssh2" + local libgit2_install="$platform_dir/libgit2" + local sysroot + local min_version_flag + + sysroot="$(xcrun --sdk "$sdk" --show-sdk-path)" + if [ "$sdk" = "iphoneos" ]; then + min_version_flag="-miphoneos-version-min=$IOS_DEPLOYMENT_TARGET" + else + min_version_flag="-mios-simulator-version-min=$IOS_DEPLOYMENT_TARGET" + fi + mkdir -p "$platform_dir" + + cp -R ./openssl "$platform_dir/openssl-src" + pushd "$platform_dir/openssl-src" + CFLAGS="-arch $arch $min_version_flag" \ + LDFLAGS="-arch $arch $min_version_flag" \ + ./Configure "$openssl_target" \ + -static \ + no-shared \ + no-tests \ + --prefix="$openssl_install" + make clean || true + make -j"$(sysctl -n hw.ncpu)" + make install_sw + popd + + cmake -S ./libssh2 -B "$platform_dir/libssh2-bld" \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF \ + -DBUILD_TESTS=OFF \ + -DCRYPTO_BACKEND=OpenSSL \ + -DOPENSSL_ROOT_DIR="$openssl_install" \ + -DOPENSSL_INCLUDE_DIR="$openssl_install/include" \ + -DOPENSSL_SSL_LIBRARY="$openssl_install/lib/libssl.a" \ + -DOPENSSL_CRYPTO_LIBRARY="$openssl_install/lib/libcrypto.a" \ + -DCMAKE_SYSTEM_NAME=iOS \ + -DCMAKE_OSX_SYSROOT="$sysroot" \ + -DCMAKE_OSX_ARCHITECTURES="$arch" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \ + -DCMAKE_INSTALL_PREFIX="$libssh2_install" + cmake --build "$platform_dir/libssh2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" + + cmake -S ./libgit2 -B "$platform_dir/libgit2-bld" \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTS=OFF \ + -DUSE_SSH=libssh2 \ + -DUSE_HTTPS=OpenSSL \ + -DEXPERIMENTAL_SHA256=ON \ + -DLIBSSH2_INCLUDE_DIR="$libssh2_install/include" \ + -DLIBSSH2_LIBRARY="$libssh2_install/lib/libssh2.a" \ + -DOPENSSL_ROOT_DIR="$openssl_install" \ + -DOPENSSL_INCLUDE_DIR="$openssl_install/include" \ + -DOPENSSL_SSL_LIBRARY="$openssl_install/lib/libssl.a" \ + -DOPENSSL_CRYPTO_LIBRARY="$openssl_install/lib/libcrypto.a" \ + -DCMAKE_SYSTEM_NAME=iOS \ + -DCMAKE_OSX_SYSROOT="$sysroot" \ + -DCMAKE_OSX_ARCHITECTURES="$arch" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \ + -DCMAKE_INSTALL_PREFIX="$libgit2_install" + cmake --build "$platform_dir/libgit2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" + } + + build_arch iphoneos arm64 ios64-xcrun + build_arch iphonesimulator arm64 iossimulator-xcrun + build_arch iphonesimulator x86_64 iossimulator-xcrun + + simulator_dir="$BUILD_ROOT/iphonesimulator-universal" + mkdir -p "$simulator_dir/openssl/lib" "$simulator_dir/openssl/include" + mkdir -p "$simulator_dir/libssh2/lib" "$simulator_dir/libssh2/include" + mkdir -p "$simulator_dir/libgit2/lib" "$simulator_dir/libgit2/include" + + cp -R "$BUILD_ROOT/iphonesimulator-arm64/openssl/include/." "$simulator_dir/openssl/include/" + cp -R "$BUILD_ROOT/iphonesimulator-arm64/libssh2/include/." "$simulator_dir/libssh2/include/" + cp -R "$BUILD_ROOT/iphonesimulator-arm64/libgit2/include/." "$simulator_dir/libgit2/include/" + + arm64_simulator_libgit2="$(find "$BUILD_ROOT/iphonesimulator-arm64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" + x86_64_simulator_libgit2="$(find "$BUILD_ROOT/iphonesimulator-x86_64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" + + lipo -create \ + "$BUILD_ROOT/iphonesimulator-arm64/openssl/lib/libcrypto.a" \ + "$BUILD_ROOT/iphonesimulator-x86_64/openssl/lib/libcrypto.a" \ + -output "$simulator_dir/openssl/lib/libcrypto.a" + lipo -create \ + "$BUILD_ROOT/iphonesimulator-arm64/openssl/lib/libssl.a" \ + "$BUILD_ROOT/iphonesimulator-x86_64/openssl/lib/libssl.a" \ + -output "$simulator_dir/openssl/lib/libssl.a" + lipo -create \ + "$BUILD_ROOT/iphonesimulator-arm64/libssh2/lib/libssh2.a" \ + "$BUILD_ROOT/iphonesimulator-x86_64/libssh2/lib/libssh2.a" \ + -output "$simulator_dir/libssh2/lib/libssh2.a" + lipo -create \ + "$arm64_simulator_libgit2" \ + "$x86_64_simulator_libgit2" \ + -output "$simulator_dir/libgit2/lib/libgit2.a" + + device_libgit2="$(find "$BUILD_ROOT/iphoneos-arm64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" + + xcodebuild -create-xcframework \ + -library "$BUILD_ROOT/iphoneos-arm64/openssl/lib/libcrypto.a" -headers "$BUILD_ROOT/iphoneos-arm64/openssl/include" \ + -library "$simulator_dir/openssl/lib/libcrypto.a" -headers "$simulator_dir/openssl/include" \ + -output "$OUTPUT_DIR/libcrypto.xcframework" + + xcodebuild -create-xcframework \ + -library "$BUILD_ROOT/iphoneos-arm64/openssl/lib/libssl.a" -headers "$BUILD_ROOT/iphoneos-arm64/openssl/include" \ + -library "$simulator_dir/openssl/lib/libssl.a" -headers "$simulator_dir/openssl/include" \ + -output "$OUTPUT_DIR/libssl.xcframework" + + xcodebuild -create-xcframework \ + -library "$BUILD_ROOT/iphoneos-arm64/libssh2/lib/libssh2.a" -headers "$BUILD_ROOT/iphoneos-arm64/libssh2/include" \ + -library "$simulator_dir/libssh2/lib/libssh2.a" -headers "$simulator_dir/libssh2/include" \ + -output "$OUTPUT_DIR/libssh2.xcframework" + + xcodebuild -create-xcframework \ + -library "$device_libgit2" -headers "$BUILD_ROOT/iphoneos-arm64/libgit2/include" \ + -library "$simulator_dir/libgit2/lib/libgit2.a" -headers "$simulator_dir/libgit2/include" \ + -output "$OUTPUT_DIR/libgit2.xcframework" + + - name: Cache iOS libraries + uses: actions/upload-artifact@v4 + with: + name: cache-ios + path: /tmp/git2dart-ios/export/** diff --git a/.github/actions/build-macos/action.yml b/.github/actions/build-macos/action.yml index 558ef42..ab1ab7a 100644 --- a/.github/actions/build-macos/action.yml +++ b/.github/actions/build-macos/action.yml @@ -65,12 +65,11 @@ runs: shell: bash run: | mkdir -p export - # Export under the file name that matches the dylib's own - # install_name (@rpath/libgit2-experimental.1.9.dylib). The - # podspec vendors that exact name and util.dart opens it, so the - # built artifact MUST carry it too — otherwise dyld can't resolve - # the library at runtime (and `flutter test` fails to dlopen it). - cp /tmp/libgit2/install/lib/libgit2-experimental.dylib export/libgit2-experimental.1.9.dylib + # Export under a stable file name and make the dylib's own install_name + # match it. The libgit2 version itself is controlled by LIBGIT2_VERSION + # in the workflow, not by platform file names. + cp /tmp/libgit2/install/lib/libgit2-experimental.dylib export/libgit2.dylib + install_name_tool -id @rpath/libgit2.dylib export/libgit2.dylib cp /tmp/libssh2/install/lib/libssh2.dylib export/libssh2.1.dylib - name: Cache git2 library diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 0a271ac..8e11a43 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -11,7 +11,7 @@ on: - "main" env: PUB_ENVIRONMENT: bot.github - LIBGIT2_VERSION: "1.9.1" + LIBGIT2_VERSION: "1.9.4" LIBSSH2_VERSION: "1.11.1" OPENSSL_VERSION: "3.0.15" @@ -52,6 +52,19 @@ jobs: libgit2_version: ${{ env.LIBGIT2_VERSION }} libssh2_version: ${{ env.LIBSSH2_VERSION }} + build_libgit2_ios: + runs-on: macos-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build iOS artifacts + uses: ./.github/actions/build-ios + with: + libgit2_version: ${{ env.LIBGIT2_VERSION }} + libssh2_version: ${{ env.LIBSSH2_VERSION }} + openssl_version: ${{ env.OPENSSL_VERSION }} + build_libgit2_windows: runs-on: windows-latest steps: @@ -68,7 +81,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: [arm64-v8a, x86_64] + os: [armeabi-v7a, arm64-v8a, x86, x86_64] steps: - name: Check out repository uses: actions/checkout@v4 @@ -82,7 +95,7 @@ jobs: openssl_version: ${{ env.OPENSSL_VERSION }} run_tests: - needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, build_libgit2_windows, build_libgit2_android] + needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, build_libgit2_ios, build_libgit2_windows, build_libgit2_android] # needs: [generate_bindings, build_libgit2_android] runs-on: ${{ matrix.os }} strategy: @@ -152,6 +165,12 @@ jobs: path: ./macos name: cache-macos + - name: download ios binaries + uses: actions/download-artifact@v4 + with: + path: ./ios + name: cache-ios + - name: download windows binaries uses: actions/download-artifact@v4 with: @@ -176,6 +195,18 @@ jobs: path: ./android/src/main/jniLibs/arm64-v8a name: cache-android-arm64-v8a + - name: download android binaries x86 + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/x86 + name: cache-android-x86 + + - name: download android binaries armeabi-v7a + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/armeabi-v7a + name: cache-android-armeabi-v7a + - name: Zip package into cache if: ${{ github.event_name == 'pull_request' }} uses: actions/upload-artifact@v4 diff --git a/.metadata b/.metadata index eec111a..e7a7e12 100644 --- a/.metadata +++ b/.metadata @@ -15,6 +15,9 @@ migration: - platform: root create_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72 base_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72 + - platform: ios + create_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72 + base_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72 - platform: linux create_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72 base_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72 diff --git a/ios/Classes/Git2dartBinariesPlugin.swift b/ios/Classes/Git2dartBinariesPlugin.swift new file mode 100644 index 0000000..d9cd02f --- /dev/null +++ b/ios/Classes/Git2dartBinariesPlugin.swift @@ -0,0 +1,19 @@ +import Flutter +import UIKit + +public class Git2dartBinariesPlugin: NSObject, FlutterPlugin { + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel(name: "git2dart_binaries", binaryMessenger: registrar.messenger()) + let instance = Git2dartBinariesPlugin() + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + switch call.method { + case "getPlatformVersion": + result("iOS " + UIDevice.current.systemVersion) + default: + result(FlutterMethodNotImplemented) + } + } +} diff --git a/ios/git2dart_binaries.podspec b/ios/git2dart_binaries.podspec new file mode 100644 index 0000000..a63510e --- /dev/null +++ b/ios/git2dart_binaries.podspec @@ -0,0 +1,29 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# +Pod::Spec.new do |s| + s.name = 'git2dart_binaries' + s.version = '1.10.4' + s.summary = 'Dart bindings to libgit2.' + s.description = <<-DESC +Dart bindings to libgit2. + DESC + s.homepage = 'https://github.com/DartGit-dev/git2dart_binaries' + s.license = { :file => '../LICENSE' } + s.author = { 'Viktor Borisov' => 'vik.borisoff@gmail.com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.dependency 'Flutter' + s.static_framework = true + s.vendored_frameworks = [ + 'libcrypto.xcframework', + 'libssl.xcframework', + 'libssh2.xcframework', + 'libgit2.xcframework' + ] + s.libraries = ['z', 'iconv'] + + s.platform = :ios, '12.0' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.swift_version = '5.0' +end diff --git a/lib/src/util.dart b/lib/src/util.dart index 3935f6e..97e789e 100644 --- a/lib/src/util.dart +++ b/lib/src/util.dart @@ -17,11 +17,11 @@ String? _cachedPackageRoot; return (name: 'libgit2.dll', subDir: 'windows'); } else if (Platform.isMacOS) { // Must match the filename the podspec vendors AND the dylib's own - // install_name (`@rpath/libgit2-experimental.1.9.dylib`). The + // install_name (`@rpath/libgit2.dylib`). The // package_config fallback in _loadLibrary doesn't work inside // compiled Flutter apps (no package_config.json at runtime), so the // first DynamicLibrary.open MUST succeed with this exact name. - return (name: 'libgit2-experimental.1.9.dylib', subDir: 'macos'); + return (name: 'libgit2.dylib', subDir: 'macos'); } else if (Platform.isLinux) { return (name: 'libgit2.so', subDir: 'linux'); } else if (Platform.isAndroid) { @@ -31,6 +31,10 @@ String? _cachedPackageRoot; } DynamicLibrary _loadLibrary() { + if (Platform.isIOS) { + return DynamicLibrary.process(); + } + final target = _platformTarget(); try { diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 69fbeb4..293d5b4 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -42,6 +42,6 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) # This list could contain prebuilt libraries, or libraries created by an # external build triggered from this build file. set(git2dart_binaries_bundled_libraries - "${CMAKE_CURRENT_SOURCE_DIR}/libgit2-1.6.2.so" + "${CMAKE_CURRENT_SOURCE_DIR}/libgit2.so" PARENT_SCOPE ) diff --git a/macos/git2dart_binaries.podspec b/macos/git2dart_binaries.podspec index 3009a67..975e714 100644 --- a/macos/git2dart_binaries.podspec +++ b/macos/git2dart_binaries.podspec @@ -15,12 +15,12 @@ Dart bindings to libgit2. s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'FlutterMacOS' - # The libgit2 dylib's install_name is @rpath/libgit2-experimental.1.9.dylib, + # The libgit2 dylib's install_name is @rpath/libgit2.dylib, # so the file must be vendored under that exact name or dyld can't find # it inside the .app bundle at runtime. libssh2.1.dylib is a transitive # dependency of libgit2 and must also be declared here so CocoaPods # embeds it into the bundle's Frameworks directory. - s.vendored_libraries = ['libgit2-experimental.1.9.dylib', 'libssh2.1.dylib'] + s.vendored_libraries = ['libgit2.dylib', 'libssh2.1.dylib'] s.platform = :osx, '10.11' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } diff --git a/pubspec.yaml b/pubspec.yaml index a9d936c..aeaedbc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,6 +41,9 @@ flutter: android: pluginClass: Git2dartBinariesPlugin ffiPlugin: true + ios: + pluginClass: Git2dartBinariesPlugin + ffiPlugin: true linux: pluginClass: Git2dartBinariesPlugin ffiPlugin: true diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 02f0447..b803711 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -49,7 +49,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) # external build triggered from this build file. set(git2dart_binaries_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/libcrypto-1_1-x64.dll" - "${CMAKE_CURRENT_SOURCE_DIR}/libgit2-1.6.2.dll" + "${CMAKE_CURRENT_SOURCE_DIR}/libgit2.dll" "${CMAKE_CURRENT_SOURCE_DIR}/libssh2.dll" PARENT_SCOPE ) From 796294c2acac23ad1315d84a611c2a2f6a4b3cd3 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:12:51 +0700 Subject: [PATCH 02/27] Fix iOS OpenSSL library build --- .github/actions/build-ios/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index dd19188..f3781ca 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -76,11 +76,12 @@ runs: ./Configure "$openssl_target" \ -static \ no-shared \ + no-apps \ no-tests \ --prefix="$openssl_install" make clean || true - make -j"$(sysctl -n hw.ncpu)" - make install_sw + make -j"$(sysctl -n hw.ncpu)" build_libs + make install_dev popd cmake -S ./libssh2 -B "$platform_dir/libssh2-bld" \ From 9f2bc372caf461e685af7192e81473e131c551af Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:14:45 +0700 Subject: [PATCH 03/27] Remove unsupported OpenSSL iOS option --- .github/actions/build-ios/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index f3781ca..80d6e0e 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -76,7 +76,6 @@ runs: ./Configure "$openssl_target" \ -static \ no-shared \ - no-apps \ no-tests \ --prefix="$openssl_install" make clean || true From 41b025d8a5c00c022aecf6376eca8f05ca40510f Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:16:41 +0700 Subject: [PATCH 04/27] Run only iOS build in CI --- .github/workflows/build_package.yml | 192 ---------------------------- 1 file changed, 192 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 8e11a43..a6ce275 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -17,41 +17,6 @@ env: jobs: - generate_bindings: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Build Linux artifacts - uses: ./.github/actions/generate-bindings - with: - libgit2_version: ${{ env.LIBGIT2_VERSION }} - - build_libgit2_linux: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Build Linux artifacts - uses: ./.github/actions/build-linux - with: - libgit2_version: ${{ env.LIBGIT2_VERSION }} - libssh2_version: ${{ env.LIBSSH2_VERSION }} - - build_libgit2_macos: - runs-on: macos-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Build macOS artifacts - uses: ./.github/actions/build-macos - with: - libgit2_version: ${{ env.LIBGIT2_VERSION }} - libssh2_version: ${{ env.LIBSSH2_VERSION }} - build_libgit2_ios: runs-on: macos-latest steps: @@ -64,160 +29,3 @@ jobs: libgit2_version: ${{ env.LIBGIT2_VERSION }} libssh2_version: ${{ env.LIBSSH2_VERSION }} openssl_version: ${{ env.OPENSSL_VERSION }} - - build_libgit2_windows: - runs-on: windows-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Build Windows artifacts - uses: ./.github/actions/build-windows - with: - libgit2_version: ${{ env.LIBGIT2_VERSION }} - libssh2_version: ${{ env.LIBSSH2_VERSION }} - - build_libgit2_android: - runs-on: ubuntu-latest - strategy: - matrix: - os: [armeabi-v7a, arm64-v8a, x86, x86_64] - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Build Android artifacts - uses: ./.github/actions/build-android - with: - architecture: ${{ matrix.os }} - libgit2_version: ${{ env.LIBGIT2_VERSION }} - libssh2_version: ${{ env.LIBSSH2_VERSION }} - openssl_version: ${{ env.OPENSSL_VERSION }} - - run_tests: - needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, build_libgit2_ios, build_libgit2_windows, build_libgit2_android] - # needs: [generate_bindings, build_libgit2_android] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: download bindings - uses: actions/download-artifact@v4 - with: - path: ./lib/src/ - name: cache-bindings - - - name: download linux deps - uses: actions/download-artifact@v4 - if: ${{ runner.os == 'Linux' }} - with: - path: ./linux - name: cache-linux - - name: Install linux dependencies - if: ${{ runner.os == 'Linux' }} - run: | - sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Acquire::Retries=3 && sudo DEBIAN_FRONTEND=noninteractive apt-get install -o Acquire::Retries=3 -y --no-install-recommends openssl - - - name: download macos deps - uses: actions/download-artifact@v4 - if: ${{ runner.os == 'macOS' }} - with: - path: ./macos - name: cache-macos - - - name: Install windows dependencies - if: ${{ runner.os == 'Windows' }} - run: | - choco install openssl -y - - - name: download windows deps - uses: actions/download-artifact@v4 - if: ${{ runner.os == 'Windows' }} - with: - path: ./windows - name: cache-windows - - - name: Run ffigen - uses: subosito/flutter-action@v2 - - run: flutter pub get - - run: flutter test -r expanded - - publish_package: - if: ${{ github.actor != 'nektos/act' }} - needs: [run_tests] - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - name: download bindings - uses: actions/download-artifact@v4 - with: - path: ./lib/src/ - name: cache-bindings - - - name: download macos binaries - uses: actions/download-artifact@v4 - with: - path: ./macos - name: cache-macos - - - name: download ios binaries - uses: actions/download-artifact@v4 - with: - path: ./ios - name: cache-ios - - - name: download windows binaries - uses: actions/download-artifact@v4 - with: - path: ./windows - name: cache-windows - - - name: download linux binaries - uses: actions/download-artifact@v4 - with: - path: ./linux - name: cache-linux - - - name: download android binaries x86_64 - uses: actions/download-artifact@v4 - with: - path: ./android/src/main/jniLibs/x86_64 - name: cache-android-x86_64 - - - name: download android binaries arm64-v8a - uses: actions/download-artifact@v4 - with: - path: ./android/src/main/jniLibs/arm64-v8a - name: cache-android-arm64-v8a - - - name: download android binaries x86 - uses: actions/download-artifact@v4 - with: - path: ./android/src/main/jniLibs/x86 - name: cache-android-x86 - - - name: download android binaries armeabi-v7a - uses: actions/download-artifact@v4 - with: - path: ./android/src/main/jniLibs/armeabi-v7a - name: cache-android-armeabi-v7a - - - name: Zip package into cache - if: ${{ github.event_name == 'pull_request' }} - uses: actions/upload-artifact@v4 - with: - name: release-package - path: . - - - name: Publish package - if: ${{ github.event_name != 'pull_request' }} - uses: k-paxian/dart-package-publisher@master - with: - accessToken: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }} - refreshToken: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }} - skipTests: true From dc27d8149c76ad8ae4bceaae9b9d51996e38328c Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:17:30 +0700 Subject: [PATCH 05/27] Disable non-iOS CI jobs without deleting them --- .github/workflows/build_package.yml | 198 ++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index a6ce275..26dfd82 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -17,6 +17,44 @@ env: jobs: + generate_bindings: + if: false + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build Linux artifacts + uses: ./.github/actions/generate-bindings + with: + libgit2_version: ${{ env.LIBGIT2_VERSION }} + + build_libgit2_linux: + if: false + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build Linux artifacts + uses: ./.github/actions/build-linux + with: + libgit2_version: ${{ env.LIBGIT2_VERSION }} + libssh2_version: ${{ env.LIBSSH2_VERSION }} + + build_libgit2_macos: + if: false + runs-on: macos-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build macOS artifacts + uses: ./.github/actions/build-macos + with: + libgit2_version: ${{ env.LIBGIT2_VERSION }} + libssh2_version: ${{ env.LIBSSH2_VERSION }} + build_libgit2_ios: runs-on: macos-latest steps: @@ -29,3 +67,163 @@ jobs: libgit2_version: ${{ env.LIBGIT2_VERSION }} libssh2_version: ${{ env.LIBSSH2_VERSION }} openssl_version: ${{ env.OPENSSL_VERSION }} + + build_libgit2_windows: + if: false + runs-on: windows-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build Windows artifacts + uses: ./.github/actions/build-windows + with: + libgit2_version: ${{ env.LIBGIT2_VERSION }} + libssh2_version: ${{ env.LIBSSH2_VERSION }} + + build_libgit2_android: + if: false + runs-on: ubuntu-latest + strategy: + matrix: + os: [armeabi-v7a, arm64-v8a, x86, x86_64] + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build Android artifacts + uses: ./.github/actions/build-android + with: + architecture: ${{ matrix.os }} + libgit2_version: ${{ env.LIBGIT2_VERSION }} + libssh2_version: ${{ env.LIBSSH2_VERSION }} + openssl_version: ${{ env.OPENSSL_VERSION }} + + run_tests: + if: false + needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, build_libgit2_ios, build_libgit2_windows, build_libgit2_android] + # needs: [generate_bindings, build_libgit2_android] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: download bindings + uses: actions/download-artifact@v4 + with: + path: ./lib/src/ + name: cache-bindings + + - name: download linux deps + uses: actions/download-artifact@v4 + if: ${{ runner.os == 'Linux' }} + with: + path: ./linux + name: cache-linux + - name: Install linux dependencies + if: ${{ runner.os == 'Linux' }} + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Acquire::Retries=3 && sudo DEBIAN_FRONTEND=noninteractive apt-get install -o Acquire::Retries=3 -y --no-install-recommends openssl + + - name: download macos deps + uses: actions/download-artifact@v4 + if: ${{ runner.os == 'macOS' }} + with: + path: ./macos + name: cache-macos + + - name: Install windows dependencies + if: ${{ runner.os == 'Windows' }} + run: | + choco install openssl -y + + - name: download windows deps + uses: actions/download-artifact@v4 + if: ${{ runner.os == 'Windows' }} + with: + path: ./windows + name: cache-windows + + - name: Run ffigen + uses: subosito/flutter-action@v2 + - run: flutter pub get + - run: flutter test -r expanded + + publish_package: + if: false + needs: [run_tests] + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: download bindings + uses: actions/download-artifact@v4 + with: + path: ./lib/src/ + name: cache-bindings + + - name: download macos binaries + uses: actions/download-artifact@v4 + with: + path: ./macos + name: cache-macos + + - name: download ios binaries + uses: actions/download-artifact@v4 + with: + path: ./ios + name: cache-ios + + - name: download windows binaries + uses: actions/download-artifact@v4 + with: + path: ./windows + name: cache-windows + + - name: download linux binaries + uses: actions/download-artifact@v4 + with: + path: ./linux + name: cache-linux + + - name: download android binaries x86_64 + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/x86_64 + name: cache-android-x86_64 + + - name: download android binaries arm64-v8a + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/arm64-v8a + name: cache-android-arm64-v8a + + - name: download android binaries x86 + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/x86 + name: cache-android-x86 + + - name: download android binaries armeabi-v7a + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/armeabi-v7a + name: cache-android-armeabi-v7a + + - name: Zip package into cache + if: ${{ github.event_name == 'pull_request' }} + uses: actions/upload-artifact@v4 + with: + name: release-package + path: . + + - name: Publish package + if: ${{ github.event_name != 'pull_request' }} + uses: k-paxian/dart-package-publisher@master + with: + accessToken: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }} + refreshToken: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }} + skipTests: true From da9cfcc3a4793acde86a8ef17179088694d551a7 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:21:26 +0700 Subject: [PATCH 06/27] Fix iOS libgit2 libssh2 discovery --- .github/actions/build-ios/action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index 80d6e0e..ffed62f 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -100,6 +100,7 @@ runs: -DCMAKE_INSTALL_PREFIX="$libssh2_install" cmake --build "$platform_dir/libssh2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" + PKG_CONFIG_EXECUTABLE= \ cmake -S ./libgit2 -B "$platform_dir/libgit2-bld" \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTS=OFF \ @@ -135,6 +136,11 @@ runs: arm64_simulator_libgit2="$(find "$BUILD_ROOT/iphonesimulator-arm64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" x86_64_simulator_libgit2="$(find "$BUILD_ROOT/iphonesimulator-x86_64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" + device_libgit2="$(find "$BUILD_ROOT/iphoneos-arm64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" + + test -n "$arm64_simulator_libgit2" + test -n "$x86_64_simulator_libgit2" + test -n "$device_libgit2" lipo -create \ "$BUILD_ROOT/iphonesimulator-arm64/openssl/lib/libcrypto.a" \ @@ -153,8 +159,6 @@ runs: "$x86_64_simulator_libgit2" \ -output "$simulator_dir/libgit2/lib/libgit2.a" - device_libgit2="$(find "$BUILD_ROOT/iphoneos-arm64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" - xcodebuild -create-xcframework \ -library "$BUILD_ROOT/iphoneos-arm64/openssl/lib/libcrypto.a" -headers "$BUILD_ROOT/iphoneos-arm64/openssl/include" \ -library "$simulator_dir/openssl/lib/libcrypto.a" -headers "$simulator_dir/openssl/include" \ From f8c8b8c19858e1951665fd12bcb89c0e1bf56f58 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:25:07 +0700 Subject: [PATCH 07/27] Build iOS slices with matrix --- .github/actions/build-ios/action.yml | 246 ++++++++++++--------------- .github/workflows/build_package.yml | 94 +++++++++- 2 files changed, 199 insertions(+), 141 deletions(-) diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index ffed62f..5c162cd 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -1,5 +1,5 @@ -name: Build libgit2 iOS -description: Build libgit2, libssh2, and OpenSSL as iOS XCFrameworks +name: Build libgit2 iOS slice +description: Build libgit2, libssh2, and OpenSSL for one iOS SDK/architecture slice inputs: libgit2_version: description: Version of libgit2 to build @@ -10,6 +10,18 @@ inputs: openssl_version: description: Version of OpenSSL to build required: true + ios_sdk: + description: iOS SDK to build for, e.g. iphoneos or iphonesimulator + required: true + architecture: + description: Architecture to build, e.g. arm64 or x86_64 + required: true + openssl_target: + description: OpenSSL Configure target, e.g. ios64-xcrun or iossimulator-xcrun + required: true + artifact_name: + description: GitHub Actions artifact name for this slice + required: true ios_deployment_target: description: Minimum iOS deployment target required: false @@ -38,149 +50,103 @@ runs: ref: refs/tags/v${{ inputs.libgit2_version }} path: ./libgit2 - - name: Build iOS libraries + - name: Build iOS slice shell: bash env: IOS_DEPLOYMENT_TARGET: ${{ inputs.ios_deployment_target }} + IOS_SDK: ${{ inputs.ios_sdk }} + IOS_ARCH: ${{ inputs.architecture }} + OPENSSL_TARGET: ${{ inputs.openssl_target }} run: | set -euo pipefail - BUILD_ROOT="/tmp/git2dart-ios" - OUTPUT_DIR="$BUILD_ROOT/export" - rm -rf "$BUILD_ROOT" - mkdir -p "$OUTPUT_DIR" - - build_arch() { - local sdk="$1" - local arch="$2" - local openssl_target="$3" - local platform_dir="$BUILD_ROOT/$sdk-$arch" - local openssl_install="$platform_dir/openssl" - local libssh2_install="$platform_dir/libssh2" - local libgit2_install="$platform_dir/libgit2" - local sysroot - local min_version_flag - - sysroot="$(xcrun --sdk "$sdk" --show-sdk-path)" - if [ "$sdk" = "iphoneos" ]; then - min_version_flag="-miphoneos-version-min=$IOS_DEPLOYMENT_TARGET" - else - min_version_flag="-mios-simulator-version-min=$IOS_DEPLOYMENT_TARGET" - fi - mkdir -p "$platform_dir" - - cp -R ./openssl "$platform_dir/openssl-src" - pushd "$platform_dir/openssl-src" - CFLAGS="-arch $arch $min_version_flag" \ - LDFLAGS="-arch $arch $min_version_flag" \ - ./Configure "$openssl_target" \ - -static \ - no-shared \ - no-tests \ - --prefix="$openssl_install" - make clean || true - make -j"$(sysctl -n hw.ncpu)" build_libs - make install_dev - popd - - cmake -S ./libssh2 -B "$platform_dir/libssh2-bld" \ - -DBUILD_SHARED_LIBS=OFF \ - -DBUILD_EXAMPLES=OFF \ - -DBUILD_TESTING=OFF \ - -DBUILD_TESTS=OFF \ - -DCRYPTO_BACKEND=OpenSSL \ - -DOPENSSL_ROOT_DIR="$openssl_install" \ - -DOPENSSL_INCLUDE_DIR="$openssl_install/include" \ - -DOPENSSL_SSL_LIBRARY="$openssl_install/lib/libssl.a" \ - -DOPENSSL_CRYPTO_LIBRARY="$openssl_install/lib/libcrypto.a" \ - -DCMAKE_SYSTEM_NAME=iOS \ - -DCMAKE_OSX_SYSROOT="$sysroot" \ - -DCMAKE_OSX_ARCHITECTURES="$arch" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \ - -DCMAKE_INSTALL_PREFIX="$libssh2_install" - cmake --build "$platform_dir/libssh2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" - - PKG_CONFIG_EXECUTABLE= \ - cmake -S ./libgit2 -B "$platform_dir/libgit2-bld" \ - -DBUILD_SHARED_LIBS=OFF \ - -DBUILD_TESTS=OFF \ - -DUSE_SSH=libssh2 \ - -DUSE_HTTPS=OpenSSL \ - -DEXPERIMENTAL_SHA256=ON \ - -DLIBSSH2_INCLUDE_DIR="$libssh2_install/include" \ - -DLIBSSH2_LIBRARY="$libssh2_install/lib/libssh2.a" \ - -DOPENSSL_ROOT_DIR="$openssl_install" \ - -DOPENSSL_INCLUDE_DIR="$openssl_install/include" \ - -DOPENSSL_SSL_LIBRARY="$openssl_install/lib/libssl.a" \ - -DOPENSSL_CRYPTO_LIBRARY="$openssl_install/lib/libcrypto.a" \ - -DCMAKE_SYSTEM_NAME=iOS \ - -DCMAKE_OSX_SYSROOT="$sysroot" \ - -DCMAKE_OSX_ARCHITECTURES="$arch" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \ - -DCMAKE_INSTALL_PREFIX="$libgit2_install" - cmake --build "$platform_dir/libgit2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" - } - - build_arch iphoneos arm64 ios64-xcrun - build_arch iphonesimulator arm64 iossimulator-xcrun - build_arch iphonesimulator x86_64 iossimulator-xcrun - - simulator_dir="$BUILD_ROOT/iphonesimulator-universal" - mkdir -p "$simulator_dir/openssl/lib" "$simulator_dir/openssl/include" - mkdir -p "$simulator_dir/libssh2/lib" "$simulator_dir/libssh2/include" - mkdir -p "$simulator_dir/libgit2/lib" "$simulator_dir/libgit2/include" - - cp -R "$BUILD_ROOT/iphonesimulator-arm64/openssl/include/." "$simulator_dir/openssl/include/" - cp -R "$BUILD_ROOT/iphonesimulator-arm64/libssh2/include/." "$simulator_dir/libssh2/include/" - cp -R "$BUILD_ROOT/iphonesimulator-arm64/libgit2/include/." "$simulator_dir/libgit2/include/" - - arm64_simulator_libgit2="$(find "$BUILD_ROOT/iphonesimulator-arm64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" - x86_64_simulator_libgit2="$(find "$BUILD_ROOT/iphonesimulator-x86_64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" - device_libgit2="$(find "$BUILD_ROOT/iphoneos-arm64/libgit2/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" - - test -n "$arm64_simulator_libgit2" - test -n "$x86_64_simulator_libgit2" - test -n "$device_libgit2" - - lipo -create \ - "$BUILD_ROOT/iphonesimulator-arm64/openssl/lib/libcrypto.a" \ - "$BUILD_ROOT/iphonesimulator-x86_64/openssl/lib/libcrypto.a" \ - -output "$simulator_dir/openssl/lib/libcrypto.a" - lipo -create \ - "$BUILD_ROOT/iphonesimulator-arm64/openssl/lib/libssl.a" \ - "$BUILD_ROOT/iphonesimulator-x86_64/openssl/lib/libssl.a" \ - -output "$simulator_dir/openssl/lib/libssl.a" - lipo -create \ - "$BUILD_ROOT/iphonesimulator-arm64/libssh2/lib/libssh2.a" \ - "$BUILD_ROOT/iphonesimulator-x86_64/libssh2/lib/libssh2.a" \ - -output "$simulator_dir/libssh2/lib/libssh2.a" - lipo -create \ - "$arm64_simulator_libgit2" \ - "$x86_64_simulator_libgit2" \ - -output "$simulator_dir/libgit2/lib/libgit2.a" - - xcodebuild -create-xcframework \ - -library "$BUILD_ROOT/iphoneos-arm64/openssl/lib/libcrypto.a" -headers "$BUILD_ROOT/iphoneos-arm64/openssl/include" \ - -library "$simulator_dir/openssl/lib/libcrypto.a" -headers "$simulator_dir/openssl/include" \ - -output "$OUTPUT_DIR/libcrypto.xcframework" - - xcodebuild -create-xcframework \ - -library "$BUILD_ROOT/iphoneos-arm64/openssl/lib/libssl.a" -headers "$BUILD_ROOT/iphoneos-arm64/openssl/include" \ - -library "$simulator_dir/openssl/lib/libssl.a" -headers "$simulator_dir/openssl/include" \ - -output "$OUTPUT_DIR/libssl.xcframework" - - xcodebuild -create-xcframework \ - -library "$BUILD_ROOT/iphoneos-arm64/libssh2/lib/libssh2.a" -headers "$BUILD_ROOT/iphoneos-arm64/libssh2/include" \ - -library "$simulator_dir/libssh2/lib/libssh2.a" -headers "$simulator_dir/libssh2/include" \ - -output "$OUTPUT_DIR/libssh2.xcframework" - - xcodebuild -create-xcframework \ - -library "$device_libgit2" -headers "$BUILD_ROOT/iphoneos-arm64/libgit2/include" \ - -library "$simulator_dir/libgit2/lib/libgit2.a" -headers "$simulator_dir/libgit2/include" \ - -output "$OUTPUT_DIR/libgit2.xcframework" - - - name: Cache iOS libraries + slice="$IOS_SDK-$IOS_ARCH" + build_root="/tmp/git2dart-ios-$slice" + output_dir="$build_root/export/$slice" + openssl_install="$build_root/openssl" + libssh2_install="$build_root/libssh2" + libgit2_install="$build_root/libgit2" + sysroot="$(xcrun --sdk "$IOS_SDK" --show-sdk-path)" + + if [ "$IOS_SDK" = "iphoneos" ]; then + min_version_flag="-miphoneos-version-min=$IOS_DEPLOYMENT_TARGET" + else + min_version_flag="-mios-simulator-version-min=$IOS_DEPLOYMENT_TARGET" + fi + + rm -rf "$build_root" + mkdir -p "$output_dir" + + cp -R ./openssl "$build_root/openssl-src" + pushd "$build_root/openssl-src" + CFLAGS="-arch $IOS_ARCH $min_version_flag" \ + LDFLAGS="-arch $IOS_ARCH $min_version_flag" \ + ./Configure "$OPENSSL_TARGET" \ + -static \ + no-shared \ + no-tests \ + --prefix="$openssl_install" + make clean || true + make -j"$(sysctl -n hw.ncpu)" build_libs + make install_dev + popd + + cmake -S ./libssh2 -B "$build_root/libssh2-bld" \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF \ + -DBUILD_TESTS=OFF \ + -DCRYPTO_BACKEND=OpenSSL \ + -DOPENSSL_ROOT_DIR="$openssl_install" \ + -DOPENSSL_INCLUDE_DIR="$openssl_install/include" \ + -DOPENSSL_SSL_LIBRARY="$openssl_install/lib/libssl.a" \ + -DOPENSSL_CRYPTO_LIBRARY="$openssl_install/lib/libcrypto.a" \ + -DCMAKE_SYSTEM_NAME=iOS \ + -DCMAKE_OSX_SYSROOT="$sysroot" \ + -DCMAKE_OSX_ARCHITECTURES="$IOS_ARCH" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \ + -DCMAKE_INSTALL_PREFIX="$libssh2_install" + cmake --build "$build_root/libssh2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" + + PKG_CONFIG_PATH="$libssh2_install/lib/pkgconfig" \ + cmake -S ./libgit2 -B "$build_root/libgit2-bld" \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTS=OFF \ + -DUSE_SSH=libssh2 \ + -DUSE_HTTPS=OpenSSL \ + -DEXPERIMENTAL_SHA256=ON \ + -DLIBSSH2_INCLUDE_DIR="$libssh2_install/include" \ + -DLIBSSH2_LIBRARY="$libssh2_install/lib/libssh2.a" \ + -DOPENSSL_ROOT_DIR="$openssl_install" \ + -DOPENSSL_INCLUDE_DIR="$openssl_install/include" \ + -DOPENSSL_SSL_LIBRARY="$openssl_install/lib/libssl.a" \ + -DOPENSSL_CRYPTO_LIBRARY="$openssl_install/lib/libcrypto.a" \ + -DCMAKE_LIBRARY_PATH="$libssh2_install/lib;$openssl_install/lib" \ + -DCMAKE_SYSTEM_NAME=iOS \ + -DCMAKE_OSX_SYSROOT="$sysroot" \ + -DCMAKE_OSX_ARCHITECTURES="$IOS_ARCH" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \ + -DCMAKE_INSTALL_PREFIX="$libgit2_install" + cmake --build "$build_root/libgit2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" + + libgit2_archive="$(find "$libgit2_install/lib" -maxdepth 1 -name 'libgit2*.a' | head -n 1)" + test -n "$libgit2_archive" + + mkdir -p "$output_dir/openssl/lib" "$output_dir/openssl/include" + mkdir -p "$output_dir/libssh2/lib" "$output_dir/libssh2/include" + mkdir -p "$output_dir/libgit2/lib" "$output_dir/libgit2/include" + + cp "$openssl_install/lib/libcrypto.a" "$output_dir/openssl/lib/" + cp "$openssl_install/lib/libssl.a" "$output_dir/openssl/lib/" + cp "$libssh2_install/lib/libssh2.a" "$output_dir/libssh2/lib/" + cp "$libgit2_archive" "$output_dir/libgit2/lib/libgit2.a" + + cp -R "$openssl_install/include/." "$output_dir/openssl/include/" + cp -R "$libssh2_install/include/." "$output_dir/libssh2/include/" + cp -R "$libgit2_install/include/." "$output_dir/libgit2/include/" + + - name: Upload iOS slice uses: actions/upload-artifact@v4 with: - name: cache-ios - path: /tmp/git2dart-ios/export/** + name: ${{ inputs.artifact_name }} + path: /tmp/git2dart-ios-${{ inputs.ios_sdk }}-${{ inputs.architecture }}/export/** diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 26dfd82..9346120 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -57,16 +57,108 @@ jobs: build_libgit2_ios: runs-on: macos-latest + strategy: + fail-fast: false + matrix: + include: + - slice: iphoneos-arm64 + sdk: iphoneos + arch: arm64 + openssl_target: ios64-xcrun + - slice: iphonesimulator-arm64 + sdk: iphonesimulator + arch: arm64 + openssl_target: iossimulator-xcrun + - slice: iphonesimulator-x86_64 + sdk: iphonesimulator + arch: x86_64 + openssl_target: iossimulator-xcrun steps: - name: Check out repository uses: actions/checkout@v4 - - name: Build iOS artifacts + - name: Build iOS slice uses: ./.github/actions/build-ios with: libgit2_version: ${{ env.LIBGIT2_VERSION }} libssh2_version: ${{ env.LIBSSH2_VERSION }} openssl_version: ${{ env.OPENSSL_VERSION }} + ios_sdk: ${{ matrix.sdk }} + architecture: ${{ matrix.arch }} + openssl_target: ${{ matrix.openssl_target }} + artifact_name: cache-ios-${{ matrix.slice }} + + assemble_libgit2_ios: + needs: [build_libgit2_ios] + runs-on: macos-latest + steps: + - name: Download iOS slices + uses: actions/download-artifact@v4 + with: + pattern: cache-ios-* + path: /tmp/git2dart-ios/slices + merge-multiple: true + + - name: Assemble iOS XCFrameworks + shell: bash + run: | + set -euo pipefail + + slices_dir="/tmp/git2dart-ios/slices" + output_dir="/tmp/git2dart-ios/export" + simulator_dir="/tmp/git2dart-ios/iphonesimulator-universal" + + mkdir -p "$output_dir" + mkdir -p "$simulator_dir/openssl/lib" "$simulator_dir/openssl/include" + mkdir -p "$simulator_dir/libssh2/lib" "$simulator_dir/libssh2/include" + mkdir -p "$simulator_dir/libgit2/lib" "$simulator_dir/libgit2/include" + + cp -R "$slices_dir/iphonesimulator-arm64/openssl/include/." "$simulator_dir/openssl/include/" + cp -R "$slices_dir/iphonesimulator-arm64/libssh2/include/." "$simulator_dir/libssh2/include/" + cp -R "$slices_dir/iphonesimulator-arm64/libgit2/include/." "$simulator_dir/libgit2/include/" + + lipo -create \ + "$slices_dir/iphonesimulator-arm64/openssl/lib/libcrypto.a" \ + "$slices_dir/iphonesimulator-x86_64/openssl/lib/libcrypto.a" \ + -output "$simulator_dir/openssl/lib/libcrypto.a" + lipo -create \ + "$slices_dir/iphonesimulator-arm64/openssl/lib/libssl.a" \ + "$slices_dir/iphonesimulator-x86_64/openssl/lib/libssl.a" \ + -output "$simulator_dir/openssl/lib/libssl.a" + lipo -create \ + "$slices_dir/iphonesimulator-arm64/libssh2/lib/libssh2.a" \ + "$slices_dir/iphonesimulator-x86_64/libssh2/lib/libssh2.a" \ + -output "$simulator_dir/libssh2/lib/libssh2.a" + lipo -create \ + "$slices_dir/iphonesimulator-arm64/libgit2/lib/libgit2.a" \ + "$slices_dir/iphonesimulator-x86_64/libgit2/lib/libgit2.a" \ + -output "$simulator_dir/libgit2/lib/libgit2.a" + + xcodebuild -create-xcframework \ + -library "$slices_dir/iphoneos-arm64/openssl/lib/libcrypto.a" -headers "$slices_dir/iphoneos-arm64/openssl/include" \ + -library "$simulator_dir/openssl/lib/libcrypto.a" -headers "$simulator_dir/openssl/include" \ + -output "$output_dir/libcrypto.xcframework" + + xcodebuild -create-xcframework \ + -library "$slices_dir/iphoneos-arm64/openssl/lib/libssl.a" -headers "$slices_dir/iphoneos-arm64/openssl/include" \ + -library "$simulator_dir/openssl/lib/libssl.a" -headers "$simulator_dir/openssl/include" \ + -output "$output_dir/libssl.xcframework" + + xcodebuild -create-xcframework \ + -library "$slices_dir/iphoneos-arm64/libssh2/lib/libssh2.a" -headers "$slices_dir/iphoneos-arm64/libssh2/include" \ + -library "$simulator_dir/libssh2/lib/libssh2.a" -headers "$simulator_dir/libssh2/include" \ + -output "$output_dir/libssh2.xcframework" + + xcodebuild -create-xcframework \ + -library "$slices_dir/iphoneos-arm64/libgit2/lib/libgit2.a" -headers "$slices_dir/iphoneos-arm64/libgit2/include" \ + -library "$simulator_dir/libgit2/lib/libgit2.a" -headers "$simulator_dir/libgit2/include" \ + -output "$output_dir/libgit2.xcframework" + + - name: Upload iOS XCFrameworks + uses: actions/upload-artifact@v4 + with: + name: cache-ios + path: /tmp/git2dart-ios/export/** build_libgit2_windows: if: false From c732ac1f365df92c988241c40c6559dd2c157486 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:27:25 +0700 Subject: [PATCH 08/27] Fix iOS libssh2 pkg-config archive path --- .github/actions/build-ios/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index 5c162cd..68c6574 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -108,6 +108,11 @@ runs: -DCMAKE_INSTALL_PREFIX="$libssh2_install" cmake --build "$build_root/libssh2-bld" --target install -- -j"$(sysctl -n hw.ncpu)" + libssh2_pc="$libssh2_install/lib/pkgconfig/libssh2.pc" + if [ -f "$libssh2_pc" ]; then + sed -i.bak "s|-lssh2|$libssh2_install/lib/libssh2.a|g" "$libssh2_pc" + fi + PKG_CONFIG_PATH="$libssh2_install/lib/pkgconfig" \ cmake -S ./libgit2 -B "$build_root/libgit2-bld" \ -DBUILD_SHARED_LIBS=OFF \ From 052a8255de3cecb5908dfc6a97e6ce2cdee71d23 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:32:07 +0700 Subject: [PATCH 09/27] Fix iOS pkg-config dependency paths --- .github/actions/build-ios/action.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index 68c6574..9d1e10b 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -110,7 +110,16 @@ runs: libssh2_pc="$libssh2_install/lib/pkgconfig/libssh2.pc" if [ -f "$libssh2_pc" ]; then - sed -i.bak "s|-lssh2|$libssh2_install/lib/libssh2.a|g" "$libssh2_pc" + zlib_path="$sysroot/usr/lib/libz.tbd" + if [ ! -f "$zlib_path" ]; then + zlib_path="$sysroot/usr/lib/libz.dylib" + fi + sed -i.bak \ + -e "s|-lssh2|$libssh2_install/lib/libssh2.a|g" \ + -e "s|-lssl|$openssl_install/lib/libssl.a|g" \ + -e "s|-lcrypto|$openssl_install/lib/libcrypto.a|g" \ + -e "s|-lz|$zlib_path|g" \ + "$libssh2_pc" fi PKG_CONFIG_PATH="$libssh2_install/lib/pkgconfig" \ From decf5206838872634efbcbd154be56fee0461c6b Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:35:57 +0700 Subject: [PATCH 10/27] Fix iOS libgit2 dependency lookup --- .github/actions/build-ios/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/build-ios/action.yml b/.github/actions/build-ios/action.yml index 9d1e10b..19d5c09 100644 --- a/.github/actions/build-ios/action.yml +++ b/.github/actions/build-ios/action.yml @@ -136,6 +136,9 @@ runs: -DOPENSSL_SSL_LIBRARY="$openssl_install/lib/libssl.a" \ -DOPENSSL_CRYPTO_LIBRARY="$openssl_install/lib/libcrypto.a" \ -DCMAKE_LIBRARY_PATH="$libssh2_install/lib;$openssl_install/lib" \ + -DCMAKE_FIND_ROOT_PATH="$libssh2_install;$openssl_install;$sysroot" \ + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_OSX_SYSROOT="$sysroot" \ -DCMAKE_OSX_ARCHITECTURES="$IOS_ARCH" \ From 96963921811cd45a02367a020967365d15a9ae7b Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:41:43 +0700 Subject: [PATCH 11/27] Remove x86_64 iOS simulator slice --- .github/workflows/build_package.yml | 30 +---------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 9346120..635d98d 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -69,10 +69,6 @@ jobs: sdk: iphonesimulator arch: arm64 openssl_target: iossimulator-xcrun - - slice: iphonesimulator-x86_64 - sdk: iphonesimulator - arch: x86_64 - openssl_target: iossimulator-xcrun steps: - name: Check out repository uses: actions/checkout@v4 @@ -106,33 +102,9 @@ jobs: slices_dir="/tmp/git2dart-ios/slices" output_dir="/tmp/git2dart-ios/export" - simulator_dir="/tmp/git2dart-ios/iphonesimulator-universal" + simulator_dir="$slices_dir/iphonesimulator-arm64" mkdir -p "$output_dir" - mkdir -p "$simulator_dir/openssl/lib" "$simulator_dir/openssl/include" - mkdir -p "$simulator_dir/libssh2/lib" "$simulator_dir/libssh2/include" - mkdir -p "$simulator_dir/libgit2/lib" "$simulator_dir/libgit2/include" - - cp -R "$slices_dir/iphonesimulator-arm64/openssl/include/." "$simulator_dir/openssl/include/" - cp -R "$slices_dir/iphonesimulator-arm64/libssh2/include/." "$simulator_dir/libssh2/include/" - cp -R "$slices_dir/iphonesimulator-arm64/libgit2/include/." "$simulator_dir/libgit2/include/" - - lipo -create \ - "$slices_dir/iphonesimulator-arm64/openssl/lib/libcrypto.a" \ - "$slices_dir/iphonesimulator-x86_64/openssl/lib/libcrypto.a" \ - -output "$simulator_dir/openssl/lib/libcrypto.a" - lipo -create \ - "$slices_dir/iphonesimulator-arm64/openssl/lib/libssl.a" \ - "$slices_dir/iphonesimulator-x86_64/openssl/lib/libssl.a" \ - -output "$simulator_dir/openssl/lib/libssl.a" - lipo -create \ - "$slices_dir/iphonesimulator-arm64/libssh2/lib/libssh2.a" \ - "$slices_dir/iphonesimulator-x86_64/libssh2/lib/libssh2.a" \ - -output "$simulator_dir/libssh2/lib/libssh2.a" - lipo -create \ - "$slices_dir/iphonesimulator-arm64/libgit2/lib/libgit2.a" \ - "$slices_dir/iphonesimulator-x86_64/libgit2/lib/libgit2.a" \ - -output "$simulator_dir/libgit2/lib/libgit2.a" xcodebuild -create-xcframework \ -library "$slices_dir/iphoneos-arm64/openssl/lib/libcrypto.a" -headers "$slices_dir/iphoneos-arm64/openssl/include" \ From cdc632828f954bea3ca8df44e11a11d17e77553d Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 12:45:49 +0700 Subject: [PATCH 12/27] Re-enable full package workflow --- .github/workflows/build_package.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 635d98d..9b7711d 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -18,7 +18,6 @@ env: jobs: generate_bindings: - if: false runs-on: ubuntu-latest steps: - name: Check out repository @@ -30,7 +29,6 @@ jobs: libgit2_version: ${{ env.LIBGIT2_VERSION }} build_libgit2_linux: - if: false runs-on: ubuntu-latest steps: - name: Check out repository @@ -43,7 +41,6 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_macos: - if: false runs-on: macos-latest steps: - name: Check out repository @@ -133,7 +130,6 @@ jobs: path: /tmp/git2dart-ios/export/** build_libgit2_windows: - if: false runs-on: windows-latest steps: - name: Check out repository @@ -146,7 +142,6 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_android: - if: false runs-on: ubuntu-latest strategy: matrix: @@ -164,8 +159,7 @@ jobs: openssl_version: ${{ env.OPENSSL_VERSION }} run_tests: - if: false - needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, build_libgit2_ios, build_libgit2_windows, build_libgit2_android] + needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, assemble_libgit2_ios, build_libgit2_windows, build_libgit2_android] # needs: [generate_bindings, build_libgit2_android] runs-on: ${{ matrix.os }} strategy: @@ -217,7 +211,7 @@ jobs: - run: flutter test -r expanded publish_package: - if: false + if: ${{ github.actor != 'nektos/act' }} needs: [run_tests] runs-on: ubuntu-latest steps: From 0191090fa139540810d56ce7cd78b85bcaf9509f Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 13:12:58 +0700 Subject: [PATCH 13/27] Add mobile integration test jobs --- .github/workflows/build_package.yml | 157 +++++++++++++++++- .../opts_bindings_integration_test.dart | 8 + pubspec.yaml | 4 + test/opts_bindings_integration_test.dart | 2 +- 4 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 integration_test/opts_bindings_integration_test.dart diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 9b7711d..5426a19 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -210,9 +210,164 @@ jobs: - run: flutter pub get - run: flutter test -r expanded + run_ios_tests: + needs: [generate_bindings, assemble_libgit2_ios] + runs-on: macos-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: download bindings + uses: actions/download-artifact@v4 + with: + path: ./lib/src/ + name: cache-bindings + + - name: download ios binaries + uses: actions/download-artifact@v4 + with: + path: ./ios + name: cache-ios + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + + - name: Prepare integration test app + shell: bash + run: | + set -euo pipefail + + test_app="$RUNNER_TEMP/git2dart_mobile_test" + flutter create --platforms=ios --org com.dartgit "$test_app" + + TEST_APP="$test_app" ruby <<'RUBY' + require 'yaml' + + pubspec_path = File.join(ENV.fetch('TEST_APP'), 'pubspec.yaml') + pubspec = YAML.load_file(pubspec_path) + pubspec['dependencies'] ||= {} + pubspec['dependencies']['git2dart_binaries'] = { + 'path' => ENV.fetch('GITHUB_WORKSPACE') + } + pubspec['dev_dependencies'] ||= {} + pubspec['dev_dependencies']['flutter_test'] = {'sdk' => 'flutter'} + pubspec['dev_dependencies']['integration_test'] = {'sdk' => 'flutter'} + File.write(pubspec_path, pubspec.to_yaml) + RUBY + + mkdir -p "$test_app/test" "$test_app/integration_test" + cp "$GITHUB_WORKSPACE/test/opts_bindings_integration_test.dart" "$test_app/test/" + cp "$GITHUB_WORKSPACE/integration_test/opts_bindings_integration_test.dart" "$test_app/integration_test/" + + cd "$test_app" + flutter pub get + + - name: Run iOS integration tests + shell: bash + run: | + set -euo pipefail + + test_app="$RUNNER_TEMP/git2dart_mobile_test" + device_id="$(xcrun simctl list devices available | awk -F '[()]' '/iPhone/ && $2 ~ /[0-9A-F-]{36}/ { print $2; exit }')" + + if [ -z "$device_id" ]; then + echo "::error::No available iPhone simulator found" + xcrun simctl list devices available + exit 1 + fi + + xcrun simctl boot "$device_id" || true + xcrun simctl bootstatus "$device_id" -b + + cd "$test_app" + flutter devices + flutter test integration_test/opts_bindings_integration_test.dart -d "$device_id" -r expanded + + run_android_tests: + needs: [generate_bindings, build_libgit2_android] + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: download bindings + uses: actions/download-artifact@v4 + with: + path: ./lib/src/ + name: cache-bindings + + - name: download android binaries x86_64 + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/x86_64 + name: cache-android-x86_64 + + - name: download android binaries arm64-v8a + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/arm64-v8a + name: cache-android-arm64-v8a + + - name: download android binaries x86 + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/x86 + name: cache-android-x86 + + - name: download android binaries armeabi-v7a + uses: actions/download-artifact@v4 + with: + path: ./android/src/main/jniLibs/armeabi-v7a + name: cache-android-armeabi-v7a + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + + - name: Prepare integration test app + shell: bash + run: | + set -euo pipefail + + test_app="$RUNNER_TEMP/git2dart_mobile_test" + flutter create --platforms=android --org com.dartgit "$test_app" + + TEST_APP="$test_app" ruby <<'RUBY' + require 'yaml' + + pubspec_path = File.join(ENV.fetch('TEST_APP'), 'pubspec.yaml') + pubspec = YAML.load_file(pubspec_path) + pubspec['dependencies'] ||= {} + pubspec['dependencies']['git2dart_binaries'] = { + 'path' => ENV.fetch('GITHUB_WORKSPACE') + } + pubspec['dev_dependencies'] ||= {} + pubspec['dev_dependencies']['flutter_test'] = {'sdk' => 'flutter'} + pubspec['dev_dependencies']['integration_test'] = {'sdk' => 'flutter'} + File.write(pubspec_path, pubspec.to_yaml) + RUBY + + mkdir -p "$test_app/test" "$test_app/integration_test" + cp "$GITHUB_WORKSPACE/test/opts_bindings_integration_test.dart" "$test_app/test/" + cp "$GITHUB_WORKSPACE/integration_test/opts_bindings_integration_test.dart" "$test_app/integration_test/" + + cd "$test_app" + flutter pub get + + - name: Run Android integration tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 34 + arch: x86_64 + target: google_apis + disable-animations: true + script: | + cd "$RUNNER_TEMP/git2dart_mobile_test" + flutter devices + flutter test integration_test/opts_bindings_integration_test.dart -d emulator-5554 -r expanded + publish_package: if: ${{ github.actor != 'nektos/act' }} - needs: [run_tests] + needs: [run_tests, run_ios_tests, run_android_tests] runs-on: ubuntu-latest steps: - name: Check out repository diff --git a/integration_test/opts_bindings_integration_test.dart b/integration_test/opts_bindings_integration_test.dart new file mode 100644 index 0000000..616304e --- /dev/null +++ b/integration_test/opts_bindings_integration_test.dart @@ -0,0 +1,8 @@ +import 'package:integration_test/integration_test.dart'; + +import '../test/opts_bindings_integration_test.dart' as opts_bindings; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + opts_bindings.main(); +} diff --git a/pubspec.yaml b/pubspec.yaml index aeaedbc..22947a8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,6 +18,10 @@ dependencies: dev_dependencies: ffigen: ^18.1.0 + flutter_test: + sdk: flutter + integration_test: + sdk: flutter lints: ^5.1.1 test: ^1.26.2 diff --git a/test/opts_bindings_integration_test.dart b/test/opts_bindings_integration_test.dart index 34add34..a6f2ab5 100644 --- a/test/opts_bindings_integration_test.dart +++ b/test/opts_bindings_integration_test.dart @@ -1,10 +1,10 @@ import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'package:git2dart_binaries/src/bindings.dart'; import 'package:git2dart_binaries/src/extensions.dart'; import 'package:git2dart_binaries/src/util.dart'; -import 'package:test/test.dart'; void main() { group('Memory Window Integration Tests', () { From 88d17f6f436f96241884306efcea9e2356e3458a Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 13:28:42 +0700 Subject: [PATCH 14/27] Fix iOS test app library search paths --- ios/git2dart_binaries.podspec | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ios/git2dart_binaries.podspec b/ios/git2dart_binaries.podspec index a63510e..7939ab5 100644 --- a/ios/git2dart_binaries.podspec +++ b/ios/git2dart_binaries.podspec @@ -24,6 +24,26 @@ Dart bindings to libgit2. s.libraries = ['z', 'iconv'] s.platform = :ios, '12.0' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + binary_root = '$(PODS_ROOT)/../.symlinks/plugins/git2dart_binaries/ios' + device_library_search_paths = [ + '$(inherited)', + "#{binary_root}/libcrypto.xcframework/ios-arm64", + "#{binary_root}/libssl.xcframework/ios-arm64", + "#{binary_root}/libssh2.xcframework/ios-arm64", + "#{binary_root}/libgit2.xcframework/ios-arm64" + ].map { |path| "\"#{path}\"" }.join(' ') + simulator_library_search_paths = [ + '$(inherited)', + "#{binary_root}/libcrypto.xcframework/ios-arm64-simulator", + "#{binary_root}/libssl.xcframework/ios-arm64-simulator", + "#{binary_root}/libssh2.xcframework/ios-arm64-simulator", + "#{binary_root}/libgit2.xcframework/ios-arm64-simulator" + ].map { |path| "\"#{path}\"" }.join(' ') + binary_xcconfig = { + 'LIBRARY_SEARCH_PATHS[sdk=iphoneos*]' => device_library_search_paths, + 'LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]' => simulator_library_search_paths + } + s.pod_target_xcconfig = binary_xcconfig.merge({ 'DEFINES_MODULE' => 'YES' }) + s.user_target_xcconfig = binary_xcconfig s.swift_version = '5.0' end From 3c07c08623229eef9667aa72a80a05ab14d272fa Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 13:32:42 +0700 Subject: [PATCH 15/27] Fix Android integration test working directory --- .github/workflows/build_package.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 5426a19..d7be102 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -361,9 +361,8 @@ jobs: target: google_apis disable-animations: true script: | - cd "$RUNNER_TEMP/git2dart_mobile_test" - flutter devices - flutter test integration_test/opts_bindings_integration_test.dart -d emulator-5554 -r expanded + cd "$RUNNER_TEMP/git2dart_mobile_test" && flutter devices + cd "$RUNNER_TEMP/git2dart_mobile_test" && flutter test integration_test/opts_bindings_integration_test.dart -d emulator-5554 -r expanded publish_package: if: ${{ github.actor != 'nektos/act' }} From e2f155c80d8eaa02a0be9a82aca399ad82a48e9a Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 13:34:36 +0700 Subject: [PATCH 16/27] Run only iOS build and tests --- .github/workflows/build_package.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index d7be102..eb56212 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -29,6 +29,7 @@ jobs: libgit2_version: ${{ env.LIBGIT2_VERSION }} build_libgit2_linux: + if: false runs-on: ubuntu-latest steps: - name: Check out repository @@ -41,6 +42,7 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_macos: + if: false runs-on: macos-latest steps: - name: Check out repository @@ -130,6 +132,7 @@ jobs: path: /tmp/git2dart-ios/export/** build_libgit2_windows: + if: false runs-on: windows-latest steps: - name: Check out repository @@ -142,6 +145,7 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_android: + if: false runs-on: ubuntu-latest strategy: matrix: @@ -159,6 +163,7 @@ jobs: openssl_version: ${{ env.OPENSSL_VERSION }} run_tests: + if: false needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, assemble_libgit2_ios, build_libgit2_windows, build_libgit2_android] # needs: [generate_bindings, build_libgit2_android] runs-on: ${{ matrix.os }} @@ -284,6 +289,7 @@ jobs: flutter test integration_test/opts_bindings_integration_test.dart -d "$device_id" -r expanded run_android_tests: + if: false needs: [generate_bindings, build_libgit2_android] runs-on: ubuntu-latest steps: @@ -365,7 +371,7 @@ jobs: cd "$RUNNER_TEMP/git2dart_mobile_test" && flutter test integration_test/opts_bindings_integration_test.dart -d emulator-5554 -r expanded publish_package: - if: ${{ github.actor != 'nektos/act' }} + if: false needs: [run_tests, run_ios_tests, run_android_tests] runs-on: ubuntu-latest steps: From a39fa0270b049a30ce3fa474e1349080213b11d7 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 14:36:19 +0700 Subject: [PATCH 17/27] Fix iOS integration test hang diagnostics --- .github/workflows/build_package.yml | 14 +++++++++++++ test/opts_bindings_integration_test.dart | 26 ++++++++---------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index eb56212..c9faed4 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -218,6 +218,7 @@ jobs: run_ios_tests: needs: [generate_bindings, assemble_libgit2_ios] runs-on: macos-latest + timeout-minutes: 25 steps: - name: Check out repository uses: actions/checkout@v4 @@ -268,6 +269,7 @@ jobs: flutter pub get - name: Run iOS integration tests + timeout-minutes: 15 shell: bash run: | set -euo pipefail @@ -288,6 +290,18 @@ jobs: flutter devices flutter test integration_test/opts_bindings_integration_test.dart -d "$device_id" -r expanded + - name: Dump iOS simulator logs + if: ${{ failure() || cancelled() }} + shell: bash + run: | + set -euo pipefail + + xcrun simctl spawn booted log show \ + --style compact \ + --last 10m \ + --predicate 'process == "Runner" OR eventMessage CONTAINS[c] "Runner" OR eventMessage CONTAINS[c] "git2dart" OR eventMessage CONTAINS[c] "libgit2" OR eventMessage CONTAINS[c] "dyld"' \ + || true + run_android_tests: if: false needs: [generate_bindings, build_libgit2_android] diff --git a/test/opts_bindings_integration_test.dart b/test/opts_bindings_integration_test.dart index a6f2ab5..a142563 100644 --- a/test/opts_bindings_integration_test.dart +++ b/test/opts_bindings_integration_test.dart @@ -7,6 +7,10 @@ import 'package:git2dart_binaries/src/extensions.dart'; import 'package:git2dart_binaries/src/util.dart'; void main() { + tearDownAll(() { + libgit2.git_libgit2_shutdown(); + }); + group('Memory Window Integration Tests', () { test('get and set mwindow size', () { final size = calloc(); @@ -191,9 +195,7 @@ void main() { expect(libgit2Opts.git_libgit2_opts_get_search_path(2, buf), equals(0)); // Cleanup - if (buf.ref.ptr != ffi.nullptr) { - calloc.free(buf.ref.ptr); - } + libgit2.git_buf_dispose(buf); calloc.free(buf); calloc.free(testPath); }); @@ -214,9 +216,7 @@ void main() { ); // Set new user agent - final newAgent = calloc(); - final agentStr = 'git2dart-test/1.0'; - newAgent.value = agentStr.codeUnitAt(0); + final newAgent = 'git2dart-test/1.0'.toNativeUtf8().cast(); expect( libgit2Opts.git_libgit2_opts_set_user_agent(newAgent), @@ -232,9 +232,7 @@ void main() { ); // Cleanup - if (buf.ref.ptr != ffi.nullptr) { - calloc.free(buf.ref.ptr); - } + libgit2.git_buf_dispose(buf); calloc.free(buf); calloc.free(newAgent); }); @@ -335,15 +333,7 @@ void main() { ); // Cleanup - if (extensions.ref.strings != ffi.nullptr) { - for (var i = 0; i < extensions.ref.count; i++) { - final strPtr = extensions.ref.strings + i; - if (strPtr.value != ffi.nullptr) { - calloc.free(strPtr.value); - } - } - calloc.free(extensions.ref.strings); - } + libgit2.git_strarray_dispose(extensions); calloc.free(extensions); }); }); From 6b38fcfcb4d526a722a8b5673374ac7264bcf33a Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 14:55:14 +0700 Subject: [PATCH 18/27] Force load libgit2 for iOS FFI tests --- ios/git2dart_binaries.podspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ios/git2dart_binaries.podspec b/ios/git2dart_binaries.podspec index 7939ab5..421d981 100644 --- a/ios/git2dart_binaries.podspec +++ b/ios/git2dart_binaries.podspec @@ -41,7 +41,9 @@ Dart bindings to libgit2. ].map { |path| "\"#{path}\"" }.join(' ') binary_xcconfig = { 'LIBRARY_SEARCH_PATHS[sdk=iphoneos*]' => device_library_search_paths, - 'LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]' => simulator_library_search_paths + 'LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]' => simulator_library_search_paths, + 'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -force_load "$(PODS_ROOT)/../.symlinks/plugins/git2dart_binaries/ios/libgit2.xcframework/ios-arm64/libgit2.a"', + 'OTHER_LDFLAGS[sdk=iphonesimulator*]' => '$(inherited) -force_load "$(PODS_ROOT)/../.symlinks/plugins/git2dart_binaries/ios/libgit2.xcframework/ios-arm64-simulator/libgit2.a"' } s.pod_target_xcconfig = binary_xcconfig.merge({ 'DEFINES_MODULE' => 'YES' }) s.user_target_xcconfig = binary_xcconfig From c1667a7877d4b9a50449b1a41a75f708b4e06edb Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 15:24:20 +0700 Subject: [PATCH 19/27] Add iOS libgit2 smoke diagnostics --- .github/workflows/build_package.yml | 3 +- integration_test/libgit2_ios_smoke_test.dart | 38 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 integration_test/libgit2_ios_smoke_test.dart diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index c9faed4..7c3919b 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -263,7 +263,7 @@ jobs: mkdir -p "$test_app/test" "$test_app/integration_test" cp "$GITHUB_WORKSPACE/test/opts_bindings_integration_test.dart" "$test_app/test/" - cp "$GITHUB_WORKSPACE/integration_test/opts_bindings_integration_test.dart" "$test_app/integration_test/" + cp "$GITHUB_WORKSPACE/integration_test/"*.dart "$test_app/integration_test/" cd "$test_app" flutter pub get @@ -288,6 +288,7 @@ jobs: cd "$test_app" flutter devices + flutter test integration_test/libgit2_ios_smoke_test.dart -d "$device_id" -r expanded flutter test integration_test/opts_bindings_integration_test.dart -d "$device_id" -r expanded - name: Dump iOS simulator logs diff --git a/integration_test/libgit2_ios_smoke_test.dart b/integration_test/libgit2_ios_smoke_test.dart new file mode 100644 index 0000000..4dd9b23 --- /dev/null +++ b/integration_test/libgit2_ios_smoke_test.dart @@ -0,0 +1,38 @@ +import 'dart:ffi' as ffi; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; + +typedef _GitLibgit2InitNative = ffi.Int Function(); +typedef _GitLibgit2InitDart = int Function(); + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + testWidgets('libgit2 initializes from process symbols', (_) async { + // Keep these prints explicit so CI logs show exactly where an iOS launch + // hang happens before the full FFI test suite is loaded. + print('git2dart ios smoke: opening process library'); + final library = ffi.DynamicLibrary.process(); + + print('git2dart ios smoke: looking up git_libgit2_init'); + final init = library.lookupFunction<_GitLibgit2InitNative, _GitLibgit2InitDart>( + 'git_libgit2_init', + ); + + print('git2dart ios smoke: looking up git_libgit2_shutdown'); + final shutdown = + library.lookupFunction<_GitLibgit2InitNative, _GitLibgit2InitDart>( + 'git_libgit2_shutdown', + ); + + print('git2dart ios smoke: calling git_libgit2_init'); + final initResult = init(); + print('git2dart ios smoke: git_libgit2_init returned $initResult'); + + expect(initResult, greaterThan(0)); + + final shutdownResult = shutdown(); + print('git2dart ios smoke: git_libgit2_shutdown returned $shutdownResult'); + }); +} From 3c8ab51648117a3834e95badd13780e2be5838da Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 15:43:31 +0700 Subject: [PATCH 20/27] Run iOS integration tests with flutter drive --- .github/workflows/build_package.yml | 34 ++++++++++++++++++++++++++--- test_driver/integration_test.dart | 3 +++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 test_driver/integration_test.dart diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 7c3919b..ce8aeed 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -261,9 +261,10 @@ jobs: File.write(pubspec_path, pubspec.to_yaml) RUBY - mkdir -p "$test_app/test" "$test_app/integration_test" + mkdir -p "$test_app/test" "$test_app/integration_test" "$test_app/test_driver" cp "$GITHUB_WORKSPACE/test/opts_bindings_integration_test.dart" "$test_app/test/" cp "$GITHUB_WORKSPACE/integration_test/"*.dart "$test_app/integration_test/" + cp "$GITHUB_WORKSPACE/test_driver/integration_test.dart" "$test_app/test_driver/" cd "$test_app" flutter pub get @@ -288,8 +289,35 @@ jobs: cd "$test_app" flutter devices - flutter test integration_test/libgit2_ios_smoke_test.dart -d "$device_id" -r expanded - flutter test integration_test/opts_bindings_integration_test.dart -d "$device_id" -r expanded + + run_with_timeout() { + local seconds="$1" + shift + ruby -e ' + require "timeout" + + seconds = Integer(ARGV.shift) + command = ARGV + Timeout.timeout(seconds) do + system(*command) + exit($?.exitstatus || 1) + end + rescue Timeout::Error + warn "::error::Timed out after #{seconds}s: #{command.join(" ")}" + exit 124 + end + ' "$seconds" "$@" + } + + run_with_timeout 900 flutter drive \ + -d "$device_id" \ + --driver=test_driver/integration_test.dart \ + --target=integration_test/libgit2_ios_smoke_test.dart + + run_with_timeout 900 flutter drive \ + -d "$device_id" \ + --driver=test_driver/integration_test.dart \ + --target=integration_test/opts_bindings_integration_test.dart - name: Dump iOS simulator logs if: ${{ failure() || cancelled() }} diff --git a/test_driver/integration_test.dart b/test_driver/integration_test.dart new file mode 100644 index 0000000..b38629c --- /dev/null +++ b/test_driver/integration_test.dart @@ -0,0 +1,3 @@ +import 'package:integration_test/integration_test_driver.dart'; + +Future main() => integrationDriver(); From 8c48e8a384042f413c9d10a7b071eb726947a085 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 15:57:25 +0700 Subject: [PATCH 21/27] Upload iOS test command logs --- .github/workflows/build_package.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index ce8aeed..3af0f2d 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -289,6 +289,7 @@ jobs: cd "$test_app" flutter devices + mkdir -p "$RUNNER_TEMP/git2dart-ios-test-logs" run_with_timeout() { local seconds="$1" @@ -309,16 +310,37 @@ jobs: ' "$seconds" "$@" } - run_with_timeout 900 flutter drive \ + run_logged() { + local name="$1" + shift + local log_file="$RUNNER_TEMP/git2dart-ios-test-logs/$name.log" + + set +e + "$@" 2>&1 | tee "$log_file" + local status="${PIPESTATUS[0]}" + set -e + + return "$status" + } + + run_logged smoke run_with_timeout 900 flutter drive \ -d "$device_id" \ --driver=test_driver/integration_test.dart \ --target=integration_test/libgit2_ios_smoke_test.dart - run_with_timeout 900 flutter drive \ + run_logged opts run_with_timeout 900 flutter drive \ -d "$device_id" \ --driver=test_driver/integration_test.dart \ --target=integration_test/opts_bindings_integration_test.dart + - name: Upload iOS test logs + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: ios-test-logs + path: ${{ runner.temp }}/git2dart-ios-test-logs/*.log + if-no-files-found: ignore + - name: Dump iOS simulator logs if: ${{ failure() || cancelled() }} shell: bash From 54fc73d996bd51b327069696f37b6770160fc8ea Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 16:08:19 +0700 Subject: [PATCH 22/27] Fix iOS test timeout wrapper --- .github/workflows/build_package.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 3af0f2d..0d1a664 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -299,14 +299,15 @@ jobs: seconds = Integer(ARGV.shift) command = ARGV - Timeout.timeout(seconds) do - system(*command) - exit($?.exitstatus || 1) + begin + Timeout.timeout(seconds) do + system(*command) + exit($?.exitstatus || 1) + end + rescue Timeout::Error + warn "::error::Timed out after #{seconds}s: #{command.join(" ")}" + exit 124 end - rescue Timeout::Error - warn "::error::Timed out after #{seconds}s: #{command.join(" ")}" - exit 124 - end ' "$seconds" "$@" } From a1eb122797b660cdc359cb327e0377992f5b4794 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 16:23:23 +0700 Subject: [PATCH 23/27] Remove iOS test diagnostics --- .github/workflows/build_package.yml | 41 +------------------- integration_test/libgit2_ios_smoke_test.dart | 38 ------------------ 2 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 integration_test/libgit2_ios_smoke_test.dart diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 0d1a664..a80133b 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -289,7 +289,6 @@ jobs: cd "$test_app" flutter devices - mkdir -p "$RUNNER_TEMP/git2dart-ios-test-logs" run_with_timeout() { local seconds="$1" @@ -311,49 +310,11 @@ jobs: ' "$seconds" "$@" } - run_logged() { - local name="$1" - shift - local log_file="$RUNNER_TEMP/git2dart-ios-test-logs/$name.log" - - set +e - "$@" 2>&1 | tee "$log_file" - local status="${PIPESTATUS[0]}" - set -e - - return "$status" - } - - run_logged smoke run_with_timeout 900 flutter drive \ - -d "$device_id" \ - --driver=test_driver/integration_test.dart \ - --target=integration_test/libgit2_ios_smoke_test.dart - - run_logged opts run_with_timeout 900 flutter drive \ + run_with_timeout 900 flutter drive \ -d "$device_id" \ --driver=test_driver/integration_test.dart \ --target=integration_test/opts_bindings_integration_test.dart - - name: Upload iOS test logs - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: ios-test-logs - path: ${{ runner.temp }}/git2dart-ios-test-logs/*.log - if-no-files-found: ignore - - - name: Dump iOS simulator logs - if: ${{ failure() || cancelled() }} - shell: bash - run: | - set -euo pipefail - - xcrun simctl spawn booted log show \ - --style compact \ - --last 10m \ - --predicate 'process == "Runner" OR eventMessage CONTAINS[c] "Runner" OR eventMessage CONTAINS[c] "git2dart" OR eventMessage CONTAINS[c] "libgit2" OR eventMessage CONTAINS[c] "dyld"' \ - || true - run_android_tests: if: false needs: [generate_bindings, build_libgit2_android] diff --git a/integration_test/libgit2_ios_smoke_test.dart b/integration_test/libgit2_ios_smoke_test.dart deleted file mode 100644 index 4dd9b23..0000000 --- a/integration_test/libgit2_ios_smoke_test.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'dart:ffi' as ffi; - -import 'package:flutter_test/flutter_test.dart'; -import 'package:integration_test/integration_test.dart'; - -typedef _GitLibgit2InitNative = ffi.Int Function(); -typedef _GitLibgit2InitDart = int Function(); - -void main() { - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - - testWidgets('libgit2 initializes from process symbols', (_) async { - // Keep these prints explicit so CI logs show exactly where an iOS launch - // hang happens before the full FFI test suite is loaded. - print('git2dart ios smoke: opening process library'); - final library = ffi.DynamicLibrary.process(); - - print('git2dart ios smoke: looking up git_libgit2_init'); - final init = library.lookupFunction<_GitLibgit2InitNative, _GitLibgit2InitDart>( - 'git_libgit2_init', - ); - - print('git2dart ios smoke: looking up git_libgit2_shutdown'); - final shutdown = - library.lookupFunction<_GitLibgit2InitNative, _GitLibgit2InitDart>( - 'git_libgit2_shutdown', - ); - - print('git2dart ios smoke: calling git_libgit2_init'); - final initResult = init(); - print('git2dart ios smoke: git_libgit2_init returned $initResult'); - - expect(initResult, greaterThan(0)); - - final shutdownResult = shutdown(); - print('git2dart ios smoke: git_libgit2_shutdown returned $shutdownResult'); - }); -} From 0513419ad54f4fccd6aa4833539610e9dfb6d267 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 16:33:46 +0700 Subject: [PATCH 24/27] Run Android build and test jobs --- .github/workflows/build_package.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index a80133b..d679fdb 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -55,6 +55,7 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_ios: + if: false runs-on: macos-latest strategy: fail-fast: false @@ -84,6 +85,7 @@ jobs: artifact_name: cache-ios-${{ matrix.slice }} assemble_libgit2_ios: + if: false needs: [build_libgit2_ios] runs-on: macos-latest steps: @@ -145,7 +147,6 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_android: - if: false runs-on: ubuntu-latest strategy: matrix: @@ -216,6 +217,7 @@ jobs: - run: flutter test -r expanded run_ios_tests: + if: false needs: [generate_bindings, assemble_libgit2_ios] runs-on: macos-latest timeout-minutes: 25 @@ -316,7 +318,6 @@ jobs: --target=integration_test/opts_bindings_integration_test.dart run_android_tests: - if: false needs: [generate_bindings, build_libgit2_android] runs-on: ubuntu-latest steps: From ac4fa836fc05548851a1e393da96cea665e173a8 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 16:56:09 +0700 Subject: [PATCH 25/27] Use lighter Android emulator for tests --- .github/workflows/build_package.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index d679fdb..e683170 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -390,10 +390,11 @@ jobs: - name: Run Android integration tests uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 34 + api-level: 29 arch: x86_64 - target: google_apis + target: default disable-animations: true + emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none script: | cd "$RUNNER_TEMP/git2dart_mobile_test" && flutter devices cd "$RUNNER_TEMP/git2dart_mobile_test" && flutter test integration_test/opts_bindings_integration_test.dart -d emulator-5554 -r expanded From 93e0e027521090de33997974547610ee95f93329 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 19:12:04 +0700 Subject: [PATCH 26/27] Enable all build workflow jobs --- .github/workflows/build_package.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index e683170..df79e08 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -29,7 +29,6 @@ jobs: libgit2_version: ${{ env.LIBGIT2_VERSION }} build_libgit2_linux: - if: false runs-on: ubuntu-latest steps: - name: Check out repository @@ -42,7 +41,6 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_macos: - if: false runs-on: macos-latest steps: - name: Check out repository @@ -55,7 +53,6 @@ jobs: libssh2_version: ${{ env.LIBSSH2_VERSION }} build_libgit2_ios: - if: false runs-on: macos-latest strategy: fail-fast: false @@ -85,7 +82,6 @@ jobs: artifact_name: cache-ios-${{ matrix.slice }} assemble_libgit2_ios: - if: false needs: [build_libgit2_ios] runs-on: macos-latest steps: @@ -134,7 +130,6 @@ jobs: path: /tmp/git2dart-ios/export/** build_libgit2_windows: - if: false runs-on: windows-latest steps: - name: Check out repository @@ -164,7 +159,6 @@ jobs: openssl_version: ${{ env.OPENSSL_VERSION }} run_tests: - if: false needs: [generate_bindings, build_libgit2_linux, build_libgit2_macos, assemble_libgit2_ios, build_libgit2_windows, build_libgit2_android] # needs: [generate_bindings, build_libgit2_android] runs-on: ${{ matrix.os }} @@ -217,7 +211,6 @@ jobs: - run: flutter test -r expanded run_ios_tests: - if: false needs: [generate_bindings, assemble_libgit2_ios] runs-on: macos-latest timeout-minutes: 25 @@ -400,7 +393,6 @@ jobs: cd "$RUNNER_TEMP/git2dart_mobile_test" && flutter test integration_test/opts_bindings_integration_test.dart -d emulator-5554 -r expanded publish_package: - if: false needs: [run_tests, run_ios_tests, run_android_tests] runs-on: ubuntu-latest steps: From fd250f44d17319f9df98b2a4545b4d7ecfcb21b8 Mon Sep 17 00:00:00 2001 From: Viktor Borisov Date: Sat, 30 May 2026 21:50:57 +0700 Subject: [PATCH 27/27] Bump package version to 1.11.0 --- CHANGELOG.md | 9 +++++++++ ios/git2dart_binaries.podspec | 2 +- macos/git2dart_binaries.podspec | 2 +- pubspec.yaml | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9439c7..93491b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.11.0] - 2026-05-30 +### Added +- Added iOS package support with generated XCFramework artifacts and CI integration tests. +- Added Android build coverage for `armeabi-v7a`, `arm64-v8a`, `x86`, and `x86_64`. + +### Changed +- Updated bundled libgit2 builds to `1.9.4`. +- Re-enabled the full platform build workflow across Linux, macOS, Windows, iOS, and Android. + ## [1.10.4] - 2026-05-29 ### Fixed - macOS: vendored `libgit2.dylib` filename didn't match its diff --git a/ios/git2dart_binaries.podspec b/ios/git2dart_binaries.podspec index 421d981..3177b4f 100644 --- a/ios/git2dart_binaries.podspec +++ b/ios/git2dart_binaries.podspec @@ -3,7 +3,7 @@ # Pod::Spec.new do |s| s.name = 'git2dart_binaries' - s.version = '1.10.4' + s.version = '1.11.0' s.summary = 'Dart bindings to libgit2.' s.description = <<-DESC Dart bindings to libgit2. diff --git a/macos/git2dart_binaries.podspec b/macos/git2dart_binaries.podspec index 975e714..a29cd69 100644 --- a/macos/git2dart_binaries.podspec +++ b/macos/git2dart_binaries.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'git2dart_binaries' - s.version = '1.9.0' + s.version = '1.11.0' s.summary = 'Dart bindings to libgit2.' s.description = <<-DESC Dart bindings to libgit2. diff --git a/pubspec.yaml b/pubspec.yaml index 22947a8..201f113 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: git2dart_binaries description: Dart bindings to libgit2, provides ability to use libgit2 library in Dart and Flutter. -version: 1.10.4 +version: 1.11.0 repository: https://github.com/DartGit-dev/git2dart_binaries environment: