Build monero_c #7
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:bookworm | |
| 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:bookworm | |
| 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:bookworm | |
| 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:bookworm | |
| 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-x86_64-w64-mingw32: | |
| name: Build x86_64-w64-mingw32 | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:bookworm | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build monero_c | |
| env: | |
| TARGET_ARCH: x86_64-w64-mingw32 | |
| run: scripts/build-moneroc.sh | |
| - name: Copy built libraries | |
| run: | | |
| mkdir -p artifacts | |
| cp monero_c/monero_libwallet2_api_c/build/x86_64-w64-mingw32/libwallet2_api_c.dll artifacts/monero_libwallet2_api_c.dll | |
| cp monero_c/release/monero/x86_64-w64-mingw32_libwinpthread-1.dll artifacts/libwinpthread-1.dll | |
| cp monero_c/release/monero/x86_64-w64-mingw32_libssp-0.dll artifacts/libssp-0.dll | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: x86_64-w64-mingw32 | |
| path: artifacts/ | |
| build-ios-targets: | |
| name: Build ${{ matrix.target }} | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| target: | |
| - aarch64-apple-ios | |
| - aarch64-apple-iossimulator | |
| 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 ${{ matrix.target }} | |
| run: | | |
| ./build_single.sh monero ${{ matrix.target }} -j$(sysctl -n hw.logicalcpu) | |
| - name: Upload built library | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: monero_libwallet2_api_c/build/${{ matrix.target }}/libwallet2_api_c.dylib | |
| create-ios-xcframework: | |
| name: Create iOS XCFramework | |
| runs-on: macos-15 | |
| needs: build-ios-targets | |
| steps: | |
| - name: Download aarch64-apple-ios artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: aarch64-apple-ios | |
| path: device-lib | |
| - name: Download aarch64-apple-iossimulator artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: aarch64-apple-iossimulator | |
| path: simulator-lib | |
| - name: Create XCFramework | |
| run: | | |
| # Create framework directories | |
| mkdir -p device/MoneroWallet.framework | |
| mkdir -p simulator/MoneroWallet.framework | |
| # Copy binaries | |
| cp device-lib/libwallet2_api_c.dylib device/MoneroWallet.framework/MoneroWallet | |
| cp simulator-lib/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 device-lib simulator-lib | |
| - 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-x86_64-w64-mingw32 | |
| - create-ios-xcframework | |
| 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: Download x86_64-w64-mingw32 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: x86_64-w64-mingw32 | |
| path: artifacts/x86_64-w64-mingw32 | |
| - 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 | |
| # Windows x86_64 | |
| cp artifacts/x86_64-w64-mingw32/monero_libwallet2_api_c.dll windows/monero_libwallet2_api_c.dll | |
| cp artifacts/x86_64-w64-mingw32/libwinpthread-1.dll windows/libwinpthread-1.dll | |
| cp artifacts/x86_64-w64-mingw32/libssp-0.dll windows/libssp-0.dll | |
| - 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) | |
| - `windows/monero_libwallet2_api_c.dll` (x86_64-w64-mingw32) | |
| - `windows/libwinpthread-1.dll` (x86_64-w64-mingw32) | |
| - `windows/libssp-0.dll` (x86_64-w64-mingw32) | |
| - `ios/Frameworks/MoneroWallet.xcframework` (aarch64-apple-ios + aarch64-apple-iossimulator) | |
| Built from [monero_c](https://github.com/vtnerd/monero_c) branch `lwsf`. | |
| branch: update-moneroc-libs | |
| delete-branch: true | |
| reviewers: SamsungGalaxyPlayer,Keeqler |