From 99712378e3266444010326ea1c51a1088ff67886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Fri, 4 Sep 2020 17:47:37 +0200 Subject: [PATCH 01/12] ci: add new bash scripts for test artifacts generation ci: make flankScripts auto generate jar if needed --- .env | 12 ++ flank-scripts/bash/flankScripts | 9 +- .../bash/generate-multi-modules-apks.sh | 4 +- test_projects/android/bash/generate_apks.sh | 2 + .../bash/generate_duplicated_names_apks.sh | 2 + test_projects/android/ops.sh | 124 ++++++++++++++++++ test_projects/ios/EarlGreyExample/.gitignore | 1 + test_projects/ios/EarlGreyExample/ops.sh | 49 +++++++ test_projects/ops.sh | 32 +++++ .../flank-multiple-duplicated.yml | 2 +- 10 files changed, 233 insertions(+), 4 deletions(-) create mode 100755 .env create mode 100644 test_projects/android/ops.sh create mode 100644 test_projects/ios/EarlGreyExample/ops.sh create mode 100644 test_projects/ops.sh diff --git a/.env b/.env new file mode 100755 index 0000000000..8680baab4e --- /dev/null +++ b/.env @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +project="$(cd "$(pwd)/$(dirname "$BASH_SOURCE")" && pwd)" + +export FLANK_ROOT=$project +export FLANK_FIXTURES_TMP="$project/test_runner/src/test/kotlin/ftl/fixtures/tmp" + +. "$project/test_projects/ops.sh" + +function bash_debug() { + set -euxo pipefail +} diff --git a/flank-scripts/bash/flankScripts b/flank-scripts/bash/flankScripts index 2212d2723f..1158f7255d 100755 --- a/flank-scripts/bash/flankScripts +++ b/flank-scripts/bash/flankScripts @@ -1,5 +1,10 @@ #!/usr/bin/env bash -DIR=`dirname "$BASH_SOURCE"` +dir=$(dirname "$BASH_SOURCE") +scriptsJar="$dir/flankScripts.jar" -/usr/bin/env java -jar "$DIR/flankScripts.jar" "$@" +if [ ! -f "$scriptsJar" ]; then + "$dir/buildFlankScripts.sh" +fi + +/usr/bin/env java -jar "$scriptsJar" "$@" diff --git a/test_projects/android/bash/generate-multi-modules-apks.sh b/test_projects/android/bash/generate-multi-modules-apks.sh index ff04b44c53..aa849d5110 100755 --- a/test_projects/android/bash/generate-multi-modules-apks.sh +++ b/test_projects/android/bash/generate-multi-modules-apks.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "DEPRECATED!!!" + set -euxo pipefail PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../.." >/dev/null 2>&1 && pwd )" @@ -30,4 +32,4 @@ MULTI_MODULES_DIR="$PROJECT_DIR/test_runner/src/test/kotlin/ftl/fixtures/tmp/apk :multi-modules:testModule20:assembleAndroidTest \ mkdir -p "$MULTI_MODULES_DIR" -find multi-modules -type f -name "*.apk" -exec cp {} "$MULTI_MODULES_DIR" \; \ No newline at end of file +find multi-modules -type f -name "*.apk" -exec cp {} "$MULTI_MODULES_DIR" \; diff --git a/test_projects/android/bash/generate_apks.sh b/test_projects/android/bash/generate_apks.sh index 5df13a6228..b64fe7a674 100755 --- a/test_projects/android/bash/generate_apks.sh +++ b/test_projects/android/bash/generate_apks.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "DEPRECATED!!!" + set -euxo pipefail APK_OUTPUT=$1 diff --git a/test_projects/android/bash/generate_duplicated_names_apks.sh b/test_projects/android/bash/generate_duplicated_names_apks.sh index 18261938a9..bb9674ee68 100755 --- a/test_projects/android/bash/generate_duplicated_names_apks.sh +++ b/test_projects/android/bash/generate_duplicated_names_apks.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "DEPRECATED!!!" + set -euxo pipefail DIR=`dirname "$BASH_SOURCE"` diff --git a/test_projects/android/ops.sh b/test_projects/android/ops.sh new file mode 100644 index 0000000000..500040ffa3 --- /dev/null +++ b/test_projects/android/ops.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash + +function base_app_apk() { + local dir=$(dirname "$BASH_SOURCE") + local outputDir="$FLANK_FIXTURES_TMP/apk" + + for arg in "$@"; do + case "$arg" in + + '--generate' | '-g') + "$dir/gradlew" -p "$dir" app:assemble + ;; + + '--copy' | '-c') + local apkIn="$dir/app/build/outputs/apk/singleSuccess/debug/app-single-success-debug.apk" + local apkOut="$outputDir/app-debug.apk" + + mkdir -p "$outputDir" + cp "$apkIn" "$apkOut" + ;; + + esac + done +} + +# depends on base_app_apk +function base_test_apks() { + local dir=$(dirname "$BASH_SOURCE") + + for arg in "$@"; do + case "$arg" in + + '--generate' | '-g') + "$dir/gradlew" -p "$dir" app:assembleAndroidTest + ;; + + '--copy' | '-c') + local outputDir="$FLANK_FIXTURES_TMP/apk" + local testIn="$dir/app/build/outputs/apk/androidTest/**/debug/*.apk" + + mkdir -p "$outputDir" + cp $testIn $outputDir/ + ;; + + esac + done +} + +# depends on base_app_apk +function duplicated_names_apks() { + local dir=$(dirname "$BASH_SOURCE") + + for arg in "$@"; do + case "$arg" in + + '--generate' | '-g') + "$dir/gradlew" -p "$dir" \ + dir0:testModule:assembleAndroidTest \ + dir1:testModule:assembleAndroidTest \ + dir2:testModule:assembleAndroidTest \ + dir3:testModule:assembleAndroidTest + ;; + + '--copy' | '-c') + local outputDir="$FLANK_FIXTURES_TMP/apk" + local testIn="$dir/app/build/outputs/apk/androidTest/**/debug/*.apk" + + mkdir -p "$outputDir" + local dir=$(dirname "$BASH_SOURCE") + local outputDir="$FLANK_FIXTURES_TMP/apk/duplicated_names/" + + for index in 0 1 2 3; do + moduleName="dir$index" + apkDir="$outputDir/$moduleName/" + mkdir -p "$apkDir" + cp "$dir/$moduleName"/testModule/build/outputs/apk/**/debug/*.apk "$apkDir" + done + ;; + esac + done +} + +function multi_module_apks() { + local dir=$(dirname "$BASH_SOURCE") + local outputDir="$FLANK_FIXTURES_TMP/apk/multi-modules/" + + for arg in "$@"; do + case "$arg" in + + '--generate' | '-g') + "$dir/gradlew" -p "$dir" \ + :multi-modules:multiapp:assemble \ + :multi-modules:testModule1:assembleAndroidTest \ + :multi-modules:testModule2:assembleAndroidTest \ + :multi-modules:testModule3:assembleAndroidTest \ + :multi-modules:testModule4:assembleAndroidTest \ + :multi-modules:testModule5:assembleAndroidTest \ + :multi-modules:testModule6:assembleAndroidTest \ + :multi-modules:testModule7:assembleAndroidTest \ + :multi-modules:testModule8:assembleAndroidTest \ + :multi-modules:testModule9:assembleAndroidTest \ + :multi-modules:testModule10:assembleAndroidTest \ + :multi-modules:testModule11:assembleAndroidTest \ + :multi-modules:testModule12:assembleAndroidTest \ + :multi-modules:testModule13:assembleAndroidTest \ + :multi-modules:testModule14:assembleAndroidTest \ + :multi-modules:testModule15:assembleAndroidTest \ + :multi-modules:testModule16:assembleAndroidTest \ + :multi-modules:testModule17:assembleAndroidTest \ + :multi-modules:testModule18:assembleAndroidTest \ + :multi-modules:testModule19:assembleAndroidTest \ + :multi-modules:testModule20:assembleAndroidTest + ;; + + '--copy' | '-c') + mkdir -p "$outputDir" + find "$dir/multi-modules" -type f -name "*.apk" -exec cp {} "$outputDir" \; + ;; + + esac + done +} + +echo "Android test projects ops loaded" diff --git a/test_projects/ios/EarlGreyExample/.gitignore b/test_projects/ios/EarlGreyExample/.gitignore index 4003300b15..e771e43857 100644 --- a/test_projects/ios/EarlGreyExample/.gitignore +++ b/test_projects/ios/EarlGreyExample/.gitignore @@ -4,3 +4,4 @@ Pods/ Podfile.lock xcuserdata/ *.xcworkspace/ +dd_tmp diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh new file mode 100644 index 0000000000..51a2e8af2d --- /dev/null +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +function setup_ios_env() { + local dir=$(dirname "$BASH_SOURCE") + gem install cocoapods + cd "$dir" + pod install +} + +function earl_grey_example() { + local dir=$(dirname "$BASH_SOURCE") + for arg in "$@"; do + case "$arg" in + + '--generate' | '-g') + "$dir/build_example.sh" + ;; + + '--copy' | '-c') + echo "TODO" + ;; + + esac + done +} + +function earl_grey_ftl() { + local dir=$(dirname "$BASH_SOURCE") + for arg in "$@"; do + case "$arg" in + + '--generate' | '-g') + "$dir/build_ftl.sh" + ;; + + '--copy' | '-c') + echo "--copy TODO" + ;; + + esac + done +} + +function universal_framework() { + local dir=$(dirname "$BASH_SOURCE") + "$dir/universal_framework.sh" +} + +echo "iOS test projects ops loaded" diff --git a/test_projects/ops.sh b/test_projects/ops.sh new file mode 100644 index 0000000000..afe0dd865a --- /dev/null +++ b/test_projects/ops.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +dir="$(dirname "$BASH_SOURCE")" + +. "$dir/android/ops.sh" +. "$dir/ios/EarlGreyExample/ops.sh" + +function update_test_artifacts() { + + for arg in "$@"; do + case "$arg" in + + android) + base_app_apk --generate --copy + base_test_apks --generate --copy + ;; + + ios) + setup_ios_env + earl_grey_example --generate --copy + ;; + + go) + echo "TODO" + ;; + + all) + update_test_artifacts android ios go + ;; + esac + done +} diff --git a/test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-multiple-duplicated.yml b/test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-multiple-duplicated.yml index 43788b6968..6ae4a4ae65 100644 --- a/test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-multiple-duplicated.yml +++ b/test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-multiple-duplicated.yml @@ -1,5 +1,5 @@ gcloud: - app: ./src/test/kotlin/ftl/fixtures/tmp/apk/duplicated_names/app-debug.apk + app: ./src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk test: ./src/test/kotlin/ftl/fixtures/tmp/apk/duplicated_names/dir0/testModule-debug-androidTest.apk use-orchestrator: false flank: From d325d97ca0e55faa95dbdb81473282fc78fd02ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Fri, 4 Sep 2020 18:01:33 +0200 Subject: [PATCH 02/12] fix setup_ios_env script --- test_projects/ios/EarlGreyExample/ops.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh index 51a2e8af2d..9e446576b7 100644 --- a/test_projects/ios/EarlGreyExample/ops.sh +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -3,8 +3,7 @@ function setup_ios_env() { local dir=$(dirname "$BASH_SOURCE") gem install cocoapods - cd "$dir" - pod install + (cd "$dir" && pod install) } function earl_grey_example() { From 74690350feea970b2f99a167e8a1eefd0b0fcbfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Fri, 4 Sep 2020 18:16:57 +0200 Subject: [PATCH 03/12] fix formatting --- test_projects/android/ops.sh | 25 +++++++++--------------- test_projects/ios/EarlGreyExample/ops.sh | 12 ++++-------- test_projects/ops.sh | 7 +++---- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/test_projects/android/ops.sh b/test_projects/android/ops.sh index 500040ffa3..38855a923e 100644 --- a/test_projects/android/ops.sh +++ b/test_projects/android/ops.sh @@ -4,8 +4,7 @@ function base_app_apk() { local dir=$(dirname "$BASH_SOURCE") local outputDir="$FLANK_FIXTURES_TMP/apk" - for arg in "$@"; do - case "$arg" in + for arg in "$@"; do case "$arg" in '--generate' | '-g') "$dir/gradlew" -p "$dir" app:assemble @@ -19,16 +18,14 @@ function base_app_apk() { cp "$apkIn" "$apkOut" ;; - esac - done + esac done } # depends on base_app_apk function base_test_apks() { local dir=$(dirname "$BASH_SOURCE") - for arg in "$@"; do - case "$arg" in + for arg in "$@"; do case "$arg" in '--generate' | '-g') "$dir/gradlew" -p "$dir" app:assembleAndroidTest @@ -42,16 +39,14 @@ function base_test_apks() { cp $testIn $outputDir/ ;; - esac - done + esac done } # depends on base_app_apk function duplicated_names_apks() { local dir=$(dirname "$BASH_SOURCE") - for arg in "$@"; do - case "$arg" in + for arg in "$@"; do case "$arg" in '--generate' | '-g') "$dir/gradlew" -p "$dir" \ @@ -76,16 +71,15 @@ function duplicated_names_apks() { cp "$dir/$moduleName"/testModule/build/outputs/apk/**/debug/*.apk "$apkDir" done ;; - esac - done + + esac done } function multi_module_apks() { local dir=$(dirname "$BASH_SOURCE") local outputDir="$FLANK_FIXTURES_TMP/apk/multi-modules/" - for arg in "$@"; do - case "$arg" in + for arg in "$@"; do case "$arg" in '--generate' | '-g') "$dir/gradlew" -p "$dir" \ @@ -117,8 +111,7 @@ function multi_module_apks() { find "$dir/multi-modules" -type f -name "*.apk" -exec cp {} "$outputDir" \; ;; - esac - done + esac done } echo "Android test projects ops loaded" diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh index 9e446576b7..1f109da2fb 100644 --- a/test_projects/ios/EarlGreyExample/ops.sh +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -8,8 +8,7 @@ function setup_ios_env() { function earl_grey_example() { local dir=$(dirname "$BASH_SOURCE") - for arg in "$@"; do - case "$arg" in + for arg in "$@"; do case "$arg" in '--generate' | '-g') "$dir/build_example.sh" @@ -19,14 +18,12 @@ function earl_grey_example() { echo "TODO" ;; - esac - done + esac done } function earl_grey_ftl() { local dir=$(dirname "$BASH_SOURCE") - for arg in "$@"; do - case "$arg" in + for arg in "$@"; do case "$arg" in '--generate' | '-g') "$dir/build_ftl.sh" @@ -36,8 +33,7 @@ function earl_grey_ftl() { echo "--copy TODO" ;; - esac - done + esac done } function universal_framework() { diff --git a/test_projects/ops.sh b/test_projects/ops.sh index afe0dd865a..f606ad12da 100644 --- a/test_projects/ops.sh +++ b/test_projects/ops.sh @@ -7,8 +7,7 @@ dir="$(dirname "$BASH_SOURCE")" function update_test_artifacts() { - for arg in "$@"; do - case "$arg" in + for arg in "$@"; do case "$arg" in android) base_app_apk --generate --copy @@ -27,6 +26,6 @@ function update_test_artifacts() { all) update_test_artifacts android ios go ;; - esac - done + + esac done } From 1fb72de8eda1cb3f8e2a18a70999e9063d3fd5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Tue, 8 Sep 2020 12:44:26 +0200 Subject: [PATCH 04/12] Update earl_grey_example function --- test_projects/ios/EarlGreyExample/.gitignore | 1 - test_projects/ios/EarlGreyExample/ops.sh | 65 ++++++++++++++------ 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/test_projects/ios/EarlGreyExample/.gitignore b/test_projects/ios/EarlGreyExample/.gitignore index e771e43857..4003300b15 100644 --- a/test_projects/ios/EarlGreyExample/.gitignore +++ b/test_projects/ios/EarlGreyExample/.gitignore @@ -4,4 +4,3 @@ Pods/ Podfile.lock xcuserdata/ *.xcworkspace/ -dd_tmp diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh index 1f109da2fb..1185e6001f 100644 --- a/test_projects/ios/EarlGreyExample/ops.sh +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -1,44 +1,71 @@ #!/usr/bin/env bash function setup_ios_env() { + if ! [ -x "$(command -v xcpretty)" ]; then + gem install cocoapods + fi local dir=$(dirname "$BASH_SOURCE") - gem install cocoapods (cd "$dir" && pod install) } +function install_xcpretty() { + if ! [ -x "$(command -v xcpretty)" ]; then + gem install xcpretty + fi +} + +function universal_framework() { + local dir=$(dirname "$BASH_SOURCE") + "$dir/universal_framework.sh" +} + function earl_grey_example() { local dir=$(dirname "$BASH_SOURCE") + local buildDir="$dir/build" + for arg in "$@"; do case "$arg" in '--generate' | '-g') - "$dir/build_example.sh" - ;; - '--copy' | '-c') - echo "TODO" - ;; + install_xcpretty - esac done -} + rm -rf "$buildDir" -function earl_grey_ftl() { - local dir=$(dirname "$BASH_SOURCE") - for arg in "$@"; do case "$arg" in + xcodebuild build-for-testing \ + -allowProvisioningUpdates \ + -workspace "$dir/EarlGreyExample.xcworkspace" \ + -scheme "EarlGreyExampleSwiftTests" \ + -derivedDataPath "$buildDir" \ + -sdk iphoneos | + xcpretty - '--generate' | '-g') - "$dir/build_ftl.sh" + xcodebuild build-for-testing \ + -allowProvisioningUpdates \ + -workspace "$dir/EarlGreyExample.xcworkspace" \ + -scheme "EarlGreyExampleTests" \ + -derivedDataPath "$buildDir" \ + -sdk iphoneos | + xcpretty ;; '--copy' | '-c') - echo "--copy TODO" + + local productsDir="$dir/build/Build/Products" + + cp -R "$productsDir/*-iphoneos" "$FLANK_FIXTURES_TMP/" + + cp "$productsDir/*.xctestrun" "$FLANK_FIXTURES_TMP/" + + cp \ + "$productsDir/Debug-iphoneos/EarlGreyExampleTests.xctest/EarlGreyExampleTests" \ + "$FLANK_FIXTURES_TMP/objc/" + + cp \ + "$productsDir/Debug-iphoneos/EarlGreyExampleSwiftTests.xctest/EarlGreyExampleSwiftTests" \ + "$FLANK_FIXTURES_TMP/swift/" ;; esac done } -function universal_framework() { - local dir=$(dirname "$BASH_SOURCE") - "$dir/universal_framework.sh" -} - echo "iOS test projects ops loaded" From eb752be628f0aed3e7574665999dfcb0a51a10bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Tue, 8 Sep 2020 13:22:10 +0200 Subject: [PATCH 05/12] Update gohello copy --- test_projects/ops.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_projects/ops.sh b/test_projects/ops.sh index f606ad12da..3f1c594e89 100644 --- a/test_projects/ops.sh +++ b/test_projects/ops.sh @@ -20,7 +20,7 @@ function update_test_artifacts() { ;; go) - echo "TODO" + cp -R "$dir/gohello" "$FLANK_FIXTURES_TMP/" ;; all) From 047c3dfcba20ef657879b17898baf0a87207012e Mon Sep 17 00:00:00 2001 From: Axel Zuziak Date: Thu, 10 Sep 2020 14:03:24 +0200 Subject: [PATCH 06/12] Code signing changes in iOS test project --- .../EarlGreyExample.xcodeproj/project.pbxproj | 30 +++++++++---------- .../EarlGreyExampleSwiftTests.xcscheme | 18 +++++------ 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/project.pbxproj b/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/project.pbxproj index 86e31df388..468c3051fe 100644 --- a/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/project.pbxproj +++ b/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/project.pbxproj @@ -283,18 +283,18 @@ TargetAttributes = { 2CB7314C1C29E54A00CF35C1 = { CreatedOnToolsVersion = 7.2; - DevelopmentTeam = H86XEK7ZTM; + DevelopmentTeam = AD2V26JBWL; LastSwiftMigration = 0800; TestTargetID = 5F5A53781ADE67D500F81DF0; }; 5F5A53781ADE67D500F81DF0 = { CreatedOnToolsVersion = 6.3; - DevelopmentTeam = H86XEK7ZTM; + DevelopmentTeam = AD2V26JBWL; LastSwiftMigration = 0800; }; 5FDE05571B0DAA090037B82F = { CreatedOnToolsVersion = 6.3.2; - DevelopmentTeam = H86XEK7ZTM; + DevelopmentTeam = AD2V26JBWL; TestTargetID = 5F5A53781ADE67D500F81DF0; }; }; @@ -485,12 +485,12 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = NO; - DEVELOPMENT_TEAM = H86XEK7ZTM; + DEVELOPMENT_TEAM = AD2V26JBWL; ENABLE_TESTABILITY = YES; INFOPLIST_FILE = EarlGreyExampleSwiftTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.google.earlgrey.samples.EarlGreySwiftTests; + PRODUCT_BUNDLE_IDENTIFIER = io.gogoapps.earlgrey.samples.EarlGreySwiftTests; PRODUCT_MODULE_NAME = EarlGreyExampleTestsSwift; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -509,11 +509,11 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = NO; - DEVELOPMENT_TEAM = H86XEK7ZTM; + DEVELOPMENT_TEAM = AD2V26JBWL; INFOPLIST_FILE = EarlGreyExampleSwiftTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.google.earlgrey.samples.EarlGreySwiftTests; + PRODUCT_BUNDLE_IDENTIFIER = io.gogoapps.earlgrey.samples.EarlGreySwiftTests; PRODUCT_MODULE_NAME = EarlGreyExampleTestsSwift; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -619,12 +619,12 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = H86XEK7ZTM; + DEVELOPMENT_TEAM = AD2V26JBWL; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = "$(SRCROOT)/EarlGreyExample/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.google.earlgrey.samples.EarlGrey3; + PRODUCT_BUNDLE_IDENTIFIER = io.gogoapps.earlgrey.samples.EarlGrey; PRODUCT_MODULE_NAME = EarlGreyExampleSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_INSTALL_OBJC_HEADER = NO; @@ -642,12 +642,12 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = H86XEK7ZTM; + DEVELOPMENT_TEAM = AD2V26JBWL; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = "$(SRCROOT)/EarlGreyExample/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.google.earlgrey.samples.EarlGrey3; + PRODUCT_BUNDLE_IDENTIFIER = io.gogoapps.earlgrey.samples.EarlGrey; PRODUCT_MODULE_NAME = EarlGreyExampleSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_INSTALL_OBJC_HEADER = NO; @@ -666,7 +666,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = NO; - DEVELOPMENT_TEAM = H86XEK7ZTM; + DEVELOPMENT_TEAM = AD2V26JBWL; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -682,7 +682,7 @@ INFOPLIST_FILE = EarlGreyExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.google.earlgrey.samples.EarlGreyTests; + PRODUCT_BUNDLE_IDENTIFIER = io.gogoapps.earlgrey.samples.EarlGreyTests; PRODUCT_MODULE_NAME = EarlGreyExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; @@ -704,7 +704,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = NO; - DEVELOPMENT_TEAM = H86XEK7ZTM; + DEVELOPMENT_TEAM = AD2V26JBWL; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; HEADER_SEARCH_PATHS = ( @@ -716,7 +716,7 @@ INFOPLIST_FILE = EarlGreyExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.google.earlgrey.samples.EarlGreyTests; + PRODUCT_BUNDLE_IDENTIFIER = io.gogoapps.earlgrey.samples.EarlGreyTests; PRODUCT_MODULE_NAME = EarlGreyExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; diff --git a/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/xcshareddata/xcschemes/EarlGreyExampleSwiftTests.xcscheme b/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/xcshareddata/xcschemes/EarlGreyExampleSwiftTests.xcscheme index f696d36ce8..2f5163cb89 100644 --- a/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/xcshareddata/xcschemes/EarlGreyExampleSwiftTests.xcscheme +++ b/test_projects/ios/EarlGreyExample/EarlGreyExample.xcodeproj/xcshareddata/xcschemes/EarlGreyExampleSwiftTests.xcscheme @@ -11,6 +11,13 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "NO"> + + + + @@ -23,15 +30,6 @@ - - - - - - - - Date: Fri, 11 Sep 2020 09:43:14 +0200 Subject: [PATCH 07/12] Fix path resolving --- .env | 9 ++++----- test_projects/android/ops.sh | 10 +++++----- test_projects/ios/EarlGreyExample/ops.sh | 10 +++++----- test_projects/ops.sh | 9 +++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.env b/.env index 8680baab4e..70d0b2fa3c 100755 --- a/.env +++ b/.env @@ -1,11 +1,10 @@ #!/usr/bin/env bash -project="$(cd "$(pwd)/$(dirname "$BASH_SOURCE")" && pwd)" +FLANK_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]-$0}")" && pwd)" +TEST_PROJECTS="$FLANK_ROOT/test_projects" +FLANK_FIXTURES_TMP="$FLANK_ROOT/test_runner/src/test/kotlin/ftl/fixtures/tmp" -export FLANK_ROOT=$project -export FLANK_FIXTURES_TMP="$project/test_runner/src/test/kotlin/ftl/fixtures/tmp" - -. "$project/test_projects/ops.sh" +. "$TEST_PROJECTS/ops.sh" function bash_debug() { set -euxo pipefail diff --git a/test_projects/android/ops.sh b/test_projects/android/ops.sh index 38855a923e..d4207b4d65 100644 --- a/test_projects/android/ops.sh +++ b/test_projects/android/ops.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash function base_app_apk() { - local dir=$(dirname "$BASH_SOURCE") + local dir=$TEST_PROJECTS_ANDROID local outputDir="$FLANK_FIXTURES_TMP/apk" for arg in "$@"; do case "$arg" in @@ -23,7 +23,7 @@ function base_app_apk() { # depends on base_app_apk function base_test_apks() { - local dir=$(dirname "$BASH_SOURCE") + local dir=$TEST_PROJECTS_ANDROID for arg in "$@"; do case "$arg" in @@ -44,7 +44,7 @@ function base_test_apks() { # depends on base_app_apk function duplicated_names_apks() { - local dir=$(dirname "$BASH_SOURCE") + local dir=$TEST_PROJECTS_ANDROID for arg in "$@"; do case "$arg" in @@ -61,7 +61,7 @@ function duplicated_names_apks() { local testIn="$dir/app/build/outputs/apk/androidTest/**/debug/*.apk" mkdir -p "$outputDir" - local dir=$(dirname "$BASH_SOURCE") + local dir=$(dirname "${BASH_SOURCE[0]-$0}") local outputDir="$FLANK_FIXTURES_TMP/apk/duplicated_names/" for index in 0 1 2 3; do @@ -76,7 +76,7 @@ function duplicated_names_apks() { } function multi_module_apks() { - local dir=$(dirname "$BASH_SOURCE") + local dir=$TEST_PROJECTS_ANDROID local outputDir="$FLANK_FIXTURES_TMP/apk/multi-modules/" for arg in "$@"; do case "$arg" in diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh index 1185e6001f..8d5fa453e3 100644 --- a/test_projects/ios/EarlGreyExample/ops.sh +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash +EARL_GREY_EXAMPLE="$TEST_PROJECTS_IOS/EarlGreyExample" + function setup_ios_env() { if ! [ -x "$(command -v xcpretty)" ]; then gem install cocoapods fi - local dir=$(dirname "$BASH_SOURCE") - (cd "$dir" && pod install) + (cd "$EARL_GREY_EXAMPLE" && pod install) } function install_xcpretty() { @@ -15,12 +16,11 @@ function install_xcpretty() { } function universal_framework() { - local dir=$(dirname "$BASH_SOURCE") - "$dir/universal_framework.sh" + "$EARL_GREY_EXAMPLE/universal_framework.sh" } function earl_grey_example() { - local dir=$(dirname "$BASH_SOURCE") + local dir=$EARL_GREY_EXAMPLE local buildDir="$dir/build" for arg in "$@"; do case "$arg" in diff --git a/test_projects/ops.sh b/test_projects/ops.sh index 3f1c594e89..2aaf4a4c36 100644 --- a/test_projects/ops.sh +++ b/test_projects/ops.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash -dir="$(dirname "$BASH_SOURCE")" +TEST_PROJECTS_ANDROID="$TEST_PROJECTS/android" +TEST_PROJECTS_IOS="$TEST_PROJECTS/ios" -. "$dir/android/ops.sh" -. "$dir/ios/EarlGreyExample/ops.sh" +. "$TEST_PROJECTS_ANDROID/ops.sh" +. "$TEST_PROJECTS_IOS/EarlGreyExample/ops.sh" function update_test_artifacts() { @@ -20,7 +21,7 @@ function update_test_artifacts() { ;; go) - cp -R "$dir/gohello" "$FLANK_FIXTURES_TMP/" + cp -R "$FLANK_ROOT/test_projects/gohello" "$FLANK_FIXTURES_TMP/" ;; all) From 859705efb656343e6c8b535519d5003f01d72272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Fri, 11 Sep 2020 09:55:59 +0200 Subject: [PATCH 08/12] Fix base_test_apks on zsh --- test_projects/android/ops.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test_projects/android/ops.sh b/test_projects/android/ops.sh index d4207b4d65..fc98c7de9d 100644 --- a/test_projects/android/ops.sh +++ b/test_projects/android/ops.sh @@ -33,10 +33,9 @@ function base_test_apks() { '--copy' | '-c') local outputDir="$FLANK_FIXTURES_TMP/apk" - local testIn="$dir/app/build/outputs/apk/androidTest/**/debug/*.apk" mkdir -p "$outputDir" - cp $testIn $outputDir/ + cp "$dir"/app/build/outputs/apk/androidTest/**/debug/*.apk "$outputDir/" ;; esac done From 686f9f0b1e2352e6d1597e87e201cc497aabcaa1 Mon Sep 17 00:00:00 2001 From: Axel Zuziak Date: Mon, 14 Sep 2020 12:30:31 +0200 Subject: [PATCH 09/12] Added correct path to generate .xctest files --- test_projects/ios/EarlGreyExample/ops.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh index 8d5fa453e3..45b35717a1 100644 --- a/test_projects/ios/EarlGreyExample/ops.sh +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -52,16 +52,16 @@ function earl_grey_example() { local productsDir="$dir/build/Build/Products" - cp -R "$productsDir/*-iphoneos" "$FLANK_FIXTURES_TMP/" + cp -Rf "$productsDir"/*-iphoneos "$FLANK_FIXTURES_TMP/" - cp "$productsDir/*.xctestrun" "$FLANK_FIXTURES_TMP/" + cp "$productsDir"/*.xctestrun "$FLANK_FIXTURES_TMP/" cp \ - "$productsDir/Debug-iphoneos/EarlGreyExampleTests.xctest/EarlGreyExampleTests" \ + "$productsDir/Debug-iphoneos/EarlGreyExampleSwift.app/PlugIns/EarlGreyExampleTests.xctest/EarlGreyExampleTests" \ "$FLANK_FIXTURES_TMP/objc/" cp \ - "$productsDir/Debug-iphoneos/EarlGreyExampleSwiftTests.xctest/EarlGreyExampleSwiftTests" \ + "$productsDir/Debug-iphoneos/EarlGreyExampleSwift.app/PlugIns/EarlGreyExampleSwiftTests.xctest/EarlGreyExampleSwiftTests" \ "$FLANK_FIXTURES_TMP/swift/" ;; From f5e4ccdee9d133579690cefe72fa5bda67ec0622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Mon, 14 Sep 2020 13:29:31 +0200 Subject: [PATCH 10/12] Update test_artifacts.md --- docs/test_artifacts.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/test_artifacts.md b/docs/test_artifacts.md index 536313e62d..68a09456ed 100644 --- a/docs/test_artifacts.md +++ b/docs/test_artifacts.md @@ -1,8 +1,18 @@ # Test artifacts +Test artifacts are necessary for CI and local testing. + +### Generating test artifacts +```bash +cd ... # your flank repositry root +source .env +update_test_artifacts android ios # [ android | go | ios | all ] +``` +`update_test_artifacts` function will generate artifacts and copy them to `test_runner/src/test/kotlin/ftl/fixtures/tmp/` directory. + +# Refactor This is proposal of test artifacts refactoring. -## Context -Test artifacts are necessary for CI and local testing. +## Context Working on different issues sometimes requires different implementations of test artifacts that may exist in same time. ### Problem @@ -33,9 +43,9 @@ Sometimes downloading may fail, but this not aborting test run. For remote storage options see [host_binaries_solutions_comparison.md](./host_binaries_solutions_comparison.md) ## Solution proposal -1. Move source code of test artifacts to one repo. -We should consider flank repo because test_app is already there or dedicated repo linked to flank as git submodule. -2. Prepare missing build scripts and adjust existing. +1. ~~Move source code of test artifacts to one repo. +We should consider flank repo because test_app is already there or dedicated repo linked to flank as git submodule.~~ +2. ~~Prepare missing build scripts and adjust existing.~~ We need dedicated scripts for each artifact group (iOS, Android or different types of each) and one to execute all of them. 3. Choose the best solution for hosting remote artifacts. See `Technical research` section. 4. Integrate artifacts synchronization with remote storage From a5f4ee6ac72d978d378255df2e412860c9a9f961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B3ral?= <60390247+jan-gogo@users.noreply.github.com> Date: Mon, 14 Sep 2020 13:41:22 +0200 Subject: [PATCH 11/12] Update test_artifacts.md --- docs/test_artifacts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/test_artifacts.md b/docs/test_artifacts.md index 68a09456ed..149787d66e 100644 --- a/docs/test_artifacts.md +++ b/docs/test_artifacts.md @@ -45,7 +45,7 @@ For remote storage options see [host_binaries_solutions_comparison.md](./host_bi ## Solution proposal 1. ~~Move source code of test artifacts to one repo. We should consider flank repo because test_app is already there or dedicated repo linked to flank as git submodule.~~ -2. ~~Prepare missing build scripts and adjust existing.~~ -We need dedicated scripts for each artifact group (iOS, Android or different types of each) and one to execute all of them. +2. ~~Prepare missing build scripts and adjust existing. +We need dedicated scripts for each artifact group (iOS, Android or different types of each) and one to execute all of them.~~ 3. Choose the best solution for hosting remote artifacts. See `Technical research` section. 4. Integrate artifacts synchronization with remote storage From d55f857a524bb1d4ec07b297be4f343368ed0a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20G=C3=B3ral?= Date: Mon, 14 Sep 2020 14:00:29 +0200 Subject: [PATCH 12/12] CR fixes --- docs/test_artifacts.md | 7 +++++++ test_projects/android/bash/generate-multi-modules-apks.sh | 2 +- test_projects/android/bash/generate_apks.sh | 2 +- .../android/bash/generate_duplicated_names_apks.sh | 2 +- test_projects/ios/EarlGreyExample/ops.sh | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/test_artifacts.md b/docs/test_artifacts.md index 149787d66e..064217d431 100644 --- a/docs/test_artifacts.md +++ b/docs/test_artifacts.md @@ -9,6 +9,13 @@ update_test_artifacts android ios # [ android | go | ios | all ] ``` `update_test_artifacts` function will generate artifacts and copy them to `test_runner/src/test/kotlin/ftl/fixtures/tmp/` directory. +### Test projects +All source code for test artifacts is located in [test_projects](../test_projects/) directory. + +Each test project can contain own `ops.sh` script used building and coping generated artifacts. + +`update_test_artifacts` function is located in [test_projects/ops.sh](../test_projects/ops.sh) script. + # Refactor This is proposal of test artifacts refactoring. diff --git a/test_projects/android/bash/generate-multi-modules-apks.sh b/test_projects/android/bash/generate-multi-modules-apks.sh index aa849d5110..5c23885eea 100755 --- a/test_projects/android/bash/generate-multi-modules-apks.sh +++ b/test_projects/android/bash/generate-multi-modules-apks.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -echo "DEPRECATED!!!" +echo "DEPRECATED!!! use functions from test_projects/android/ops.sh" set -euxo pipefail diff --git a/test_projects/android/bash/generate_apks.sh b/test_projects/android/bash/generate_apks.sh index b64fe7a674..6698423d4f 100755 --- a/test_projects/android/bash/generate_apks.sh +++ b/test_projects/android/bash/generate_apks.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -echo "DEPRECATED!!!" +echo "DEPRECATED!!! use functions from test_projects/android/ops.sh" set -euxo pipefail diff --git a/test_projects/android/bash/generate_duplicated_names_apks.sh b/test_projects/android/bash/generate_duplicated_names_apks.sh index bb9674ee68..a57f13f9d9 100755 --- a/test_projects/android/bash/generate_duplicated_names_apks.sh +++ b/test_projects/android/bash/generate_duplicated_names_apks.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -echo "DEPRECATED!!!" +echo "DEPRECATED!!! use functions from test_projects/android/ops.sh" set -euxo pipefail diff --git a/test_projects/ios/EarlGreyExample/ops.sh b/test_projects/ios/EarlGreyExample/ops.sh index 45b35717a1..9e13c035da 100644 --- a/test_projects/ios/EarlGreyExample/ops.sh +++ b/test_projects/ios/EarlGreyExample/ops.sh @@ -4,7 +4,7 @@ EARL_GREY_EXAMPLE="$TEST_PROJECTS_IOS/EarlGreyExample" function setup_ios_env() { if ! [ -x "$(command -v xcpretty)" ]; then - gem install cocoapods + gem install cocoapods -v 1.9.3 fi (cd "$EARL_GREY_EXAMPLE" && pod install) }