diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index b17d728ab..dd4b9a4b9 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -7,7 +7,7 @@ concurrency: on: push: tags: - - 'v*.*.*' + - 'v*.*-test' env: GITHUB_REF: ${{ github.ref }} @@ -20,21 +20,13 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Determine full version or mocked version - run: | - if [[ "${{ github.ref }}" =~ ^v*.*.*.-mock$ ]]; then - echo "CARGO_FEATURES='--no-default-features --features mock-deps'" >> $GITHUB_ENV - else - echo "Invalid tag format" - exit 1 - fi - shell: bash cross-compile-ios: name: cross-compile-ios runs-on: macos-latest strategy: matrix: target: [ x86_64-apple-ios, aarch64-apple-ios, aarch64-apple-ios-sim ] + mock-deps: [ false, true ] steps: - name: Checkout uses: actions/checkout@v3 @@ -60,18 +52,18 @@ jobs: with: use-cross: false command: build - args: ${{ env.CARGO_FEATURES}} --release --target ${{ matrix.target }} + args: ${{ matrix.mock-deps ? '--no-default-features --features mock-deps' || '' }} --release --target ${{ matrix.target }} - name: Upload library binaries uses: actions/upload-artifact@v4 with: path: target/${{ matrix.target }}/release/libuniffi_lipalightninglib.a - name: build-${{ matrix.target }} + name: build-${{ matrix.target }}${{ matrix.mock-deps ? '-mock' }} - name: Upload bindings files uses: actions/upload-artifact@v4 if: ${{ matrix.target == 'x86_64-apple-ios' }} with: path: bindings/swift/lipalightninglib* - name: bindings-files-ios + name: bindings-files-ios${{ matrix.mock-deps ? '-mock' }} cross-compile-android: name: cross-compile-android @@ -79,6 +71,7 @@ jobs: strategy: matrix: target: [ aarch64-linux-android, armv7-linux-androideabi, i686-linux-android ] + mock-deps: [ false, true ] steps: - name: Checkout uses: actions/checkout@v3 @@ -106,39 +99,42 @@ jobs: with: use-cross: true command: build - args: ${{ env.CARGO_FEATURES}} --release --target ${{ matrix.target }} + args: ${{ matrix.mock-deps ? '--no-default-features --features mock-deps' || '' }} --release --target ${{ matrix.target }} - name: Upload library binaries uses: actions/upload-artifact@v4 with: path: target/${{ matrix.target }}/release/libuniffi_lipalightninglib.so - name: build-${{ matrix.target }} + name: build-${{ matrix.target }}${{ matrix.mock-deps ? '-mock' }} - name: Upload bindings file uses: actions/upload-artifact@v4 if: ${{ matrix.target == 'aarch64-linux-android' }} with: path: bindings/kotlin/uniffi/lipalightninglib/lipalightninglib.kt - name: bindings-file-android + name: bindings-file-android${{ matrix.mock-deps ? '-mock' }} lipo-ios: name: lipo-ios needs: [ cross-compile-ios, cross-compile-android ] runs-on: macos-latest + strategy: + matrix: + mock-deps: [ false, true ] steps: - name: Download x86 bin uses: actions/download-artifact@v4 with: path: target/x86_64-apple-ios/release - name: build-x86_64-apple-ios + name: build-x86_64-apple-ios${{ matrix.mock-deps ? '-mock' }} - name: Download aarch64 bin uses: actions/download-artifact@v4 with: path: target/aarch64-apple-ios/release - name: build-aarch64-apple-ios + name: build-aarch64-apple-ios${{ matrix.mock-deps ? '-mock' }} - name: Download aarch64sim bin uses: actions/download-artifact@v4 with: path: target/aarch64-apple-ios-sim/release - name: build-aarch64-apple-ios-sim + name: build-aarch64-apple-ios-sim${{ matrix.mock-deps ? '-mock' }} - name: Package simulator binaries run: | mkdir -p target/universal/release @@ -149,12 +145,15 @@ jobs: uses: actions/upload-artifact@v4 with: path: target/universal/release/libuniffi_lipalightninglib_simulator.a - name: build-ios-simulator-universal + name: build-ios-simulator-universal${{ matrix.mock-deps ? '-mock' }} deploy-ios: name: deploy-ios needs: lipo-ios runs-on: ubuntu-latest + strategy: + matrix: + mock-deps: [ false, true ] steps: - uses: actions/checkout@v2 with: @@ -181,17 +180,17 @@ jobs: uses: actions/download-artifact@v4 with: path: target/aarch64-apple-ios/release - name: build-aarch64-apple-ios + name: build-aarch64-apple-ios${{ matrix.mock-deps ? '-mock' }} - name: Download simulator universal bin uses: actions/download-artifact@v4 with: path: target/universal/release - name: build-ios-simulator-universal + name: build-ios-simulator-universal${{ matrix.mock-deps ? '-mock' }} - name: Download bindings files uses: actions/download-artifact@v4 with: path: bindings/swift/ - name: bindings-files-ios + name: bindings-files-ios${{ matrix.mock-deps ? '-mock' }} - name: Create xcframework run: | git clone git@github.com:getlipa/lipa-lightning-lib-swift.git @@ -224,7 +223,7 @@ jobs: git add Package.swift git add Sources/LipaLightningLib/LipaLightningLib.swift git commit -m "This commit was created automatically by the lipa bot" - git tag -a ${{ env.RELEASE_VERSION }} HEAD -m "This tag was created automatically by the lipa bot." + git tag -a ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps ? '-mock' }} HEAD -m "This tag was created automatically by the lipa bot." git push git push --tag - name: Create release @@ -279,22 +278,22 @@ jobs: uses: actions/download-artifact@v4 with: path: target/aarch64-linux-android/release - name: build-aarch64-linux-android + name: build-aarch64-linux-android${{ matrix.mock-deps ? '-mock' }} - name: Download armv7 bin uses: actions/download-artifact@v4 with: path: target/armv7-linux-androideabi/release - name: build-armv7-linux-androideabi + name: build-armv7-linux-androideabi${{ matrix.mock-deps ? '-mock' }} - name: Download i686 bin uses: actions/download-artifact@v4 with: path: target/i686-linux-android/release - name: build-i686-linux-android + name: build-i686-linux-android${{ matrix.mock-deps ? '-mock' }} - name: Download bindings file uses: actions/download-artifact@v4 with: path: bindings/kotlin/uniffi/lipalightninglib - name: bindings-file-android + name: bindings-file-android${{ matrix.mock-deps ? '-mock' }} - name: Push to target repo run: | git clone git@github.com:getlipa/lipa-lightning-lib-android.git @@ -327,7 +326,7 @@ jobs: git add LipaLightningLib/src/main/java/com/getlipa/lipalightninglib/lipalightninglib.kt git add jitpack.yml git commit -m "This commit was created automatically by the lipa bot" - git tag -a ${{ env.RELEASE_VERSION }} HEAD -m "This tag was created automatically by the lipa bot." + git tag -a ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps ? '-mock' }} HEAD -m "This tag was created automatically by the lipa bot." git push git push --tag - name: Create release diff --git a/.github/workflows/templates/cross-compile-ios.yml b/.github/workflows/templates/cross-compile-ios.yml new file mode 100644 index 000000000..7cc874241 --- /dev/null +++ b/.github/workflows/templates/cross-compile-ios.yml @@ -0,0 +1,49 @@ +name: cross-compile-ios + +config: + cargo-features: + required: false + + cross-compile-ios: + name: cross-compile-ios + runs-on: macos-latest + strategy: + matrix: + target: [ x86_64-apple-ios, aarch64-apple-ios, aarch64-apple-ios-sim ] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Config cargo + run: echo -e "$CARGO_CONFIG_TOML_BREEZ" > .cargo/config.toml + env: + CARGO_CONFIG_TOML_BREEZ: ${{ secrets.CARGO_CONFIG_TOML_BREEZ }} + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.72.0 + profile: minimal + override: true + target: ${{ matrix.target }} + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build target + uses: actions-rs/cargo@v1 + with: + use-cross: false + command: build + args: ${{ config.cargo_features }} --release --target ${{ matrix.target }} + - name: Upload library binaries + uses: actions/upload-artifact@v4 + with: + path: target/${{ matrix.target }}/release/libuniffi_lipalightninglib.a + name: build-${{ matrix.target }} + - name: Upload bindings files + uses: actions/upload-artifact@v4 + if: ${{ matrix.target == 'x86_64-apple-ios' }} + with: + path: bindings/swift/lipalightninglib* + name: bindings-files-ios \ No newline at end of file