From a5e273aa250bf6e304747b324214da98542852e0 Mon Sep 17 00:00:00 2001 From: ethicnology Date: Tue, 17 Dec 2024 11:21:12 -0500 Subject: [PATCH] feat: precompiled binaries --- .github/workflows/precompiled_binaries.yml | 44 ++++++++++++++++++++++ cargokit/build_tool/lib/src/options.dart | 5 ++- rust/cargokit.yml | 13 +++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/precompiled_binaries.yml create mode 100644 rust/cargokit.yml diff --git a/.github/workflows/precompiled_binaries.yml b/.github/workflows/precompiled_binaries.yml new file mode 100644 index 0000000..35c5a24 --- /dev/null +++ b/.github/workflows/precompiled_binaries.yml @@ -0,0 +1,44 @@ +on: + push: + branches: [ trunk ] + +name: Precompile Binaries +jobs: + Precompile: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-20.04 + - macOS-latest + - windows-latest + steps: + - uses: actions/checkout@v4 + - uses: dart-lang/setup-dart@v1 + + - name: Install GTK + if: (matrix.os == 'ubuntu-latest') + run: sudo apt-get update && sudo apt-get install libgtk-3-dev + - name: Set up Android SDK + if: (matrix.os == 'ubuntu-20.04') + uses: android-actions/setup-android@v2 + + - name: Install Specific NDK + if: (matrix.os == 'ubuntu-20.04') + run: sdkmanager --install "ndk;24.0.8215888" + - name: Precompile + if: (matrix.os == 'macOS-latest') || (matrix.os == 'windows-latest') + run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=SatoshiPortal/lwk-dart + working-directory: cargokit/build_tool + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }} + + - name: Precompile (with Android) + if: (matrix.os == 'ubuntu-latest') + run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=SatoshiPortal/lwk-dart --android-sdk-location=/usr/local/lib/android/sdk --android-ndk-version=24.0.8215888 --android-min-sdk-version=23 + working-directory: cargokit/build_tool + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY } diff --git a/cargokit/build_tool/lib/src/options.dart b/cargokit/build_tool/lib/src/options.dart index 7937dca..b2c0f7a 100644 --- a/cargokit/build_tool/lib/src/options.dart +++ b/cargokit/build_tool/lib/src/options.dart @@ -298,7 +298,10 @@ class CargokitUserOptions { } userProjectDir = userProjectDir.parent; } - return CargokitUserOptions._(); + return CargokitUserOptions( + usePrecompiledBinaries: true, + verboseLogging: false, + ); } final bool usePrecompiledBinaries; diff --git a/rust/cargokit.yml b/rust/cargokit.yml new file mode 100644 index 0000000..d3c514d --- /dev/null +++ b/rust/cargokit.yml @@ -0,0 +1,13 @@ +cargo: + debug: + toolchain: stable + release: + toolchain: nightly + extra_flags: + - -Z + - build-std=panic_abort,std +precompiled_binaries: + # Uri prefix used when downloading precompiled binaries. + url_prefix: https://github.com/SatoshiPortal/lwk-dart/releases/download/precompiled_ + # Public key for verifying downloaded precompiled binaries. + public_key: \ No newline at end of file