Skip to content

Commit

Permalink
Beautify build iOS workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Dec 5, 2023
1 parent 31356b9 commit 402e25d
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 75 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ jobs:
ssh-key: ${{secrets.REPO_SSH_KEY}}
path: 'breez-sdk'

- name: πŸ—οΈ Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: breez-sdk/libs

- name: πŸ“¦ Install Breez SDK dependencies
run: |
cargo install cargo-ndk
Expand All @@ -61,10 +66,6 @@ jobs:
make init
cd ../sdk-core
make init
- uses: Swatinem/rust-cache@v2
with:
workspaces: breez-sdk/libs
- name: πŸ”¨ Build Breez SDK
env:
Expand All @@ -75,7 +76,7 @@ jobs:
sudo chmod 600 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa
cd breez-sdk/libs/sdk-flutter
make android
make android
- name: πŸ—‚οΈ Populate Flutter tool's cache of binary artifacts.
working-directory: cbreez
Expand Down
152 changes: 82 additions & 70 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build IOS
name: Build iOS

# Controls when the workflow will run
on:
Expand All @@ -12,28 +12,38 @@ on:
workflow_dispatch:

jobs:

build:

build-ios:
name: Build iOS
runs-on: macOS-13
env:
SCHEME: Runner
BUILD_CONFIGURATION: Release
TESTFLIGHT_USERNAME: ${{secrets.TESTFLIGHT_USERNAME}}
TESTFLIGHT_PASSWORD: ${{secrets.TESTFLIGHT_PASSWORD}}
IOS_VERSION_STRING: 0.1.0
DISTRIBUTION_CERT: ${{secrets.DISTRIBUTION_CERT}}
DISTRIBUTION_CERT: ${{secrets.DISTRIBUTION_CERT}}
P12_BASE64: ${{secrets.P12_BASE64}}
P12_PASSWORD: ${{secrets.P12_PASSWORD}}
GOOGLE_SERVICES_IOS: ${{secrets.GOOGLE_SERVICES_IOS}}

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
- name: πŸ—οΈ Setup c-breez repository
uses: actions/checkout@v4
with:
path: 'cbreez'

- name: Install keychain keys
- name: πŸ—οΈ Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: πŸ—οΈ Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: πŸ” Install Keychain keys
run: |
KEYCHAIN_PATH=$RUNNER_TEMP/ios-build.keychain
security create-keychain -p ci $KEYCHAIN_PATH
Expand All @@ -51,37 +61,32 @@ jobs:
security set-key-partition-list -S apple-tool:,apple: -s -k ci $KEYCHAIN_PATH > /dev/null
- name: copy-config
run: |
cd cbreez
echo "$GOOGLE_SERVICES_IOS" > ios/Runner/GoogleService-Info.plist
- name: πŸ—οΈ Copy Firebase configuration file
working-directory: cbreez
run: echo "$GOOGLE_SERVICES_IOS" > ios/Runner/GoogleService-Info.plist

- uses: actions/checkout@v3
- name: πŸ—οΈ Setup breez-sdk repository
uses: actions/checkout@v4
with:
repository: 'breez/breez-sdk'
ssh-key: ${{secrets.REPO_SSH_KEY}}
path: 'breez-sdk'

# Setup the flutter environment.
- uses: subosito/flutter-action@v2
- name: πŸ—οΈ Rust cache
uses: Swatinem/rust-cache@v2
with:
channel: 'stable'
cache: true
workspaces: breez-sdk/libs

- name: install dependencies
- name: πŸ“¦ Install Breez SDK dependencies
run: |
cargo install cargo-ndk@2.12.2
cargo install cargo-ndk
brew install protobuf
cd breez-sdk/libs/sdk-flutter
make init
cd ../sdk-core
make init
- uses: Swatinem/rust-cache@v2
with:
workspaces: breez-sdk/libs

- name: build sdk
- name: πŸ”¨ Build Breez SDK
env:
SSH_PRIVATE_KEY: ${{secrets.REPO_SSH_KEY}}
run: |
Expand All @@ -92,27 +97,28 @@ jobs:
cd breez-sdk/libs/sdk-flutter
make ios-dev
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: πŸ—‚οΈ Populate Flutter tool's cache of binary artifacts.
working-directory: cbreez
run: flutter precache

- name: pub-get
run: |
cd cbreez
flutter pub get
- name: πŸ“¦ Install Flutter dependencies
working-directory: cbreez
run: flutter pub get

- name: dart-analyze
run: |
cd cbreez
dart analyze --fatal-infos
- name: πŸ” Perform static analysis
working-directory: cbreez
run: dart analyze --fatal-infos

- name: run-tests
run: |
cd cbreez
flutter test
- name: πŸ› οΈ Run tests
working-directory: cbreez
run: flutter test

- name: βš™οΈ Setup compile-time variables
env:
CONFIG_FILE: ${{secrets.CONFIG_FILE}}
run: echo "$CONFIG_FILE" > ./cbreez/config.json

- name: Install the provisioning profile
- name: πŸ“ Install the Provisioning Profile
env:
PROVISIONING_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}
NOTIFICATION_PROVISIONING_PROFILE_BASE64: ${{ secrets.NOTIFICATION_PROVISIONING_PROFILE_BASE64 }}
Expand All @@ -128,41 +134,47 @@ jobs:
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $NOTIFICATIONS_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: override-config
env:
CONFIG_FILE: ${{secrets.CONFIG_FILE}}
run: |
echo "$CONFIG_FILE" > ./cbreez/config.json
- name: Build Flutter
run: |
cd cbreez
flutter build ios --release --split-debug-info=./obsfucated/debug --obfuscate --config-only --no-pub --no-codesign --dart-define-from-file=config.json
- name: πŸš€ Build app
working-directory: cbreez
run: flutter build ios --release --split-debug-info=./obsfucated/debug --obfuscate --config-only --no-pub --no-codesign --dart-define-from-file=config.json

- name: Build resolve Swift dependencies
run: |
cd cbreez
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme ${{ env.SCHEME }} -configuration ${{ env.BUILD_CONFIGURATION }}
- name: πŸ“¦ Resolve Swift package dependencies
working-directory: cbreez
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme ${{ env.SCHEME }} -configuration ${{ env.BUILD_CONFIGURATION }}

- name: Build xArchive
run: |
cd cbreez
buildNumber=$(($GITHUB_RUN_NUMBER + 6000)).1
- name: πŸ”¨ Build application and generate xcarchive file
working-directory: cbreez
run: buildNumber=$(($GITHUB_RUN_NUMBER + 6000)).1
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" ios/Runner/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${{ env.IOS_VERSION_STRING }}" ios/Runner/Info.plist
xcodebuild -workspace ios/Runner.xcworkspace -scheme ${{ env.SCHEME }} -configuration ${{ env.BUILD_CONFIGURATION }} -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive clean archive
- name: Export ipa
run: |
cd cbreez
xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/ExportOptions.plist

- name: Publish iOS Artefacts
uses: actions/upload-artifact@v1
- name: πŸ“€ Export the archive to an ipa file
working-directory: cbreez
run: xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/ExportOptions.plist

- name: πŸ—ƒοΈ Compress build folder
uses: TheDoctor0/zip-release@master
with:
filename: build.zip
directory: cbreez/build/ios/iphoneos
type: zip

- name: πŸ“€ Upload release
uses: svenstaro/upload-release-action@v2
with:
asset_name: release-iOS.zip
file: cbreez/build/ios/iphoneos/build.zip
overwrite: true
repo_token: ${{ secrets.GITHUB_TOKEN }}

- name: πŸ“€ Upload artifact
uses: actions/upload-artifact@v3
with:
name: release-ios
path: cbreez/build-output/ios
name: release-iOS
path: cbreez/build/ios/iphoneos

- name: Publish to Testflight
- name: πŸ“± Publish to TestFlight
run: |
altool="$(dirname "$(xcode-select -p)")/Developer/usr/bin/altool"
ipa="$PWD/cbreez/build-output/ios/c_breez.ipa"
Expand Down

0 comments on commit 402e25d

Please sign in to comment.