From ae493cfed96aa3e64edc0e0b77119ebee5c29b29 Mon Sep 17 00:00:00 2001 From: "cihan.oezkan" Date: Tue, 7 Apr 2020 08:56:16 +0200 Subject: [PATCH] Create iOS CI #500 --- .gitlab-ci.yml | 45 +++++++++++++++++++++------- .gitmodules | 3 ++ ios/Runner.xcodeproj/project.pbxproj | 12 ++++++-- ios/exportOptionsdevelopment.plist | 2 +- tools/build.triggerBuild.sh | 19 +++++++----- tools/deploy.uploadToAppCenter.sh | 13 ++++++-- tools/utils | 1 + 7 files changed, 70 insertions(+), 25 deletions(-) create mode 100644 .gitmodules create mode 160000 tools/utils diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a42a590..7c8c4707 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,15 +1,21 @@ before_script: - export GRADLE_USER_HOME=`pwd`/.gradle -- source setup-build-id cache: paths: - .gradle/wrapper - .gradle/caches +variables: + LANG: "en_US.UTF-8" + GIT_SUBMODULE_STRATEGY: "recursive" + + stages: - build - deploy +- build-ios +- deploy-ios - status-report build: @@ -18,11 +24,32 @@ build: - docker image: gitlab.open-xchange.com:4567/mobile/build/container/flutter script: - - tools/build.triggerBuild.sh android debug development 0.999.9 $BUILD_ID latest + - tools/build.triggerBuild.sh android debug development 0.999.9 $CI_PIPELINE_ID latest artifacts: paths: - build/app/outputs/apk/development/debug/*.apk +build-ios: + cache: {} + stage: build-ios + tags: + - ios + script: + - tools/build.triggerBuild.sh ios release development 0.999.9 $CI_PIPELINE_ID latest + artifacts: + paths: + - build/app/outputs/ios/development/Runner.ipa/*.ipa + +deploy-ios: + cache: {} + stage: deploy-ios + tags: + - ios + dependencies: + - build-ios + script: + - tools/deploy.uploadToAppCenter.sh ios + deploy: stage: deploy tags: @@ -31,22 +58,20 @@ deploy: dependencies: - build script: - - tools/deploy.uploadToAppCenter.sh + - tools/deploy.uploadToAppCenter.sh android status-report-success: stage: status-report tags: - - docker - image: gitlab.open-xchange.com:4567/mobile/build/container/flutter + - ios script: - - post-ticket-comment -s success + - tools/utils/add-issue-link -s success when: on_success status-report-failure: stage: status-report tags: - - docker - image: gitlab.open-xchange.com:4567/mobile/build/container/flutter + - ios script: - - post-ticket-comment -s failure - when: on_failure + - tools/utils/add-issue-link -s failure + when: on_failure \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e977712c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tools/utils"] + path = tools/utils + url = ../utils.git diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 136dcb04..96a279f0 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 2AB5BDA32396A33B005FDB10 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AB5BDA22396A33B005FDB10 /* GeneratedPluginRegistrant.m */; }; 374E43D3FB49E295AE9799DD /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 899B7188477F2A02FA10829E /* Pods_Runner.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 649470442445BCF800239B7B /* .gitlab-ci.yml in Resources */ = {isa = PBXBuildFile; fileRef = 649470432445BCF800239B7B /* .gitlab-ci.yml */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -68,6 +69,7 @@ 646BAA7523D893CB004295B1 /* sv-SE */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "sv-SE"; path = "sv-SE.lproj/InfoPlist.strings"; sourceTree = ""; }; 646BAA7623D894B2004295B1 /* zh-Hant-CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-CN"; path = "zh-Hant-CN.lproj/InfoPlist.strings"; sourceTree = ""; }; 646BAA7723D894C7004295B1 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/InfoPlist.strings"; sourceTree = ""; }; + 649470432445BCF800239B7B /* .gitlab-ci.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; name = ".gitlab-ci.yml"; path = "../.gitlab-ci.yml"; sourceTree = ""; }; 6F6BA9A235C8C854C6105BBB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 81A3BCC8525B6F2D0510F16F /* Pods-Runner.stable.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.stable.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.stable.xcconfig"; sourceTree = ""; }; 899B7188477F2A02FA10829E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -141,6 +143,7 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( + 649470432445BCF800239B7B /* .gitlab-ci.yml */, FD51737223266F04007458CC /* .swiftlint.yml */, 97C146F01CF9000F007C117D /* OX Coi */, 9740EEB11CF90186004384FC /* Flutter */, @@ -356,6 +359,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + 649470442445BCF800239B7B /* .gitlab-ci.yml in Resources */, FD2FD6F323E099F900B39EA2 /* GoogleService-Info-Development.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1031,7 +1035,8 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: iOS Developer (G8Y6CF25ZP)"; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -1064,7 +1069,8 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = NO; CODE_SIGN_ENTITLEMENTS = "OX Coi/Runner.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Open-Xchange AG"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 528HQ38877; ENABLE_BITCODE = NO; @@ -1223,7 +1229,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "${PRODUCT_BUNDLE_IDENTIFIER}"; PRODUCT_NAME = "${PRODUCT_NAME}"; - PROVISIONING_PROFILE_SPECIFIER = ""; + PROVISIONING_PROFILE_SPECIFIER = com.openxchange.oxcoi.dev; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "OX Coi/Application/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/ios/exportOptionsdevelopment.plist b/ios/exportOptionsdevelopment.plist index 8e823f11..ed3e9532 100644 --- a/ios/exportOptionsdevelopment.plist +++ b/ios/exportOptionsdevelopment.plist @@ -5,7 +5,7 @@ provisioningProfiles com.openxchange.oxcoi.dev - OX COI Messenger Dev + InHouse com.openxchange.oxcoi.dev method enterprise diff --git a/tools/build.triggerBuild.sh b/tools/build.triggerBuild.sh index cb6c6a12..460205a0 100755 --- a/tools/build.triggerBuild.sh +++ b/tools/build.triggerBuild.sh @@ -101,8 +101,8 @@ function iosReleaseBuild { flutter build ios --release --build-name=${buildName} --build-number=${buildNumber} --flavor ${flavor} flutter clean - xcodebuild -workspace ios/Runner.xcworkspace -scheme ${flavor} -sdk iphoneos -configuration Release-${flavor} archive -archivePath "${IOS_BUILD_FOLDER}/Runner.xcarchive" -allowProvisioningUpdates - xcodebuild -exportArchive -archivePath "${IOS_BUILD_FOLDER}/Runner.xcarchive" -exportOptionsPlist ios/exportOptions${flavor}.plist -exportPath "${IOS_BUILD_FOLDER}/Runner.ipa" -allowProvisioningUpdates + xcodebuild -workspace ios/Runner.xcworkspace -scheme ${flavor} -sdk iphoneos -configuration Release-${flavor} archive -archivePath "${IOS_BUILD_FOLDER}/Runner.xcarchive" -allowProvisioningUpdates | xcpretty + xcodebuild -exportArchive -archivePath "${IOS_BUILD_FOLDER}/Runner.xcarchive" -exportOptionsPlist ios/exportOptions${flavor}.plist -exportPath "${IOS_BUILD_FOLDER}/Runner.ipa" -allowProvisioningUpdates | xcpretty } function setupPlugin { @@ -116,6 +116,7 @@ function setupPlugin { else git checkout ${coreVersion} fi + git submodule update --init --recursive ) else echo "Plugin repository found, using the current state. To ensure the latest plugin + DCC is used, please execute 'git pull && git submodule update' in the plugin repository" @@ -218,6 +219,14 @@ else moveCore ) fi +echo "-- Performing build preparations --" +if isIos; then + echo "Adjusting symlinks" + ( + cd "../$PLUGIN_FOLDER/$IOS_LIBRARY_FOLDER" + ln -sf "../../delta_chat_core/deltachat-ffi/deltachat.h" . + ) +fi echo "-- Building --" if isAndroid; then if isRelease; then @@ -232,10 +241,4 @@ elif isIos; then iosDebugBuild fi fi -echo "-- Performing additional build steps --" -if isIos; then - echo "Adjusting symlinks" - cd "../$PLUGIN_FOLDER/$IOS_LIBRARY_FOLDER" - ln -sf "../../delta_chat_core/deltachat-ffi/deltachat.h" . -fi echo "-- Finishing --" diff --git a/tools/deploy.uploadToAppCenter.sh b/tools/deploy.uploadToAppCenter.sh index 66b1ebe6..58e70190 100755 --- a/tools/deploy.uploadToAppCenter.sh +++ b/tools/deploy.uploadToAppCenter.sh @@ -3,8 +3,15 @@ set -e set -o pipefail +PLATFORM=$1 DISTRIBUTION_GROUP="Collaborators" -APK="build/app/outputs/apk/development/debug/app-development-debug.apk" -APP_CENTER_APP="open-xchange/OX-COI-Messenger-Dev" -appcenter distribute release --app "${APP_CENTER_APP}" --file ${APK} --group ${DISTRIBUTION_GROUP} --output json \ No newline at end of file +if [[ ${PLATFORM} == "ios" ]]; then + FILE="build/app/outputs/ios/development/Runner.ipa/OX COI Messenger Dev.ipa" + APP_CENTER_APP="open-xchange/OX-COI-Messenger-Dev-1" +else + FILE="build/app/outputs/apk/development/debug/app-development-debug.apk" + APP_CENTER_APP="open-xchange/OX-COI-Messenger-Dev" +fi + +appcenter distribute release --app "${APP_CENTER_APP}" --file "${FILE}" --group ${DISTRIBUTION_GROUP} --output json \ No newline at end of file diff --git a/tools/utils b/tools/utils new file mode 160000 index 00000000..f5799760 --- /dev/null +++ b/tools/utils @@ -0,0 +1 @@ +Subproject commit f5799760ff647bac8dd0f64c4a91226dd706337a