Build monero_c #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build monero_c | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| build-x86_64-linux-gnu: | |
| name: Build x86_64-linux-gnu | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:bullseye | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build monero_c | |
| env: | |
| TARGET_ARCH: x86_64-linux-gnu | |
| run: scripts/build-moneroc.sh | |
| - name: Copy built library | |
| run: | | |
| mkdir -p artifacts | |
| cp monero_c/monero_libwallet2_api_c/build/x86_64-linux-gnu/libwallet2_api_c.so artifacts/monero_libwallet2_api_c.so | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: x86_64-linux-gnu | |
| path: artifacts/monero_libwallet2_api_c.so | |
| build-x86_64-linux-android: | |
| name: Build x86_64-linux-android | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:bullseye | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build monero_c | |
| env: | |
| TARGET_ARCH: x86_64-linux-android | |
| run: scripts/build-moneroc.sh | |
| - name: Copy built library | |
| run: | | |
| mkdir -p artifacts | |
| cp monero_c/monero_libwallet2_api_c/build/x86_64-linux-android/libwallet2_api_c.so artifacts/libmonero_libwallet2_api_c.so | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: x86_64-linux-android | |
| path: artifacts/libmonero_libwallet2_api_c.so | |
| build-aarch64-linux-android: | |
| name: Build aarch64-linux-android | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:bullseye | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build monero_c | |
| env: | |
| TARGET_ARCH: aarch64-linux-android | |
| run: scripts/build-moneroc.sh | |
| - name: Copy built library | |
| run: | | |
| mkdir -p artifacts | |
| cp monero_c/monero_libwallet2_api_c/build/aarch64-linux-android/libwallet2_api_c.so artifacts/libmonero_libwallet2_api_c.so | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: aarch64-linux-android | |
| path: artifacts/libmonero_libwallet2_api_c.so | |
| build-armv7a-linux-androideabi: | |
| name: Build armv7a-linux-androideabi | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:bullseye | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build monero_c | |
| env: | |
| TARGET_ARCH: armv7a-linux-androideabi | |
| run: scripts/build-moneroc.sh | |
| - name: Copy built library | |
| run: | | |
| mkdir -p artifacts | |
| cp monero_c/monero_libwallet2_api_c/build/armv7a-linux-androideabi/libwallet2_api_c.so artifacts/libmonero_libwallet2_api_c.so | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: armv7a-linux-androideabi | |
| path: artifacts/libmonero_libwallet2_api_c.so | |
| build-arm64-apple-ios: | |
| name: Build arm64-apple-ios and arm64-apple-iossimulator | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout monero_c repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: vtnerd/monero_c | |
| ref: lwsf | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '16.2' | |
| - name: Install dependencies | |
| run: | | |
| brew install ccache cmake autoconf automake libtool | |
| - name: Patch sources | |
| run: | | |
| git config --global --add safe.directory '*' | |
| git config --global user.email "ci@mrcyjanek.net" | |
| git config --global user.name "CI mrcyjanek.net" | |
| ./apply_patches.sh monero | |
| - name: Build monero_c for arm64-apple-ios | |
| run: | | |
| ./build_single.sh monero arm64-apple-ios -j$(sysctl -n hw.logicalcpu) | |
| - name: Build monero_c for arm64-apple-iossimulator | |
| run: | | |
| ./build_single.sh monero arm64-apple-iossimulator -j$(sysctl -n hw.logicalcpu) | |
| - name: Create XCFramework | |
| run: | | |
| # Create framework directories | |
| mkdir -p device/MoneroWallet.framework | |
| mkdir -p simulator/MoneroWallet.framework | |
| # Copy binaries | |
| cp monero_c/monero_libwallet2_api_c/build/arm64-apple-ios/libwallet2_api_c.dylib device/MoneroWallet.framework/MoneroWallet | |
| cp monero_c/monero_libwallet2_api_c/build/arm64-apple-iossimulator/libwallet2_api_c.dylib simulator/MoneroWallet.framework/MoneroWallet | |
| # Create Info.plist for both | |
| cat > device/MoneroWallet.framework/Info.plist << 'EOF' | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleExecutable</key> | |
| <string>MoneroWallet</string> | |
| <key>CFBundleIdentifier</key> | |
| <string>com.skylight.MoneroWallet</string> | |
| <key>CFBundleName</key> | |
| <string>MoneroWallet</string> | |
| <key>CFBundlePackageType</key> | |
| <string>FMWK</string> | |
| <key>CFBundleVersion</key> | |
| <string>1.0</string> | |
| <key>MinimumOSVersion</key> | |
| <string>15.0</string> | |
| </dict> | |
| </plist> | |
| EOF | |
| cp device/MoneroWallet.framework/Info.plist simulator/MoneroWallet.framework/Info.plist | |
| # Fix install names | |
| install_name_tool -id @rpath/MoneroWallet.framework/MoneroWallet device/MoneroWallet.framework/MoneroWallet | |
| install_name_tool -id @rpath/MoneroWallet.framework/MoneroWallet simulator/MoneroWallet.framework/MoneroWallet | |
| # Sign frameworks | |
| codesign --force --sign - device/MoneroWallet.framework | |
| codesign --force --sign - simulator/MoneroWallet.framework | |
| # Create XCFramework | |
| xcodebuild -create-xcframework \ | |
| -framework device/MoneroWallet.framework \ | |
| -framework simulator/MoneroWallet.framework \ | |
| -output MoneroWallet.xcframework | |
| # Clean up temp directories | |
| rm -rf device simulator | |
| - name: Upload XCFramework artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MoneroWallet-xcframework | |
| path: MoneroWallet.xcframework | |
| create-pr: | |
| name: Create Pull Request | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-x86_64-linux-gnu | |
| - build-x86_64-linux-android | |
| - build-aarch64-linux-android | |
| - build-armv7a-linux-androideabi | |
| - build-arm64-apple-ios | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download x86_64-linux-gnu artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: x86_64-linux-gnu | |
| path: artifacts/x86_64-linux-gnu | |
| - name: Download x86_64-linux-android artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: x86_64-linux-android | |
| path: artifacts/x86_64-linux-android | |
| - name: Download aarch64-linux-android artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: aarch64-linux-android | |
| path: artifacts/aarch64-linux-android | |
| - name: Download armv7a-linux-androideabi artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: armv7a-linux-androideabi | |
| path: artifacts/armv7a-linux-androideabi | |
| - name: Download iOS XCFramework artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: MoneroWallet-xcframework | |
| path: artifacts/MoneroWallet.xcframework | |
| - name: Place libraries in correct locations | |
| run: | | |
| # Linux x86_64 | |
| cp artifacts/x86_64-linux-gnu/monero_libwallet2_api_c.so linux/monero_libwallet2_api_c.so | |
| # Android x86_64 | |
| cp artifacts/x86_64-linux-android/libmonero_libwallet2_api_c.so android/app/src/main/jniLibs/x86_64/libmonero_libwallet2_api_c.so | |
| # Android arm64-v8a | |
| cp artifacts/aarch64-linux-android/libmonero_libwallet2_api_c.so android/app/src/main/jniLibs/arm64-v8a/libmonero_libwallet2_api_c.so | |
| # Android armeabi-v7a | |
| cp artifacts/armv7a-linux-androideabi/libmonero_libwallet2_api_c.so android/app/src/main/jniLibs/armeabi-v7a/libmonero_libwallet2_api_c.so | |
| # iOS XCFramework - remove old and copy new | |
| rm -rf ios/Frameworks/MoneroWallet.xcframework | |
| cp -R artifacts/MoneroWallet.xcframework ios/Frameworks/MoneroWallet.xcframework | |
| - name: Fix Linux library executable stack | |
| run: scripts/fix-linux-moneroc-execstack.sh | |
| - name: Update pubspec.lock with monero_c commit hash | |
| run: | | |
| COMMIT_HASH=$(git ls-remote https://github.com/vtnerd/monero_c refs/heads/lwsf | cut -f1) | |
| sed -i "s/resolved-ref: \"[a-f0-9]*\"/resolved-ref: \"${COMMIT_HASH}\"/" pubspec.lock | |
| - name: Clean up artifacts | |
| run: rm -rf artifacts | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "Update monero_c libraries" | |
| title: "Update monero_c libraries" | |
| body: | | |
| This PR updates the monero_c libraries for all supported architectures: | |
| - `linux/monero_libwallet2_api_c.so` (x86_64-linux-gnu) | |
| - `android/app/src/main/jniLibs/x86_64/libmonero_libwallet2_api_c.so` (x86_64-linux-android) | |
| - `android/app/src/main/jniLibs/arm64-v8a/libmonero_libwallet2_api_c.so` (aarch64-linux-android) | |
| - `android/app/src/main/jniLibs/armeabi-v7a/libmonero_libwallet2_api_c.so` (armv7a-linux-androideabi) | |
| - `ios/Frameworks/MoneroWallet.xcframework` (arm64-apple-ios + arm64-apple-iossimulator) | |
| Built from [monero_c](https://github.com/vtnerd/monero_c) branch `lwsf`. | |
| branch: update-moneroc-libs | |
| delete-branch: true | |
| reviewers: SamsungGalaxyPlayer,Keeqler |