Skip to content

Commit

Permalink
Fix merging mock
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgranhao committed Sep 19, 2024
1 parent 28c1921 commit 3253845
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
on:
push:
tags:
- 'v*.*.*-mock*'
- 'v*.*.*'

env:
GITHUB_REF: ${{ github.ref }}
Expand All @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
target: [ x86_64-apple-ios, aarch64-apple-ios, aarch64-apple-ios-sim ]
mock-deps: [ true ]
mock-deps: [ false, true ]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
strategy:
matrix:
target: [ aarch64-linux-android, armv7-linux-androideabi, i686-linux-android ]
mock-deps: [ true ]
mock-deps: [ false, true ]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
mock-deps: [ true ]
mock-deps: [ false, true ]
steps:
- name: Download x86 bin
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
mock-deps: [ true ]
mock-deps: [ false, true ]
max-parallel: 1
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
cd lipa-lightning-lib-swift
cp Info.plist.framework_template Info.plist
sed -i "s/to_replace_version/$(echo "${{env.RELEASE_VERSION}}" | tr -cd '0-9.')/g" Info.plist
sed -i "s/to_replace_version/$(echo "${{env.RELEASE_VERSION}}${{ matrix.mock-deps && '-mock' || '' }}" | tr -cd '0-9.')/g" Info.plist
cp Info.plist lipalightninglibFFI.xcframework/ios-arm64/lipalightninglibFFI.framework/Info.plist
mv Info.plist lipalightninglibFFI.xcframework/ios-arm64_x86_64-simulator/lipalightninglibFFI.framework/Info.plist
cd ..
Expand All @@ -216,7 +216,7 @@ jobs:
cp Package.swift.template Package.swift
shasum -a 256 lipalightninglibFFI.xcframework.zip | sed 's/ .*//' > checksum
sed -i "s/to_replace_release_version/${{ env.RELEASE_VERSION }}/g" Package.swift
sed -i "s/to_replace_release_version/${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}/g" Package.swift
sed -i "s/to_replace_zip_checksum/$(cat checksum)/g" Package.swift
git add Package.swift
Expand All @@ -226,7 +226,7 @@ jobs:
git commit -m "This commit was created automatically by the lipa bot"
git restore .
git pull --rebase
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
Expand All @@ -235,19 +235,19 @@ jobs:
if: ${{ env.BRANCH == 'main' }}
run: |
cd lipa-lightning-lib-swift
gh release create ${{ env.RELEASE_VERSION }} \
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \
lipalightninglibFFI.xcframework.zip \
--title "${{ env.RELEASE_VERSION }}" \
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \
--notes "This release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib"
- name: Create pre-release
env:
GITHUB_TOKEN: ${{ secrets.LIPA_BOT_ACCESS_TOKEN }}
if: ${{ env.BRANCH != 'main' }}
run: |
cd lipa-lightning-lib-swift
gh release create ${{ env.RELEASE_VERSION }} \
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \
lipalightninglibFFI.xcframework.zip \
--title "${{ env.RELEASE_VERSION }}" \
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \
--notes "This pre-release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib" \
--prerelease
Expand All @@ -257,7 +257,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
mock-deps: [ true ]
mock-deps: [ false, true ]
max-parallel: 1
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -327,14 +327,14 @@ jobs:
shasum -a 256 jniLibs.zip | sed 's/ .*//' > checksum
cp jitpack.yml.template jitpack.yml
sed -i "s/to_replace_release_version/${{ env.RELEASE_VERSION }}/g" jitpack.yml
sed -i "s/to_replace_release_version/${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}/g" jitpack.yml
sed -i "s/to_replace_zip_checksum/$(cat checksum)/g" jitpack.yml
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 pull --rebase
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
Expand All @@ -343,24 +343,24 @@ jobs:
if: ${{ env.BRANCH == 'main' }}
run: |
cd lipa-lightning-lib-android
gh release create ${{ env.RELEASE_VERSION }} \
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \
jniLibs.zip \
--title "${{ env.RELEASE_VERSION }}" \
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \
--notes "This release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib"
- name: Create pre-release
env:
GITHUB_TOKEN: ${{ secrets.LIPA_BOT_ACCESS_TOKEN }}
if: ${{ env.BRANCH != 'main' }}
run: |
cd lipa-lightning-lib-android
gh release create ${{ env.RELEASE_VERSION }} \
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \
jniLibs.zip \
--title "${{ env.RELEASE_VERSION }}" \
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \
--notes "This pre-release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib" \
--prerelease
- name: Trigger JitPack build
run: |
curl -s -m 30 https://jitpack.io/com/github/getlipa/lipa-lightning-lib-android/${{ env.RELEASE_VERSION }} || true
curl -s -m 30 https://jitpack.io/com/github/getlipa/lipa-lightning-lib-android/${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} || true
determine-branch:
name: determine-branch
Expand Down
8 changes: 2 additions & 6 deletions examples/node/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ fn main() {
let environment = env::args().nth(1).unwrap_or("local".to_string());
let base_dir = format!("{BASE_DIR}_{environment}");

#[cfg(feature = "mock-deps")]
let base_dir = format!("{base_dir}_mocked");
#[cfg(feature = "mock-deps")]
if let Err(err) = fs::remove_dir_all(&base_dir) {
log::warn!("Error deleting directory: {}", err);
}
// Delete mock dir (helpful in case we are running mocked, harmless in other cases)
let _ = fs::remove_dir_all(format!("{base_dir}_mocked"));

let environment_code = map_environment_code(&environment);
let environment = Environment::load(environment_code);
Expand Down
4 changes: 3 additions & 1 deletion tests/print_events_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ impl EventsCallback for PrintEventsHandler {
println!("The Breez SDK health status changed to {status:?}");
}

fn synced(&self) {}
fn synced(&self) {
println!("A sync has just been successfully performed");
}
}

0 comments on commit 3253845

Please sign in to comment.