diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 6c88142429..5a70d47bbb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -13,5 +13,3 @@ A brief description of implementation details of this PR. ### Custom CI job configuration (optional) - [ ] Run unit tests for Session Replay -- [ ] Run smoke tests -- [ ] Run tests for `tools/` diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6e380ad1f..df5e5f4923 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ stages: - lint - test - ui-test + - smoke-test variables: MAIN_BRANCH: "master" @@ -34,6 +35,16 @@ default: - "*" # match any file in the root directory compare_to: 'develop' # cannot use variable due to: https://gitlab.com/gitlab-org/gitlab/-/issues/369916 +# Trigger jobs on changes in `tools/*`, comparing against 'develop' branch +.run:if-tools-modified: + rules: + - changes: + paths: + - "tools/**/*" + - "Makefile" + - ".gitlab-ci.yml" + compare_to: 'develop' + ENV check: stage: pre script: @@ -59,11 +70,12 @@ Unit Tests (iOS): - !reference [.run:when-develop-or-master, rules] - !reference [.run:if-sdk-modified, rules] variables: + XCODE: "15.3.0" OS: "17.4" PLATFORM: "iOS Simulator" DEVICE: "iPhone 15 Pro" script: - - ./tools/runner-setup.sh --ios --os "$OS" # temporary, waiting for AMI + - ./tools/runner-setup.sh --xcode "$XCODE" --iOS --os "$OS" # temporary, waiting for AMI - make clean repo-setup ENV=ci - make test-ios-all OS="$OS" PLATFORM="$PLATFORM" DEVICE="$DEVICE" @@ -73,11 +85,12 @@ Unit Tests (tvOS): - !reference [.run:when-develop-or-master, rules] - !reference [.run:if-sdk-modified, rules] variables: + XCODE: "15.3.0" OS: "17.4" PLATFORM: "tvOS Simulator" DEVICE: "Apple TV" script: - - ./tools/runner-setup.sh --tvos --os "$OS" # temporary, waiting for AMI + - ./tools/runner-setup.sh --xcode "$XCODE" --tvOS --os "$OS" # temporary, waiting for AMI - make clean repo-setup ENV=ci - make test-tvos-all OS="$OS" PLATFORM="$PLATFORM" DEVICE="$DEVICE" @@ -87,6 +100,7 @@ UI Tests: - !reference [.run:when-develop-or-master, rules] - !reference [.run:if-sdk-modified, rules] variables: + XCODE: "15.3.0" OS: "17.4" PLATFORM: "iOS Simulator" DEVICE: "iPhone 15 Pro" @@ -98,6 +112,72 @@ UI Tests: - CrashReporting - NetworkInstrumentation script: - - ./tools/runner-setup.sh --ios --os "$OS" # temporary, waiting for AMI + - ./tools/runner-setup.sh --xcode "$XCODE" --iOS --os "$OS" # temporary, waiting for AMI - make clean repo-setup ENV=ci - make ui-test TEST_PLAN="$TEST_PLAN" OS="$OS" PLATFORM="$PLATFORM" DEVICE="$DEVICE" + +Tools Tests: + stage: test + rules: + - !reference [.run:when-develop-or-master, rules] + - !reference [.run:if-tools-modified, rules] + script: + - make clean repo-setup ENV=ci + - make tools-test + +Smoke Tests (iOS): + stage: smoke-test + tags: + - macos:ventura + - specific:true + variables: + XCODE: "15.2.0" + OS: "17.2" + PLATFORM: "iOS Simulator" + DEVICE: "iPhone 15 Pro" + script: + - ./tools/runner-setup.sh --xcode "$XCODE" --iOS --os "$OS" # temporary, waiting for AMI + - make clean repo-setup ENV=ci + - make spm-build-ios + - make smoke-test-ios-all OS="$OS" PLATFORM="$PLATFORM" DEVICE="$DEVICE" + +Smoke Tests (tvOS): + stage: smoke-test + tags: + - macos:ventura + - specific:true + variables: + XCODE: "15.2.0" + OS: "17.2" + PLATFORM: "tvOS Simulator" + DEVICE: "Apple TV" + script: + - ./tools/runner-setup.sh --xcode "$XCODE" --tvOS --os "$OS" # temporary, waiting for AMI + - make clean repo-setup ENV=ci + - make spm-build-tvos + - make smoke-test-tvos-all OS="$OS" PLATFORM="$PLATFORM" DEVICE="$DEVICE" + +Smoke Tests (visionOS): + stage: smoke-test + tags: + - macos:ventura + - specific:true + variables: + XCODE: "15.2.0" + OS: "1.0" + script: + - ./tools/runner-setup.sh --xcode "$XCODE" --visionOS --os "$OS" # temporary, waiting for AMI + - make clean repo-setup ENV=ci + - make spm-build-visionos + +Smoke Tests (macOS): + stage: smoke-test + tags: + - macos:ventura + - specific:true + variables: + XCODE: "15.2.0" + script: + - ./tools/runner-setup.sh --xcode "$XCODE" # temporary, waiting for AMI + - make clean repo-setup ENV=ci + - make spm-build-macos diff --git a/Datadog.xcworkspace/contents.xcworkspacedata b/Datadog.xcworkspace/contents.xcworkspacedata index 6d86ab3776..d52e6b154b 100644 --- a/Datadog.xcworkspace/contents.xcworkspacedata +++ b/Datadog.xcworkspace/contents.xcworkspacedata @@ -4,7 +4,4 @@ - - diff --git a/IntegrationTests/IntegrationTests.xcodeproj/project.pbxproj b/IntegrationTests/IntegrationTests.xcodeproj/project.pbxproj index d807d82934..a302091506 100644 --- a/IntegrationTests/IntegrationTests.xcodeproj/project.pbxproj +++ b/IntegrationTests/IntegrationTests.xcodeproj/project.pbxproj @@ -259,7 +259,7 @@ D2774EE2299E2E90004EC36A /* LogMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogMatcher.swift; sourceTree = ""; }; D2774EE3299E2E90004EC36A /* JSONDataMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONDataMatcher.swift; sourceTree = ""; }; D2791EF827170A760046E07A /* RUMSwiftUIScenarioTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RUMSwiftUIScenarioTests.swift; sourceTree = ""; }; - D29495F429967780003518CD /* http-server-mock */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "http-server-mock"; path = "../instrumented-tests/http-server-mock"; sourceTree = ""; }; + D29495F429967780003518CD /* http-server-mock */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "http-server-mock"; path = "../tools/http-server-mock"; sourceTree = ""; }; D2A401D029925A2D00B230A3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D2AEFF1A29925BEC00A28997 /* CrashReporting.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = CrashReporting.xctestplan; sourceTree = ""; }; D2AEFF1B29925BEC00A28997 /* Default.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Default.xctestplan; sourceTree = ""; }; diff --git a/IntegrationTests/IntegrationTests.xcodeproj/xcshareddata/xcschemes/IntegrationScenarios.xcscheme b/IntegrationTests/IntegrationTests.xcodeproj/xcshareddata/xcschemes/IntegrationScenarios.xcscheme index 91786a7ad1..a712a937ce 100644 --- a/IntegrationTests/IntegrationTests.xcodeproj/xcshareddata/xcschemes/IntegrationScenarios.xcscheme +++ b/IntegrationTests/IntegrationTests.xcodeproj/xcshareddata/xcschemes/IntegrationScenarios.xcscheme @@ -66,7 +66,7 @@ ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction"> + scriptText = "REPOSITORY_ROOT="${SRCROOT}/.." cd "${REPOSITORY_ROOT}" && ./tools/http-server-mock/python/start_mock_server.py& "> + scriptText = "REPOSITORY_ROOT="${SRCROOT}/.." cd "${REPOSITORY_ROOT}" && ./tools/http-server-mock/python/start_mock_server.py& "> Cartfile +ifeq ($(CARTHAGE_PLATFORM),) + @$(ECHO_ERROR) "No CARTHAGE_PLATFORM is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif + @$(ECHO_SUCCESS) "Using CARTHAGE_PLATFORM='$(CARTHAGE_PLATFORM)'" + carthage update --platform $(CARTHAGE_PLATFORM) --use-xcframeworks + +test: + @$(call require_param,OS) + @$(call require_param,PLATFORM) + @$(call require_param,DEVICE) + @$(ECHO_SUBTITLE2) "make test OS='$(OS)' PLATFORM='$(PLATFORM)' DEVICE='$(DEVICE)'" +ifeq ($(SCHEME),) + @$(ECHO_ERROR) "No SCHEME is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif +ifeq ($(EXPECTED_XCFRAMEWORKS),) + @$(ECHO_ERROR) "No EXPECTED_XCFRAMEWORKS is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif + @$(ECHO_SUCCESS) "Using SCHEME='$(SCHEME)'" + @$(ECHO_SUCCESS) "Using EXPECTED_XCFRAMEWORKS='$(EXPECTED_XCFRAMEWORKS)'" + @echo "Check XCFrameworks in $(PWD)/Carthage/Build/" + @$(foreach xcf,$(EXPECTED_XCFRAMEWORKS),\ + if [ -d "Carthage/Build/$(xcf).xcframework" ]; then \ + $(ECHO_SUCCESS) "$(xcf).xcframework exists"; \ + else \ + $(ECHO_ERROR) "$(xcf).xcframework is missing" && exit 1; \ + fi;) + set -eo pipefail; \ + xcodebuild -version; \ + xcodebuild -project "CTProject.xcodeproj" -destination "platform=$(PLATFORM),name=$(DEVICE),OS=$(OS)" -scheme "$(SCHEME)" test | xcbeautify diff --git a/dependency-manager-tests/cocoapods/App/AppDelegate.swift b/SmokeTests/cocoapods/App/AppDelegate.swift similarity index 100% rename from dependency-manager-tests/cocoapods/App/AppDelegate.swift rename to SmokeTests/cocoapods/App/AppDelegate.swift diff --git a/dependency-manager-tests/cocoapods/App/Info.plist b/SmokeTests/cocoapods/App/Info.plist similarity index 100% rename from dependency-manager-tests/cocoapods/App/Info.plist rename to SmokeTests/cocoapods/App/Info.plist diff --git a/dependency-manager-tests/cocoapods/App/PrivacyInfo.xcprivacy b/SmokeTests/cocoapods/App/PrivacyInfo.xcprivacy similarity index 100% rename from dependency-manager-tests/cocoapods/App/PrivacyInfo.xcprivacy rename to SmokeTests/cocoapods/App/PrivacyInfo.xcprivacy diff --git a/dependency-manager-tests/cocoapods/App/SceneDelegate.swift b/SmokeTests/cocoapods/App/SceneDelegate.swift similarity index 100% rename from dependency-manager-tests/cocoapods/App/SceneDelegate.swift rename to SmokeTests/cocoapods/App/SceneDelegate.swift diff --git a/dependency-manager-tests/cocoapods/App/ViewController.swift b/SmokeTests/cocoapods/App/ViewController.swift similarity index 100% rename from dependency-manager-tests/cocoapods/App/ViewController.swift rename to SmokeTests/cocoapods/App/ViewController.swift diff --git a/dependency-manager-tests/cocoapods/AppTests/CPProjectTests.swift b/SmokeTests/cocoapods/AppTests/CPProjectTests.swift similarity index 100% rename from dependency-manager-tests/cocoapods/AppTests/CPProjectTests.swift rename to SmokeTests/cocoapods/AppTests/CPProjectTests.swift diff --git a/dependency-manager-tests/cocoapods/AppTests/Info.plist b/SmokeTests/cocoapods/AppTests/Info.plist similarity index 100% rename from dependency-manager-tests/cocoapods/AppTests/Info.plist rename to SmokeTests/cocoapods/AppTests/Info.plist diff --git a/dependency-manager-tests/cocoapods/AppUITests/CPProjectUITests.swift b/SmokeTests/cocoapods/AppUITests/CPProjectUITests.swift similarity index 100% rename from dependency-manager-tests/cocoapods/AppUITests/CPProjectUITests.swift rename to SmokeTests/cocoapods/AppUITests/CPProjectUITests.swift diff --git a/dependency-manager-tests/cocoapods/AppUITests/Info.plist b/SmokeTests/cocoapods/AppUITests/Info.plist similarity index 100% rename from dependency-manager-tests/cocoapods/AppUITests/Info.plist rename to SmokeTests/cocoapods/AppUITests/Info.plist diff --git a/dependency-manager-tests/cocoapods/CPProject.xcodeproj/project.pbxproj b/SmokeTests/cocoapods/CPProject.xcodeproj/project.pbxproj similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcodeproj/project.pbxproj rename to SmokeTests/cocoapods/CPProject.xcodeproj/project.pbxproj diff --git a/dependency-manager-tests/cocoapods/CPProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SmokeTests/cocoapods/CPProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to SmokeTests/cocoapods/CPProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/dependency-manager-tests/cocoapods/CPProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SmokeTests/cocoapods/CPProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to SmokeTests/cocoapods/CPProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic iOS.xcscheme b/SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic iOS.xcscheme similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic iOS.xcscheme rename to SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic iOS.xcscheme diff --git a/dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic tvOS.xcscheme b/SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic tvOS.xcscheme similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic tvOS.xcscheme rename to SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Dynamic tvOS.xcscheme diff --git a/dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static iOS.xcscheme b/SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static iOS.xcscheme similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static iOS.xcscheme rename to SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static iOS.xcscheme diff --git a/dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static tvOS.xcscheme b/SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static tvOS.xcscheme similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static tvOS.xcscheme rename to SmokeTests/cocoapods/CPProject.xcodeproj/xcshareddata/xcschemes/App Static tvOS.xcscheme diff --git a/dependency-manager-tests/cocoapods/CPProject.xcworkspace/contents.xcworkspacedata b/SmokeTests/cocoapods/CPProject.xcworkspace/contents.xcworkspacedata similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcworkspace/contents.xcworkspacedata rename to SmokeTests/cocoapods/CPProject.xcworkspace/contents.xcworkspacedata diff --git a/dependency-manager-tests/cocoapods/CPProject.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SmokeTests/cocoapods/CPProject.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from dependency-manager-tests/cocoapods/CPProject.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to SmokeTests/cocoapods/CPProject.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/SmokeTests/cocoapods/Makefile b/SmokeTests/cocoapods/Makefile new file mode 100644 index 0000000000..084a098656 --- /dev/null +++ b/SmokeTests/cocoapods/Makefile @@ -0,0 +1,60 @@ +.PHONY: clean install test + +REPO_ROOT := ../../ +include ../../tools/utils/common.mk + +ifeq ($(PLATFORM), iOS Simulator) +SCHEME1 := App Dynamic iOS +SCHEME2 := App Static iOS +else ifeq ($(PLATFORM), tvOS Simulator) +SCHEME1 := App Dynamic tvOS +SCHEME2 := App Static tvOS +endif + +ifeq ($(CURRENT_GIT_TAG),) + ifeq ($(CURRENT_GIT_BRANCH),) + $(error Cannot set COCOAPODS_GIT_REF because CURRENT_GIT_BRANCH is empty) + else + COCOAPODS_GIT_REF := branch => '$(CURRENT_GIT_BRANCH)' + endif +else + COCOAPODS_GIT_REF := tag => '$(CURRENT_GIT_TAG)' +endif + +clean: + @$(ECHO_SUBTITLE2) "make clean" + rm -rf Pods + +install: + @$(ECHO_SUBTITLE2) "make install" + @$(ECHO_SUCCESS) "Preparing for CURRENT_GIT_REF='${CURRENT_GIT_REF}'" +ifeq ($(COCOAPODS_GIT_REF),) + @$(ECHO_ERROR) "No COCOAPODS_GIT_REF is defined for CURRENT_GIT_REF='$(CURRENT_GIT_REF)'" + @exit 1 +endif + @$(ECHO_SUCCESS) "Using COCOAPODS_GIT_REF='$(COCOAPODS_GIT_REF)'" + sed "s|GIT_REFERENCE|${COCOAPODS_GIT_REF}|g" Podfile.src > Podfile + bundle exec pod update + +test: + @$(call require_param,OS) + @$(call require_param,PLATFORM) + @$(call require_param,DEVICE) + @$(ECHO_SUBTITLE2) "make test OS='$(OS)' PLATFORM='$(PLATFORM)' DEVICE='$(DEVICE)'" +ifeq ($(SCHEME1),) + @$(ECHO_ERROR) "No SCHEME1 is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif +ifeq ($(SCHEME2),) + @$(ECHO_ERROR) "No SCHEME2 is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif + @$(ECHO_SUBTITLE2) "➔ Testing SCHEME='$(SCHEME1)'" + set -eo pipefail; \ + xcodebuild -version; \ + xcodebuild -workspace "CPProject.xcworkspace" -destination "platform=$(PLATFORM),name=$(DEVICE),OS=$(OS)" -scheme "$(SCHEME1)" test | xcbeautify + + @$(ECHO_SUBTITLE2) "➔ Testing SCHEME='$(SCHEME2)'" + set -eo pipefail; \ + xcodebuild -version; \ + xcodebuild -workspace "CPProject.xcworkspace" -destination "platform=$(PLATFORM),name=$(DEVICE),OS=$(OS)" -scheme "$(SCHEME2)" test | xcbeautify diff --git a/SmokeTests/cocoapods/Podfile.src b/SmokeTests/cocoapods/Podfile.src new file mode 100644 index 0000000000..7e400c116b --- /dev/null +++ b/SmokeTests/cocoapods/Podfile.src @@ -0,0 +1,43 @@ +abstract_target 'Common' do + pod 'OpenTelemetrySwiftApi', '1.6.0' + pod 'DatadogInternal', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogCore', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogLogs', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogTrace', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogRUM', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogCore', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogSessionReplay', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogAlamofireExtension', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogCrashReporting', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'DatadogObjc', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + pod 'Alamofire' + + target 'App Dynamic iOS' do + platform :ios, '13.0' + use_frameworks! + pod 'DatadogWebViewTracking', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + end + + target 'App Static iOS' do + platform :ios, '13.0' + pod 'DatadogWebViewTracking', :git => 'https://github.com/DataDog/dd-sdk-ios.git', :GIT_REFERENCE + + target 'App Static iOS Tests' do + inherit! :search_paths + end + end + + target 'App Dynamic tvOS' do + platform :tvos, '13.0' + use_frameworks! + end + + target 'App Static tvOS' do + platform :tvos, '13.0' + + target 'App Static tvOS Tests' do + inherit! :search_paths + end + end + +end diff --git a/dependency-manager-tests/spm/App/AppDelegate.swift b/SmokeTests/spm/App/AppDelegate.swift similarity index 100% rename from dependency-manager-tests/spm/App/AppDelegate.swift rename to SmokeTests/spm/App/AppDelegate.swift diff --git a/dependency-manager-tests/spm/App/Info.plist b/SmokeTests/spm/App/Info.plist similarity index 100% rename from dependency-manager-tests/spm/App/Info.plist rename to SmokeTests/spm/App/Info.plist diff --git a/dependency-manager-tests/spm/App/PrivacyInfo.xcprivacy b/SmokeTests/spm/App/PrivacyInfo.xcprivacy similarity index 100% rename from dependency-manager-tests/spm/App/PrivacyInfo.xcprivacy rename to SmokeTests/spm/App/PrivacyInfo.xcprivacy diff --git a/dependency-manager-tests/spm/App/SceneDelegate.swift b/SmokeTests/spm/App/SceneDelegate.swift similarity index 100% rename from dependency-manager-tests/spm/App/SceneDelegate.swift rename to SmokeTests/spm/App/SceneDelegate.swift diff --git a/dependency-manager-tests/spm/App/ViewController.swift b/SmokeTests/spm/App/ViewController.swift similarity index 100% rename from dependency-manager-tests/spm/App/ViewController.swift rename to SmokeTests/spm/App/ViewController.swift diff --git a/dependency-manager-tests/spm/AppTests/AppTests.swift b/SmokeTests/spm/AppTests/AppTests.swift similarity index 100% rename from dependency-manager-tests/spm/AppTests/AppTests.swift rename to SmokeTests/spm/AppTests/AppTests.swift diff --git a/dependency-manager-tests/spm/AppTests/Info.plist b/SmokeTests/spm/AppTests/Info.plist similarity index 100% rename from dependency-manager-tests/spm/AppTests/Info.plist rename to SmokeTests/spm/AppTests/Info.plist diff --git a/dependency-manager-tests/spm/AppUITests/AppUITests.swift b/SmokeTests/spm/AppUITests/AppUITests.swift similarity index 100% rename from dependency-manager-tests/spm/AppUITests/AppUITests.swift rename to SmokeTests/spm/AppUITests/AppUITests.swift diff --git a/dependency-manager-tests/spm/AppUITests/Info.plist b/SmokeTests/spm/AppUITests/Info.plist similarity index 100% rename from dependency-manager-tests/spm/AppUITests/Info.plist rename to SmokeTests/spm/AppUITests/Info.plist diff --git a/SmokeTests/spm/Makefile b/SmokeTests/spm/Makefile new file mode 100644 index 0000000000..8f7c2b68b9 --- /dev/null +++ b/SmokeTests/spm/Makefile @@ -0,0 +1,45 @@ +.PHONY: clean install test create-src-from-xcodeproj + +REPO_ROOT := ../../ +include ../../tools/utils/common.mk + +ifeq ($(PLATFORM), iOS Simulator) +SCHEME := App iOS +else ifeq ($(PLATFORM), tvOS Simulator) +SCHEME := App tvOS +endif + +clean: + @$(ECHO_SUBTITLE2) "make clean" + rm -rf SPMProject.xcodeproj + +install: + @$(ECHO_SUBTITLE2) "make install" + @$(ECHO_SUCCESS) "Preparing for CURRENT_GIT_REF='${CURRENT_GIT_REF}'" + cp -r SPMProject.xcodeproj.src SPMProject.xcodeproj + sed "s|GIT_REFERENCE|${CURRENT_GIT_REF}|g" SPMProject.xcodeproj.src/project.pbxproj | \ + sed "s|GIT_REMOTE|${CURRENT_GIT_REF}|g" > SPMProject.xcodeproj/project.pbxproj + +test: + @$(call require_param,OS) + @$(call require_param,PLATFORM) + @$(call require_param,DEVICE) + @$(ECHO_SUBTITLE2) "make test OS='$(OS)' PLATFORM='$(PLATFORM)' DEVICE='$(DEVICE)'" +ifeq ($(SCHEME),) + @$(ECHO_ERROR) "No SCHEME is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif + @$(ECHO_SUCCESS) "Using SCHEME='$(SCHEME)'" + set -eo pipefail; \ + xcodebuild -version; \ + xcodebuild -project "SPMProject.xcodeproj" -destination "platform=$(PLATFORM),name=$(DEVICE),OS=$(OS)" -scheme "$(SCHEME)" test | xcbeautify + +# Helper to apply any changes made to 'SPMProject.xcodeproj' back to 'SPMProject.xcodeproj.src' +create-src-from-xcodeproj: + @$(ECHO_SUBTITLE2) "make create-src-from-xcodeproj" + @echo "Creating 'SPMProject.xcodeproj.src' template from 'SPMProject.xcodeproj'" + rm -rf SPMProject.xcodeproj.src + cp -r SPMProject.xcodeproj SPMProject.xcodeproj.src + rm SPMProject.xcodeproj.src/project.xcworkspace/xcshareddata/swiftpm/Package.resolved + sed "s|${CURRENT_GIT_REF}|GIT_REFERENCE|g" SPMProject.xcodeproj/project.pbxproj > SPMProject.xcodeproj.src/project.pbxproj + @$(ECHO_SUCCESS) "'SPMProject.xcodeproj.src' template was updated from 'SPMProject.xcodeproj'" diff --git a/dependency-manager-tests/spm/README.md b/SmokeTests/spm/README.md similarity index 100% rename from dependency-manager-tests/spm/README.md rename to SmokeTests/spm/README.md diff --git a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/project.pbxproj b/SmokeTests/spm/SPMProject.xcodeproj.src/project.pbxproj similarity index 77% rename from dependency-manager-tests/spm/SPMProject.xcodeproj.src/project.pbxproj rename to SmokeTests/spm/SPMProject.xcodeproj.src/project.pbxproj index ecf6a4b36c..80ad27fbc6 100644 --- a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/project.pbxproj +++ b/SmokeTests/spm/SPMProject.xcodeproj.src/project.pbxproj @@ -14,17 +14,8 @@ 61C363F124374D6100C4D4E6 /* AppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61C363F024374D6100C4D4E6 /* AppTests.swift */; }; 61C363FC24374D6100C4D4E6 /* AppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61C363FB24374D6100C4D4E6 /* AppUITests.swift */; }; 9E73374026B0123500917C24 /* DatadogCrashReporting in Frameworks */ = {isa = PBXBuildFile; productRef = 9E73373F26B0123500917C24 /* DatadogCrashReporting */; }; - A71398892BD127790050A54E /* App_macOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71398882BD127790050A54E /* App_macOSApp.swift */; }; - A713988B2BD127790050A54E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A713988A2BD127790050A54E /* ContentView.swift */; }; - A71398A52BD1277A0050A54E /* App_macOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71398A42BD1277A0050A54E /* App_macOSUITests.swift */; }; A71398B22BD12B6D0050A54E /* DatadogSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71398B12BD12B6D0050A54E /* DatadogSetup.swift */; }; A71398B32BD12B6D0050A54E /* DatadogSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71398B12BD12B6D0050A54E /* DatadogSetup.swift */; }; - A71398B42BD12B6D0050A54E /* DatadogSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71398B12BD12B6D0050A54E /* DatadogSetup.swift */; }; - A71398B62BD12BC60050A54E /* DatadogCore in Frameworks */ = {isa = PBXBuildFile; productRef = A71398B52BD12BC60050A54E /* DatadogCore */; }; - A71398B82BD12BC60050A54E /* DatadogCrashReporting in Frameworks */ = {isa = PBXBuildFile; productRef = A71398B72BD12BC60050A54E /* DatadogCrashReporting */; }; - A71398BA2BD12BC60050A54E /* DatadogLogs in Frameworks */ = {isa = PBXBuildFile; productRef = A71398B92BD12BC60050A54E /* DatadogLogs */; }; - A71398BC2BD12BC60050A54E /* DatadogTrace in Frameworks */ = {isa = PBXBuildFile; productRef = A71398BB2BD12BC60050A54E /* DatadogTrace */; }; - A71398BE2BD12BC60050A54E /* DatadogWebViewTracking in Frameworks */ = {isa = PBXBuildFile; productRef = A71398BD2BD12BC60050A54E /* DatadogWebViewTracking */; }; D22919312B76589B00C38A18 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D22919302B76589B00C38A18 /* PrivacyInfo.xcprivacy */; }; D22919322B76589B00C38A18 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D22919302B76589B00C38A18 /* PrivacyInfo.xcprivacy */; }; D2344E1F29ACDE61007F5BD2 /* DatadogLogs in Frameworks */ = {isa = PBXBuildFile; productRef = D2344E1E29ACDE61007F5BD2 /* DatadogLogs */; }; @@ -61,13 +52,6 @@ remoteGlobalIDString = 61C363D524374D5F00C4D4E6; remoteInfo = SPMProject; }; - A71398A12BD1277A0050A54E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 61C363CE24374D5F00C4D4E6 /* Project object */; - proxyType = 1; - remoteGlobalIDString = A71398852BD127790050A54E; - remoteInfo = "App macOS"; - }; D23BF61827CCCE2300BB4CCD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 61C363CE24374D5F00C4D4E6 /* Project object */; @@ -121,13 +105,7 @@ 61C363FD24374D6100C4D4E6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61CE5FD52461D3C2005EA621 /* Datadog.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Datadog.xcconfig; sourceTree = ""; }; 61CE5FD62461D3C2005EA621 /* Datadog.local.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Datadog.local.xcconfig; sourceTree = ""; }; - A71398862BD127790050A54E /* App macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "App macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - A71398882BD127790050A54E /* App_macOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App_macOSApp.swift; sourceTree = ""; }; - A713988A2BD127790050A54E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; - A71398A02BD1277A0050A54E /* App macOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "App macOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - A71398A42BD1277A0050A54E /* App_macOSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App_macOSUITests.swift; sourceTree = ""; }; A71398B12BD12B6D0050A54E /* DatadogSetup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatadogSetup.swift; sourceTree = ""; }; - A7DFE01A2BD131D90024E5E1 /* App_macOS.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = App_macOS.entitlements; sourceTree = ""; }; D22919302B76589B00C38A18 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; D23BF5FE27CCCC3300BB4CCD /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; D23BF60A27CCCCF800BB4CCD /* App tvOS UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "App tvOS UITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -164,25 +142,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - A71398832BD127790050A54E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - A71398B82BD12BC60050A54E /* DatadogCrashReporting in Frameworks */, - A71398BE2BD12BC60050A54E /* DatadogWebViewTracking in Frameworks */, - A71398BA2BD12BC60050A54E /* DatadogLogs in Frameworks */, - A71398B62BD12BC60050A54E /* DatadogCore in Frameworks */, - A71398BC2BD12BC60050A54E /* DatadogTrace in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A713989D2BD1277A0050A54E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; D23BF5F627CCCC3300BB4CCD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -221,8 +180,6 @@ 61C363D824374D5F00C4D4E6 /* App */, 61C363EF24374D6100C4D4E6 /* AppTests */, 61C363FA24374D6100C4D4E6 /* AppUITests */, - A71398872BD127790050A54E /* App macOS */, - A71398A32BD1277A0050A54E /* App macOSUITests */, 61C363D724374D5F00C4D4E6 /* Products */, 9EC32C6024E596C20063BCCE /* Frameworks */, ); @@ -237,8 +194,6 @@ D23BF5FE27CCCC3300BB4CCD /* App.app */, D23BF60A27CCCCF800BB4CCD /* App tvOS UITests.xctest */, D23BF61627CCCD5700BB4CCD /* App tvOS Tests.xctest */, - A71398862BD127790050A54E /* App macOS.app */, - A71398A02BD1277A0050A54E /* App macOSUITests.xctest */, ); name = Products; sourceTree = ""; @@ -290,24 +245,6 @@ name = Frameworks; sourceTree = ""; }; - A71398872BD127790050A54E /* App macOS */ = { - isa = PBXGroup; - children = ( - A7DFE01A2BD131D90024E5E1 /* App_macOS.entitlements */, - A71398882BD127790050A54E /* App_macOSApp.swift */, - A713988A2BD127790050A54E /* ContentView.swift */, - ); - path = "App macOS"; - sourceTree = ""; - }; - A71398A32BD1277A0050A54E /* App macOSUITests */ = { - isa = PBXGroup; - children = ( - A71398A42BD1277A0050A54E /* App_macOSUITests.swift */, - ); - path = "App macOSUITests"; - sourceTree = ""; - }; A787CA7D2BD277190053CEBE /* Shared */ = { isa = PBXGroup; children = ( @@ -384,48 +321,6 @@ productReference = 61C363F724374D6100C4D4E6 /* App iOS UITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; - A71398852BD127790050A54E /* App macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = A71398AE2BD1277A0050A54E /* Build configuration list for PBXNativeTarget "App macOS" */; - buildPhases = ( - A71398822BD127790050A54E /* Sources */, - A71398832BD127790050A54E /* Frameworks */, - A71398842BD127790050A54E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "App macOS"; - packageProductDependencies = ( - A71398B52BD12BC60050A54E /* DatadogCore */, - A71398B72BD12BC60050A54E /* DatadogCrashReporting */, - A71398B92BD12BC60050A54E /* DatadogLogs */, - A71398BB2BD12BC60050A54E /* DatadogTrace */, - A71398BD2BD12BC60050A54E /* DatadogWebViewTracking */, - ); - productName = "App macOS"; - productReference = A71398862BD127790050A54E /* App macOS.app */; - productType = "com.apple.product-type.application"; - }; - A713989F2BD1277A0050A54E /* App macOSUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = A71398B02BD1277A0050A54E /* Build configuration list for PBXNativeTarget "App macOSUITests" */; - buildPhases = ( - A713989C2BD1277A0050A54E /* Sources */, - A713989D2BD1277A0050A54E /* Frameworks */, - A713989E2BD1277A0050A54E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - A71398A22BD1277A0050A54E /* PBXTargetDependency */, - ); - name = "App macOSUITests"; - productName = "App macOSUITests"; - productReference = A71398A02BD1277A0050A54E /* App macOSUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; D23BF5EF27CCCC3300BB4CCD /* App tvOS */ = { isa = PBXNativeTarget; buildConfigurationList = D23BF5FB27CCCC3300BB4CCD /* Build configuration list for PBXNativeTarget "App tvOS" */; @@ -510,13 +405,6 @@ CreatedOnToolsVersion = 11.4; TestTargetID = 61C363D524374D5F00C4D4E6; }; - A71398852BD127790050A54E = { - CreatedOnToolsVersion = 15.3; - }; - A713989F2BD1277A0050A54E = { - CreatedOnToolsVersion = 15.3; - TestTargetID = A71398852BD127790050A54E; - }; D23BF60027CCCCF800BB4CCD = { TestTargetID = D23BF5EF27CCCC3300BB4CCD; }; @@ -547,8 +435,6 @@ D23BF5EF27CCCC3300BB4CCD /* App tvOS */, D23BF60C27CCCD5700BB4CCD /* App tvOS Tests */, D23BF60027CCCCF800BB4CCD /* App tvOS UITests */, - A71398852BD127790050A54E /* App macOS */, - A713989F2BD1277A0050A54E /* App macOSUITests */, ); }; /* End PBXProject section */ @@ -576,20 +462,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - A71398842BD127790050A54E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A713989E2BD1277A0050A54E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; D23BF5F827CCCC3300BB4CCD /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -683,24 +555,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - A71398822BD127790050A54E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A713988B2BD127790050A54E /* ContentView.swift in Sources */, - A71398892BD127790050A54E /* App_macOSApp.swift in Sources */, - A71398B42BD12B6D0050A54E /* DatadogSetup.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A713989C2BD1277A0050A54E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A71398A52BD1277A0050A54E /* App_macOSUITests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; D23BF5F227CCCC3300BB4CCD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -741,11 +595,6 @@ target = 61C363D524374D5F00C4D4E6 /* App iOS */; targetProxy = 61C363F824374D6100C4D4E6 /* PBXContainerItemProxy */; }; - A71398A22BD1277A0050A54E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = A71398852BD127790050A54E /* App macOS */; - targetProxy = A71398A12BD1277A0050A54E /* PBXContainerItemProxy */; - }; D23BF61927CCCE2300BB4CCD /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D23BF5EF27CCCC3300BB4CCD /* App tvOS */; @@ -1019,130 +868,6 @@ }; name = Release; }; - A71398A82BD1277A0050A54E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_ENTITLEMENTS = "App macOS/App_macOS.entitlements"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_PREVIEWS = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 Datadog. All rights reserved."; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 12; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.datadoghq.SPMProjectMacOS; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - A71398A92BD1277A0050A54E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_ENTITLEMENTS = "App macOS/App_macOS.entitlements"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_PREVIEWS = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 Datadog. All rights reserved."; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 12; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.datadoghq.SPMProjectMacOS; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = macosx; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - A71398AC2BD1277A0050A54E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 12; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.datadoghq.SPMProjectMacOSUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TEST_TARGET_NAME = "App macOS"; - }; - name = Debug; - }; - A71398AD2BD1277A0050A54E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 12; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.datadoghq.SPMProjectMacOSUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = macosx; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TEST_TARGET_NAME = "App macOS"; - }; - name = Release; - }; D23BF5FC27CCCC3300BB4CCD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1320,24 +1045,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - A71398AE2BD1277A0050A54E /* Build configuration list for PBXNativeTarget "App macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A71398A82BD1277A0050A54E /* Debug */, - A71398A92BD1277A0050A54E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A71398B02BD1277A0050A54E /* Build configuration list for PBXNativeTarget "App macOSUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A71398AC2BD1277A0050A54E /* Debug */, - A71398AD2BD1277A0050A54E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; D23BF5FB27CCCC3300BB4CCD /* Build configuration list for PBXNativeTarget "App tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1397,31 +1104,6 @@ package = 9E73373E26B0123500917C24 /* XCRemoteSwiftPackageReference "dd-sdk-ios" */; productName = DatadogCrashReporting; }; - A71398B52BD12BC60050A54E /* DatadogCore */ = { - isa = XCSwiftPackageProductDependency; - package = 9E73373E26B0123500917C24 /* XCRemoteSwiftPackageReference "dd-sdk-ios" */; - productName = DatadogCore; - }; - A71398B72BD12BC60050A54E /* DatadogCrashReporting */ = { - isa = XCSwiftPackageProductDependency; - package = 9E73373E26B0123500917C24 /* XCRemoteSwiftPackageReference "dd-sdk-ios" */; - productName = DatadogCrashReporting; - }; - A71398B92BD12BC60050A54E /* DatadogLogs */ = { - isa = XCSwiftPackageProductDependency; - package = 9E73373E26B0123500917C24 /* XCRemoteSwiftPackageReference "dd-sdk-ios" */; - productName = DatadogLogs; - }; - A71398BB2BD12BC60050A54E /* DatadogTrace */ = { - isa = XCSwiftPackageProductDependency; - package = 9E73373E26B0123500917C24 /* XCRemoteSwiftPackageReference "dd-sdk-ios" */; - productName = DatadogTrace; - }; - A71398BD2BD12BC60050A54E /* DatadogWebViewTracking */ = { - isa = XCSwiftPackageProductDependency; - package = 9E73373E26B0123500917C24 /* XCRemoteSwiftPackageReference "dd-sdk-ios" */; - productName = DatadogWebViewTracking; - }; D2344E1E29ACDE61007F5BD2 /* DatadogLogs */ = { isa = XCSwiftPackageProductDependency; package = 9E73373E26B0123500917C24 /* XCRemoteSwiftPackageReference "dd-sdk-ios" */; diff --git a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/project.xcworkspace/contents.xcworkspacedata b/SmokeTests/spm/SPMProject.xcodeproj.src/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from dependency-manager-tests/spm/SPMProject.xcodeproj.src/project.xcworkspace/contents.xcworkspacedata rename to SmokeTests/spm/SPMProject.xcodeproj.src/project.xcworkspace/contents.xcworkspacedata diff --git a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SmokeTests/spm/SPMProject.xcodeproj.src/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from dependency-manager-tests/spm/SPMProject.xcodeproj.src/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to SmokeTests/spm/SPMProject.xcodeproj.src/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App iOS.xcscheme b/SmokeTests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App iOS.xcscheme similarity index 100% rename from dependency-manager-tests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App iOS.xcscheme rename to SmokeTests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App iOS.xcscheme diff --git a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App tvOS.xcscheme b/SmokeTests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App tvOS.xcscheme similarity index 100% rename from dependency-manager-tests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App tvOS.xcscheme rename to SmokeTests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App tvOS.xcscheme diff --git a/dependency-manager-tests/spm/Shared/DatadogSetup.swift b/SmokeTests/spm/Shared/DatadogSetup.swift similarity index 100% rename from dependency-manager-tests/spm/Shared/DatadogSetup.swift rename to SmokeTests/spm/Shared/DatadogSetup.swift diff --git a/dependency-manager-tests/xcframeworks/App/AppDelegate.swift b/SmokeTests/xcframeworks/App/AppDelegate.swift similarity index 100% rename from dependency-manager-tests/xcframeworks/App/AppDelegate.swift rename to SmokeTests/xcframeworks/App/AppDelegate.swift diff --git a/dependency-manager-tests/xcframeworks/App/Info.plist b/SmokeTests/xcframeworks/App/Info.plist similarity index 100% rename from dependency-manager-tests/xcframeworks/App/Info.plist rename to SmokeTests/xcframeworks/App/Info.plist diff --git a/dependency-manager-tests/xcframeworks/App/PrivacyInfo.xcprivacy b/SmokeTests/xcframeworks/App/PrivacyInfo.xcprivacy similarity index 100% rename from dependency-manager-tests/xcframeworks/App/PrivacyInfo.xcprivacy rename to SmokeTests/xcframeworks/App/PrivacyInfo.xcprivacy diff --git a/dependency-manager-tests/xcframeworks/App/SceneDelegate.swift b/SmokeTests/xcframeworks/App/SceneDelegate.swift similarity index 100% rename from dependency-manager-tests/xcframeworks/App/SceneDelegate.swift rename to SmokeTests/xcframeworks/App/SceneDelegate.swift diff --git a/dependency-manager-tests/xcframeworks/App/ViewController.swift b/SmokeTests/xcframeworks/App/ViewController.swift similarity index 100% rename from dependency-manager-tests/xcframeworks/App/ViewController.swift rename to SmokeTests/xcframeworks/App/ViewController.swift diff --git a/dependency-manager-tests/xcframeworks/AppTests/AppTests.swift b/SmokeTests/xcframeworks/AppTests/AppTests.swift similarity index 100% rename from dependency-manager-tests/xcframeworks/AppTests/AppTests.swift rename to SmokeTests/xcframeworks/AppTests/AppTests.swift diff --git a/dependency-manager-tests/xcframeworks/AppTests/Info.plist b/SmokeTests/xcframeworks/AppTests/Info.plist similarity index 100% rename from dependency-manager-tests/xcframeworks/AppTests/Info.plist rename to SmokeTests/xcframeworks/AppTests/Info.plist diff --git a/dependency-manager-tests/xcframeworks/AppUITests/AppUITests.swift b/SmokeTests/xcframeworks/AppUITests/AppUITests.swift similarity index 100% rename from dependency-manager-tests/xcframeworks/AppUITests/AppUITests.swift rename to SmokeTests/xcframeworks/AppUITests/AppUITests.swift diff --git a/dependency-manager-tests/xcframeworks/AppUITests/Info.plist b/SmokeTests/xcframeworks/AppUITests/Info.plist similarity index 100% rename from dependency-manager-tests/xcframeworks/AppUITests/Info.plist rename to SmokeTests/xcframeworks/AppUITests/Info.plist diff --git a/SmokeTests/xcframeworks/Makefile b/SmokeTests/xcframeworks/Makefile new file mode 100644 index 0000000000..903db38c67 --- /dev/null +++ b/SmokeTests/xcframeworks/Makefile @@ -0,0 +1,66 @@ +.PHONY: clean install test + +REPO_ROOT := ../../ +include ../../tools/utils/common.mk + +ifeq ($(PLATFORM), iOS Simulator) +SCHEME := App iOS +EXPECTED_XCFRAMEWORKS := DatadogInternal \ + DatadogCore \ + DatadogLogs \ + DatadogTrace \ + DatadogRUM \ + DatadogSessionReplay \ + DatadogObjc \ + DatadogCrashReporting \ + CrashReporter \ + DatadogWebViewTracking \ + OpenTelemetryApi +else ifeq ($(PLATFORM), tvOS Simulator) +SCHEME := App tvOS +EXPECTED_XCFRAMEWORKS := DatadogInternal \ + DatadogCore \ + DatadogLogs \ + DatadogTrace \ + DatadogRUM \ + DatadogObjc \ + DatadogCrashReporting \ + CrashReporter \ + OpenTelemetryApi +endif + +clean: + @$(ECHO_SUBTITLE2) "make clean" + rm -rf dd-sdk-ios + +install: + @$(ECHO_SUBTITLE2) "make install" + @$(ECHO_SUCCESS) "Preparing for CURRENT_GIT_REF='${CURRENT_GIT_REF}'" + git clone --depth 1 --branch ${CURRENT_GIT_REF} https://github.com/DataDog/dd-sdk-ios.git + cd dd-sdk-ios && tools/distribution/build-xcframework.sh + +test: + @$(call require_param,OS) + @$(call require_param,PLATFORM) + @$(call require_param,DEVICE) + @$(ECHO_SUBTITLE2) "make test OS='$(OS)' PLATFORM='$(PLATFORM)' DEVICE='$(DEVICE)'" +ifeq ($(SCHEME),) + @$(ECHO_ERROR) "No SCHEME is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif +ifeq ($(EXPECTED_XCFRAMEWORKS),) + @$(ECHO_ERROR) "No EXPECTED_XCFRAMEWORKS is defined for PLATFORM='$(PLATFORM)'" + @exit 1 +endif + @$(ECHO_SUCCESS) "Using SCHEME='$(SCHEME)'" + @$(ECHO_SUCCESS) "Using EXPECTED_XCFRAMEWORKS='$(EXPECTED_XCFRAMEWORKS)'" + @echo "Check XCFrameworks in $(PWD)/dd-sdk-ios/build/xcframeworks/" + @$(foreach xcf,$(EXPECTED_XCFRAMEWORKS),\ + if [ -d "dd-sdk-ios/build/xcframeworks/$(xcf).xcframework" ]; then \ + $(ECHO_SUCCESS) "$(xcf).xcframework exists"; \ + else \ + $(ECHO_ERROR) "$(xcf).xcframework is missing" && exit 1; \ + fi;) + set -eo pipefail; \ + xcodebuild -version; \ + xcodebuild -project "XCProject.xcodeproj" -destination "platform=$(PLATFORM),name=$(DEVICE),OS=$(OS)" -scheme "$(SCHEME)" test | xcbeautify diff --git a/dependency-manager-tests/xcframeworks/XCProject.xcodeproj/project.pbxproj b/SmokeTests/xcframeworks/XCProject.xcodeproj/project.pbxproj similarity index 100% rename from dependency-manager-tests/xcframeworks/XCProject.xcodeproj/project.pbxproj rename to SmokeTests/xcframeworks/XCProject.xcodeproj/project.pbxproj diff --git a/dependency-manager-tests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SmokeTests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from dependency-manager-tests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to SmokeTests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/dependency-manager-tests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SmokeTests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from dependency-manager-tests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to SmokeTests/xcframeworks/XCProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/dependency-manager-tests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App iOS.xcscheme b/SmokeTests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App iOS.xcscheme similarity index 100% rename from dependency-manager-tests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App iOS.xcscheme rename to SmokeTests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App iOS.xcscheme diff --git a/dependency-manager-tests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App tvOS.xcscheme b/SmokeTests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App tvOS.xcscheme similarity index 100% rename from dependency-manager-tests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App tvOS.xcscheme rename to SmokeTests/xcframeworks/XCProject.xcodeproj/xcshareddata/xcschemes/App tvOS.xcscheme diff --git a/bitrise.yml b/bitrise.yml index 2a686017f0..d5dd70dbdf 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -12,14 +12,10 @@ workflows: By default, it doesn't run any test phases, but this behaviour is overwritten in `choose_workflows.py` when: - one or more `DD_OVERWRITE_RUN_(phase)_TESTS` ENVs are passed to the current CI job: - DD_OVERRIDE_RUN_SR_UNIT_TESTS='1' to run unit tests phase for Session Replay product - - DD_OVERRIDE_RUN_SMOKE_TESTS='1' to run smoke tests phase - - DD_OVERRIDE_RUN_TOOLS_TESTS='1' to run tools tests phase - a phase is selected on the checklist in the PR description, - the PR changes a file which matches phase filter (e.g. changing a file in `Sources/*` will trigger unit tests phase) envs: - DD_RUN_SR_UNIT_TESTS: '0' - - DD_RUN_SMOKE_TESTS: '0' - - DD_RUN_TOOLS_TESTS: '0' after_run: - _make_dependencies - run_conditioned_workflows @@ -30,8 +26,6 @@ workflows: This workflow is triggered for each new commit pushed to `develop` or `master` branch. envs: - DD_RUN_SR_UNIT_TESTS: '1' - - DD_RUN_SMOKE_TESTS: '0' - - DD_RUN_TOOLS_TESTS: '0' after_run: - _make_dependencies - run_conditioned_workflows @@ -39,19 +33,6 @@ workflows: - _deploy_artifacts - _notify_failure_on_slack - run_nightly_smoke_and_tools_tests: - description: |- - This workflow is triggered every night. - envs: - - DD_RUN_SR_UNIT_TESTS: '0' - - DD_RUN_SMOKE_TESTS: '1' - - DD_RUN_TOOLS_TESTS: '1' - after_run: - - _make_dependencies - - run_conditioned_workflows - - _deploy_artifacts - - _notify_failure_on_slack - push_to_dogfooding: after_run: - create_dogfooding_pr @@ -68,8 +49,6 @@ workflows: This workflow is triggered on pushing a new release tag. envs: - DD_RUN_SR_UNIT_TESTS: '1' - - DD_RUN_SMOKE_TESTS: '1' - - DD_RUN_TOOLS_TESTS: '0' after_run: - _make_dependencies - run_conditioned_workflows @@ -132,8 +111,6 @@ workflows: venv/bin/python3 choose_workflows.py after_run: - run_unit_tests - - run_smoke_tests - - run_tools_tests run_unit_tests: description: |- @@ -171,228 +148,6 @@ workflows: - project_path: DatadogSessionReplay/SRSnapshotTests/SRSnapshotTests.xcworkspace - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/DatadogSessionReplay-snapshot-tests.html" - run_smoke_tests: - description: |- - Uses supported dependency managers to fetch, install and link the SDK - to test projects. - Only ran if 'DD_RUN_SMOKE_TESTS' is '1'. - steps: - - script: - title: Test SPM compatibility - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - make test-spm ci=${CI} - - script: - title: Check Mac Catalyst compatibility (build SPMProject for Catalyst) - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -euxo pipefail - - xcodebuild build -scheme "App iOS" \ - -project "$BITRISE_SOURCE_DIR/dependency-manager-tests/spm/SPMProject.xcodeproj" \ - -destination "platform=macOS,variant=Mac Catalyst" \ - | xcpretty - - script: - title: Check macOS compatibility (build SPMProject for macOS) - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -euxo pipefail - - xcodebuild build -scheme "App macOS" \ - -project "$BITRISE_SOURCE_DIR/dependency-manager-tests/spm/SPMProject.xcodeproj" \ - -destination "platform=macOS" \ - | xcpretty - - xcode-test: - title: Run SPMProject iOS tests - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App iOS - - destination: platform=iOS Simulator,name=iPhone 11,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/spm/SPMProject.xcodeproj" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/SPMProject-ios-tests.html" - - xcode-test: - title: Run SPMProject tvOS tests - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App tvOS - - destination: platform=tvOS Simulator,name=Apple TV,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/spm/SPMProject.xcodeproj" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/SPMProject-tvos-tests.html" - - script: - title: Test Carthage compatibility - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - make test-carthage ci=${CI} - - xcode-test: - title: Run CTProject iOS tests - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App iOS - - destination: platform=iOS Simulator,name=iPhone 11,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/carthage/CTProject.xcodeproj" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/CTProject-ios-tests.html" - - xcode-test: - title: Run CTProject tvOS tests - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App tvOS - - destination: platform=tvOS Simulator,name=Apple TV,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/carthage/CTProject.xcodeproj" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/CTProject-tvos-tests.html" - - script: - title: Test Cocoapods compatibility - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - make test-cocoapods ci=${CI} - - xcode-test: - title: Run CPProject tests iOS with 'use_frameworks!' - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App Dynamic iOS - - destination: platform=iOS Simulator,name=iPhone 11,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/cocoapods/CPProject.xcworkspace" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/CPProject-ios-dynamic-tests.html" - - xcode-test: - title: Run CPProject tests iOS with no 'use_frameworks!' - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App Static iOS - - destination: platform=iOS Simulator,name=iPhone 11,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/cocoapods/CPProject.xcworkspace" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/CPProject-ios-static-tests.html" - - xcode-test: - title: Run CPProject tests tvOS with 'use_frameworks!' - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App Dynamic tvOS - - destination: platform=tvOS Simulator,name=Apple TV,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/cocoapods/CPProject.xcworkspace" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/CPProject-tvos-dynamic-tests.html" - - xcode-test: - title: Run CPProject tests tvOS with no 'use_frameworks!' - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App Static tvOS - - destination: platform=tvOS Simulator,name=Apple TV,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/cocoapods/CPProject.xcworkspace" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/CPProject-tvos-static-tests.html" - - script: - title: Test XCFrameworks compatibility - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - make test-xcframeworks ci=${CI} - - xcode-test: - title: Run XCProject iOS tests - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App iOS - - destination: platform=iOS Simulator,name=iPhone 11,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/xcframeworks/XCProject.xcodeproj" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/XCProject-ios-tests.html" - - xcode-test: - title: Run XCProject tvOS tests - run_if: '{{enveq "DD_RUN_SMOKE_TESTS" "1"}}' - inputs: - - scheme: App tvOS - - destination: platform=tvOS Simulator,name=Apple TV,OS=latest - - is_clean_build: 'yes' - - cache_level: none - - project_path: "$BITRISE_SOURCE_DIR/dependency-manager-tests/xcframeworks/XCProject.xcodeproj" - - xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/XCProject-tvos-tests.html" - - run_tools_tests: - description: |- - Runs tests for internal tools. - Only ran if 'DD_RUN_TOOLS_TESTS' is '1'. - steps: - - script: - title: Run unit tests for http-server-mock - run_if: '{{enveq "DD_RUN_TOOLS_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - swift test --package-path instrumented-tests/http-server-mock - - script: - title: Run unit tests for rum-models-generator - run_if: '{{enveq "DD_RUN_TOOLS_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - swift test --package-path tools/rum-models-generator - - script: - title: Run unit tests for sr-snapshots - run_if: '{{enveq "DD_RUN_TOOLS_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - swift test --package-path tools/sr-snapshots - - script: - title: Run tests for distribution tools - run_if: '{{enveq "DD_RUN_TOOLS_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - cd tools/distribution && make - venv/bin/python3 -m pytest tests - - script: - title: Smoke test dogfooding (with dry-run) - run_if: '{{enveq "DD_RUN_TOOLS_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - - export DD_DRY_RUN=yes - cd tools/distribution && make - venv/bin/python3 dogfood.py - - script: - title: Run tests for nightly-unit-tests tool - run_if: '{{enveq "DD_RUN_TOOLS_TESTS" "1"}}' - inputs: - - content: |- - #!/usr/bin/env bash - set -e - cd tools/nightly-unit-tests && make - venv/bin/python3 -m pytest tests - create_dogfooding_pr: description: |- Creates PRs to repositories using `dd-sdk-ios`. @@ -459,7 +214,7 @@ workflows: # Use 'DD_RELEASE_GIT_TAG' ENV if available, otherwise 'BITRISE_GIT_TAG' ENV GIT_TAG="${DD_RELEASE_GIT_TAG:-$(echo "${BITRISE_GIT_TAG}")}" - cd tools/distribution && make + cd tools/distribution && make clean install venv/bin/python3 release.py "$GIT_TAG" --only-github publish_cocoapods_podspecs: @@ -480,7 +235,7 @@ workflows: # Use 'DD_RELEASE_GIT_TAG' ENV if available, otherwise 'BITRISE_GIT_TAG' ENV GIT_TAG="${DD_RELEASE_GIT_TAG:-$(echo "${BITRISE_GIT_TAG}")}" - cd tools/distribution && make + cd tools/distribution && make clean install venv/bin/python3 release.py "$GIT_TAG" --only-cocoapods run_e2e_s8s_upload: diff --git a/dependency-manager-tests/carthage/Cartfile.src b/dependency-manager-tests/carthage/Cartfile.src deleted file mode 100644 index 0e05a40fe2..0000000000 --- a/dependency-manager-tests/carthage/Cartfile.src +++ /dev/null @@ -1 +0,0 @@ -github "GIT_REMOTE" "GIT_REFERENCE" diff --git a/dependency-manager-tests/carthage/Makefile b/dependency-manager-tests/carthage/Makefile deleted file mode 100644 index e1c5891d05..0000000000 --- a/dependency-manager-tests/carthage/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -GIT_REFERENCE := $(shell git rev-parse --abbrev-ref HEAD) -ifneq (${BITRISE_GIT_BRANCH},) - GIT_REFERENCE := ${BITRISE_GIT_BRANCH} -endif -ifneq (${BITRISE_GIT_TAG},) - GIT_REFERENCE := ${BITRISE_GIT_TAG} -endif - -GIT_REMOTE := "DataDog/dd-sdk-ios" -ifneq (${BITRISEIO_PULL_REQUEST_REPOSITORY_URL},) - GIT_REMOTE := ${BITRISEIO_PULL_REQUEST_REPOSITORY_URL} -endif - -test: - @echo "⚙️ Configuring CTProject with remote branch: '${GIT_REFERENCE}'..." - - @sed "s|GIT_REFERENCE|${GIT_REFERENCE}|g" Cartfile.src | \ - sed "s|GIT_REMOTE|${GIT_REMOTE}|g" > Cartfile - @rm -rf Carthage/ - @echo "🧪 Run 'carthage update'" - @carthage update --platform iOS,tvOS --use-xcframeworks - @echo "🧪 Check if expected frameworks exist in $(PWD)/Carthage/Build/" - @[ -e "Carthage/Build/DatadogInternal.xcframework" ] && echo "DatadogInternal.xcframework - OK" || { echo "DatadogInternal.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogCore.xcframework" ] && echo "DatadogCore.xcframework - OK" || { echo "DatadogCore.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogLogs.xcframework" ] && echo "DatadogLogs.xcframework - OK" || { echo "DatadogLogs.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogTrace.xcframework" ] && echo "DatadogTrace.xcframework - OK" || { echo "DatadogTrace.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogRUM.xcframework" ] && echo "DatadogRUM.xcframework - OK" || { echo "DatadogRUM.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogSessionReplay.xcframework" ] && echo "DatadogSessionReplay.xcframework - OK" || { echo "DatadogSessionReplay.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogObjc.xcframework" ] && echo "DatadogObjc.xcframework - OK" || { echo "DatadogObjc.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogCrashReporting.xcframework" ] && echo "DatadogCrashReporting.xcframework - OK" || { echo "DatadogCrashReporting.xcframework - missing"; false; } - @[ -e "Carthage/Build/CrashReporter.xcframework" ] && echo "CrashReporter.xcframework - OK" || { echo "CrashReporter.xcframework - missing"; false; } - @[ -e "Carthage/Build/DatadogWebViewTracking.xcframework" ] && echo "DatadogWebViewTracking.xcframework - OK" || { echo "DatadogWebViewTracking.xcframework - missing"; false; } - @[ -e "Carthage/Build/OpenTelemetryApi.xcframework" ] && echo "OpenTelemetryApi.xcframework - OK" || { echo "OpenTelemetryApi.xcframework - missing"; false; } - @echo "🧪 SUCCEEDED" diff --git a/dependency-manager-tests/cocoapods/Makefile b/dependency-manager-tests/cocoapods/Makefile deleted file mode 100644 index 30f0805f2f..0000000000 --- a/dependency-manager-tests/cocoapods/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -GIT_REFERENCE := "branch=\>\'$(shell git rev-parse --abbrev-ref HEAD)\'" -ifneq (${BITRISE_GIT_BRANCH},) - GIT_REFERENCE := "branch=\>\'${BITRISE_GIT_BRANCH}\'" -endif -ifneq (${BITRISE_GIT_TAG},) - GIT_REFERENCE := "tag=\>\'${BITRISE_GIT_TAG}\'" -endif - -GIT_REMOTE := "https://github.com/DataDog/dd-sdk-ios.git" -ifneq (${BITRISEIO_PULL_REQUEST_REPOSITORY_URL},) - GIT_REMOTE := ${BITRISEIO_PULL_REQUEST_REPOSITORY_URL} -endif - -test: - @echo "⚙️ Configuring CPProject with remote branch: '${GIT_REFERENCE}'..." - @sed "s|GIT_REFERENCE|${GIT_REFERENCE}|g" Podfile.src | \ - sed "s|GIT_REMOTE|${GIT_REMOTE}|g" > Podfile - @rm -rf Pods/ - pod update - @echo "👌 'pod update' OK" diff --git a/dependency-manager-tests/cocoapods/Podfile.src b/dependency-manager-tests/cocoapods/Podfile.src deleted file mode 100644 index fc2dbb0d17..0000000000 --- a/dependency-manager-tests/cocoapods/Podfile.src +++ /dev/null @@ -1,43 +0,0 @@ -abstract_target 'Common' do - pod 'OpenTelemetrySwiftApi', '1.6.0' - pod 'DatadogInternal', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogCore', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogLogs', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogTrace', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogRUM', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogCore', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogSessionReplay', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogAlamofireExtension', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogCrashReporting', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'DatadogObjc', :git => 'GIT_REMOTE', :GIT_REFERENCE - pod 'Alamofire' - - target 'App Dynamic iOS' do - platform :ios, '13.0' - use_frameworks! - pod 'DatadogWebViewTracking', :git => 'GIT_REMOTE', :GIT_REFERENCE - end - - target 'App Static iOS' do - platform :ios, '13.0' - pod 'DatadogWebViewTracking', :git => 'GIT_REMOTE', :GIT_REFERENCE - - target 'App Static iOS Tests' do - inherit! :search_paths - end - end - - target 'App Dynamic tvOS' do - platform :tvos, '13.0' - use_frameworks! - end - - target 'App Static tvOS' do - platform :tvos, '13.0' - - target 'App Static tvOS Tests' do - inherit! :search_paths - end - end - -end diff --git a/dependency-manager-tests/spm/App macOS/App_macOS.entitlements b/dependency-manager-tests/spm/App macOS/App_macOS.entitlements deleted file mode 100644 index a11054c1df..0000000000 --- a/dependency-manager-tests/spm/App macOS/App_macOS.entitlements +++ /dev/null @@ -1,2 +0,0 @@ -com.apple.security.app-sandbox - diff --git a/dependency-manager-tests/spm/App macOS/App_macOSApp.swift b/dependency-manager-tests/spm/App macOS/App_macOSApp.swift deleted file mode 100644 index 123623e06c..0000000000 --- a/dependency-manager-tests/spm/App macOS/App_macOSApp.swift +++ /dev/null @@ -1,20 +0,0 @@ -/* -* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. -* This product includes software developed at Datadog (https://www.datadoghq.com/). -* Copyright 2019-Present Datadog, Inc. -*/ - -import SwiftUI - -@main -struct App_macOSApp: App { - var body: some Scene { - WindowGroup { - ContentView() - } - } - - init() { - DatadogSetup.initialize() - } -} diff --git a/dependency-manager-tests/spm/App macOS/ContentView.swift b/dependency-manager-tests/spm/App macOS/ContentView.swift deleted file mode 100644 index 1fc7b91149..0000000000 --- a/dependency-manager-tests/spm/App macOS/ContentView.swift +++ /dev/null @@ -1,18 +0,0 @@ -/* -* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. -* This product includes software developed at Datadog (https://www.datadoghq.com/). -* Copyright 2019-Present Datadog, Inc. -*/ - -import SwiftUI - -struct ContentView: View { - var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - Text("Testing...") - } - .padding() - } -} diff --git a/dependency-manager-tests/spm/App macOSUITests/App_macOSUITests.swift b/dependency-manager-tests/spm/App macOSUITests/App_macOSUITests.swift deleted file mode 100644 index b0eacadf1c..0000000000 --- a/dependency-manager-tests/spm/App macOSUITests/App_macOSUITests.swift +++ /dev/null @@ -1,15 +0,0 @@ -/* -* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. -* This product includes software developed at Datadog (https://www.datadoghq.com/). -* Copyright 2019-Present Datadog, Inc. -*/ - -import XCTest - -final class App_macOSUITests: XCTestCase { - func testExample() throws { - let app = XCUIApplication() - app.launch() - XCTAssert(app.staticTexts["Testing..."].exists) - } -} diff --git a/dependency-manager-tests/spm/Makefile b/dependency-manager-tests/spm/Makefile deleted file mode 100644 index 348173b1a8..0000000000 --- a/dependency-manager-tests/spm/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -GIT_REFERENCE := $(shell git rev-parse --abbrev-ref HEAD) -ifneq (${BITRISE_GIT_BRANCH},) - GIT_REFERENCE := ${BITRISE_GIT_BRANCH} -endif -ifneq (${BITRISE_GIT_TAG},) - GIT_REFERENCE := ${BITRISE_GIT_TAG} -endif - -GIT_REMOTE := "https://github.com/DataDog/dd-sdk-ios" -ifneq (${BITRISEIO_PULL_REQUEST_REPOSITORY_URL},) - GIT_REMOTE := ${BITRISEIO_PULL_REQUEST_REPOSITORY_URL} -endif - -test: - @echo "⚙️ Configuring SPMProject with remote branch: '${GIT_REFERENCE}'..." - @rm -rf SPMProject.xcodeproj - @cp -r SPMProject.xcodeproj.src SPMProject.xcodeproj - @sed "s|GIT_REFERENCE|${GIT_REFERENCE}|g" SPMProject.xcodeproj.src/project.pbxproj | \ - sed "s|GIT_REMOTE|${GIT_REMOTE}|g" > SPMProject.xcodeproj/project.pbxproj - @echo "OK 👌" - -create-src-from-xcodeproj: - @echo "⚙️ Creating 'SPMProject.xcodeproj.src' from SPMProject.xcodeproj" - rm -rf SPMProject.xcodeproj.src - cp -r SPMProject.xcodeproj SPMProject.xcodeproj.src - rm SPMProject.xcodeproj.src/project.xcworkspace/xcshareddata/swiftpm/Package.resolved - sed "s|${GIT_REFERENCE}|GIT_REFERENCE|g" SPMProject.xcodeproj/project.pbxproj > SPMProject.xcodeproj.src/project.pbxproj - @echo "OK 👌" diff --git a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App macOS.xcscheme b/dependency-manager-tests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App macOS.xcscheme deleted file mode 100644 index 9e772b47d7..0000000000 --- a/dependency-manager-tests/spm/SPMProject.xcodeproj.src/xcshareddata/xcschemes/App macOS.xcscheme +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dependency-manager-tests/xcframeworks/Makefile b/dependency-manager-tests/xcframeworks/Makefile deleted file mode 100644 index b195057a5e..0000000000 --- a/dependency-manager-tests/xcframeworks/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -GIT_REFERENCE := $(shell git rev-parse --abbrev-ref HEAD) -ifneq (${BITRISE_GIT_BRANCH},) - GIT_REFERENCE := ${BITRISE_GIT_BRANCH} -endif -ifneq (${BITRISE_GIT_TAG},) - GIT_REFERENCE := ${BITRISE_GIT_TAG} -endif - -GIT_REMOTE := "https://github.com/DataDog/dd-sdk-ios.git" -ifneq (${BITRISEIO_PULL_REQUEST_REPOSITORY_URL},) - GIT_REMOTE := ${BITRISEIO_PULL_REQUEST_REPOSITORY_URL} -endif - -test: - @echo "⚙️ Configuring XCProject with remote branch: '${GIT_REFERENCE}'..." - @rm -rf dd-sdk-ios/ - @git clone --depth 1 --branch ${GIT_REFERENCE} ${GIT_REMOTE} - @echo "🧪 Build xcframeworks" - @cd dd-sdk-ios && tools/distribution/build-xcframework.sh - @echo "🧪 Check if expected frameworks exist in $(PWD)/dd-sdk-ios/build/xcframeworks" - @[ -e "dd-sdk-ios/build/xcframeworks/DatadogCore.xcframework" ] && echo "DatadogCore.xcframework - OK" || { echo "DatadogCore.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/DatadogLogs.xcframework" ] && echo "DatadogLogs.xcframework - OK" || { echo "DatadogLogs.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/DatadogTrace.xcframework" ] && echo "DatadogTrace.xcframework - OK" || { echo "DatadogTrace.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/DatadogRUM.xcframework" ] && echo "DatadogRUM.xcframework - OK" || { echo "DatadogRUM.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/DatadogSessionReplay.xcframework" ] && echo "DatadogSessionReplay.xcframework - OK" || { echo "DatadogSessionReplay.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/DatadogObjc.xcframework" ] && echo "DatadogObjc.xcframework - OK" || { echo "DatadogObjc.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/DatadogCrashReporting.xcframework" ] && echo "DatadogCrashReporting.xcframework - OK" || { echo "DatadogCrashReporting.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/CrashReporter.xcframework" ] && echo "CrashReporter.xcframework - OK" || { echo "CrashReporter.xcframework - missing"; false; } - @[ -e "dd-sdk-ios/build/xcframeworks/OpenTelemetryApi.xcframework" ] && echo "OpenTelemetryApi.xcframework - OK" || { echo "OpenTelemetryApi.xcframework - missing"; false; } - @echo "🧪 SUCCEEDED" diff --git a/tools/config/generate-http-server-mock-config.sh b/tools/config/generate-http-server-mock-config.sh index 201ee49358..f87d075654 100755 --- a/tools/config/generate-http-server-mock-config.sh +++ b/tools/config/generate-http-server-mock-config.sh @@ -4,7 +4,7 @@ if [ ! -f "Package.swift" ]; then echo "\`generate-http-server-mock-config.sh\` must be run in repository root folder: \`./tools/config/generate-http-server-mock-config.sh\`"; exit 1 fi -SERVER_ADDRESS=$(./instrumented-tests/http-server-mock/python/server_address.py) +SERVER_ADDRESS=$(./tools/http-server-mock/python/server_address.py) XCCONFIG_FILE="./xcconfigs/MockServerAddress.local.xcconfig" echo "MOCK_SERVER_ADDRESS=${SERVER_ADDRESS}" > "${XCCONFIG_FILE}" diff --git a/tools/distribution/Makefile b/tools/distribution/Makefile index 86e9a1fda6..0af737fb91 100644 --- a/tools/distribution/Makefile +++ b/tools/distribution/Makefile @@ -1,11 +1,17 @@ -.PHONY: all +.PHONY: clean install test -all: - @echo "⚙️ Ensuring that GitHub CLI is installed $(PWD)" - @brew list gh &>/dev/null || brew install gh -ifeq ($(wildcard venv),) - @echo "⚙️ Creating Python venv in $(PWD)" +REPO_ROOT := ../../ +include ../utils/common.mk + +clean: + @$(ECHO_SUBTITLE2) "make clean" + rm -rf "venv" + +install: + @$(ECHO_SUBTITLE2) "make install" python3 -m venv venv -endif - @echo "⚙️ Installing pip dependencies in $(PWD)/venv" venv/bin/pip3 install -r requirements.txt + +test: + @$(ECHO_SUBTITLE2) "make test" + venv/bin/python3 -m pytest tests diff --git a/tools/env_check.sh b/tools/env-check.sh similarity index 91% rename from tools/env_check.sh rename to tools/env-check.sh index a4532d54d5..fcdf6629f7 100755 --- a/tools/env_check.sh +++ b/tools/env-check.sh @@ -59,11 +59,11 @@ python3 -V echo "" echo_succ "Available iOS Simulators:" -xctrace list devices | grep "iPhone.*Simulator" +xctrace list devices | grep "iPhone.*Simulator" || true echo "" echo_succ "Available tvOS Simulators:" -xctrace list devices | grep "Apple TV.*Simulator" +xctrace list devices | grep "Apple TV.*Simulator" || true if command -v brew >/dev/null 2>&1; then echo "" diff --git a/instrumented-tests/http-server-mock/.gitignore b/tools/http-server-mock/.gitignore similarity index 100% rename from instrumented-tests/http-server-mock/.gitignore rename to tools/http-server-mock/.gitignore diff --git a/instrumented-tests/http-server-mock/Package.swift b/tools/http-server-mock/Package.swift similarity index 100% rename from instrumented-tests/http-server-mock/Package.swift rename to tools/http-server-mock/Package.swift diff --git a/instrumented-tests/http-server-mock/README.md b/tools/http-server-mock/README.md similarity index 100% rename from instrumented-tests/http-server-mock/README.md rename to tools/http-server-mock/README.md diff --git a/instrumented-tests/http-server-mock/Sources/HTTPServerMock/Request.swift b/tools/http-server-mock/Sources/HTTPServerMock/Request.swift similarity index 100% rename from instrumented-tests/http-server-mock/Sources/HTTPServerMock/Request.swift rename to tools/http-server-mock/Sources/HTTPServerMock/Request.swift diff --git a/instrumented-tests/http-server-mock/Sources/HTTPServerMock/ServerMock.swift b/tools/http-server-mock/Sources/HTTPServerMock/ServerMock.swift similarity index 100% rename from instrumented-tests/http-server-mock/Sources/HTTPServerMock/ServerMock.swift rename to tools/http-server-mock/Sources/HTTPServerMock/ServerMock.swift diff --git a/instrumented-tests/http-server-mock/Sources/HTTPServerMock/ServerProcessRunner.swift b/tools/http-server-mock/Sources/HTTPServerMock/ServerProcessRunner.swift similarity index 100% rename from instrumented-tests/http-server-mock/Sources/HTTPServerMock/ServerProcessRunner.swift rename to tools/http-server-mock/Sources/HTTPServerMock/ServerProcessRunner.swift diff --git a/instrumented-tests/http-server-mock/Sources/HTTPServerMock/ServerSession.swift b/tools/http-server-mock/Sources/HTTPServerMock/ServerSession.swift similarity index 100% rename from instrumented-tests/http-server-mock/Sources/HTTPServerMock/ServerSession.swift rename to tools/http-server-mock/Sources/HTTPServerMock/ServerSession.swift diff --git a/instrumented-tests/http-server-mock/Tests/HTTPServerMockTests/HTTPServerMockTests.swift b/tools/http-server-mock/Tests/HTTPServerMockTests/HTTPServerMockTests.swift similarity index 100% rename from instrumented-tests/http-server-mock/Tests/HTTPServerMockTests/HTTPServerMockTests.swift rename to tools/http-server-mock/Tests/HTTPServerMockTests/HTTPServerMockTests.swift diff --git a/instrumented-tests/http-server-mock/python/server_address.py b/tools/http-server-mock/python/server_address.py similarity index 100% rename from instrumented-tests/http-server-mock/python/server_address.py rename to tools/http-server-mock/python/server_address.py diff --git a/instrumented-tests/http-server-mock/python/start_mock_server.py b/tools/http-server-mock/python/start_mock_server.py similarity index 100% rename from instrumented-tests/http-server-mock/python/start_mock_server.py rename to tools/http-server-mock/python/start_mock_server.py diff --git a/tools/lint/sources.swiftlint.yml b/tools/lint/sources.swiftlint.yml index 9ff9dab540..541ebbe2a4 100644 --- a/tools/lint/sources.swiftlint.yml +++ b/tools/lint/sources.swiftlint.yml @@ -165,12 +165,12 @@ included: - ../../DatadogWebViewTracking/Sources - ../../DatadogObjc/Sources - ../../Datadog/E2E - - ../../instrumented-tests/http-server-mock/Sources + - ../../tools/http-server-mock/Sources - ../../tools/api-surface/Sources - ../../tools/api-surface/Fixtures/Sources - ../../tools/rum-models-generator/Sources - ../../tools/rum-models-generator/Tests/rum-models-generator-coreTests/Fixtures/Output # lint generation fixture - ../../tools/sr-snapshots/Sources - - ../../dependency-manager-tests/carthage/CTProject - - ../../dependency-manager-tests/cocoapods/CPProject - - ../../dependency-manager-tests/spm/SPMProject + - ../../SmokeTests/carthage/CTProject + - ../../SmokeTests/cocoapods/CPProject + - ../../SmokeTests/spm/SPMProject diff --git a/tools/lint/tests.swiftlint.yml b/tools/lint/tests.swiftlint.yml index 2876b3acbc..69e069a7b7 100644 --- a/tools/lint/tests.swiftlint.yml +++ b/tools/lint/tests.swiftlint.yml @@ -95,13 +95,13 @@ included: - ../../DatadogWebViewTracking/Tests - ../../Datadog/E2ETests - ../../Datadog/E2EInstrumentationTests - - ../../instrumented-tests/http-server-mock/Tests + - ../../tools/http-server-mock/Tests - ../../tools/api-surface/Tests - ../../tools/rum-models-generator/Tests - ../../tools/sr-snapshots/Tests - - ../../dependency-manager-tests/carthage/CTProjectTests - - ../../dependency-manager-tests/carthage/CTProjectUITests - - ../../dependency-manager-tests/cocoapods/CTProjectTests - - ../../dependency-manager-tests/cocoapods/CTProjectUITests - - ../../dependency-manager-tests/spm/SPMProjectTests - - ../../dependency-manager-tests/spm/SPMProjectUITests + - ../../SmokeTests/carthage/CTProjectTests + - ../../SmokeTests/carthage/CTProjectUITests + - ../../SmokeTests/cocoapods/CTProjectTests + - ../../SmokeTests/cocoapods/CTProjectUITests + - ../../SmokeTests/spm/SPMProjectTests + - ../../SmokeTests/spm/SPMProjectUITests diff --git a/tools/runner-setup.sh b/tools/runner-setup.sh index 61bafb150f..fd4e391bc0 100755 --- a/tools/runner-setup.sh +++ b/tools/runner-setup.sh @@ -5,26 +5,75 @@ # This script is for TEMPORARY. It supplements missing components on the runner. It will be removed once all configurations are integrated into the AMI. # Options: -# --ios: Flag that prepares the runner instance for iOS testing. Disabled by default. -# --tvos: Flag that prepares the runner instance for tvOS testing. Disabled by default. -# --os: Sets the expected OS version for installed simulators. Default: '17.4'. +# --xcode: Sets the Xcode version on the runner. +# --iOS: Flag that prepares the runner instance for iOS testing. Disabled by default. +# --tvOS: Flag that prepares the runner instance for tvOS testing. Disabled by default. +# --visionOS: Flag that prepares the runner instance for visionOS testing. Disabled by default. +# --os: Sets the expected OS version for installed simulators when --iOS, --tvOS or --visionOS flag is set. Default: '17.4'. set -eo pipefail source ./tools/utils/echo_color.sh source ./tools/utils/argparse.sh set_description "This script is for TEMPORARY. It supplements missing components on the runner. It will be removed once all configurations are integrated into the AMI." -define_arg "ios" "false" "Flag that prepares the runner instance for iOS testing. Disabled by default." "store_true" -define_arg "tvos" "false" "Flag that prepares the runner instance for tvOS testing. Disabled by default." "store_true" -define_arg "os" "17.4" "Sets the expected OS version for installed simulators. Default: '17.4'." "string" "false" +define_arg "xcode" "" "Sets the Xcode version on the runner." "string" "false" +define_arg "iOS" "false" "Flag that prepares the runner instance for iOS testing. Disabled by default." "store_true" +define_arg "tvOS" "false" "Flag that prepares the runner instance for tvOS testing. Disabled by default." "store_true" +define_arg "visionOS" "false" "Flag that prepares the runner instance for visionOS testing. Disabled by default." "store_true" +define_arg "os" "17.4" "Sets the expected OS version for installed simulators when --iOS, --tvOS or --visionOS flag is set. Default: '17.4'." "string" "false" check_for_help "$@" parse_args "$@" +change_xcode_version() { + local version="$1" + + echo_subtitle "Change Xcode version to: '$version'" + local XCODE_PATH="/Applications/Xcode-$version.app/Contents/Developer" + local CURRENT_XCODE_PATH=$(xcode-select -p) + + if [[ "$CURRENT_XCODE_PATH" == "$XCODE_PATH" ]]; then + echo_succ "Already using Xcode version '$version'." + elif [[ -d "$XCODE_PATH" ]]; then + echo "Found Xcode at '$XCODE_PATH'." + if sudo xcode-select -s "$XCODE_PATH"; then + echo_succ "Switched to Xcode version '$version'." + else + echo_err "Failed to switch to Xcode version '$version'." + exit 1 + fi + else + echo_err "Xcode version '$version' not found at $XCODE_PATH." + echo "Available Xcode versions:" + ls /Applications/ | grep Xcode + exit 1 + fi + + if sudo xcodebuild -license accept; then + echo_succ "Xcode license accepted." + else + echo_err "Failed to accept the Xcode license." + exit 1 + fi + + if sudo xcodebuild -runFirstLaunch; then + echo_succ "Installed Xcode packages." + else + echo_err "Failed to install Xcode packages." + exit 1 + fi +} + +if [[ -n "$xcode" ]]; then + change_xcode_version $xcode +fi + +echo_succ "Using 'xcodebuild -version':" xcodebuild -version -if [ "$ios" = "true" ]; then - echo "Check current runner for any iPhone Simulator runtime supporting OS '$os'." +if [ "$iOS" = "true" ]; then + echo_subtitle "Supply iPhone Simulator runtime ($os)" + echo "Check current runner for any iPhone Simulator runtime supporting OS '$os':" if ! xctrace list devices | grep "iPhone.*Simulator ($os)"; then echo_warn "Found no iOS Simulator runtime supporting OS '$os'. Installing..." xcodebuild -downloadPlatform iOS -quiet | xcbeautify @@ -33,8 +82,9 @@ if [ "$ios" = "true" ]; then fi fi -if [ "$tvos" = "true" ]; then - echo "Check current runner for any tvOS Simulator runtime supporting OS '$os'." +if [ "$tvOS" = "true" ]; then + echo_subtitle "Supply tvOS Simulator runtime ($os)" + echo "Check current runner for any tvOS Simulator runtime supporting OS '$os':" if ! xctrace list devices | grep "Apple TV.*Simulator ($os)"; then echo_warn "Found no tvOS Simulator runtime supporting OS '$os'. Installing..." xcodebuild -downloadPlatform tvOS -quiet | xcbeautify @@ -42,3 +92,14 @@ if [ "$tvos" = "true" ]; then echo_succ "Found some tvOS Simulator runtime supporting OS '$os'. Skipping..." fi fi + +if [ "$visionOS" = "true" ]; then + echo_subtitle "Supply visionOS Simulator runtime ($os)" + echo "Check current runner for any visionOS Simulator runtime supporting OS '$os':" + if ! xctrace list devices | grep "Apple Vision.*($os)"; then + echo_warn "Found no visionOS Simulator runtime supporting OS '$os'. Installing..." + xcodebuild -downloadPlatform visionOS -quiet | xcbeautify + else + echo_succ "Found some visionOS Simulator runtime supporting OS '$os'. Skipping..." + fi +fi diff --git a/tools/smoke-test.sh b/tools/smoke-test.sh new file mode 100755 index 0000000000..a0a69fcde5 --- /dev/null +++ b/tools/smoke-test.sh @@ -0,0 +1,30 @@ +#!/bin/zsh + +# Usage: +# ./tools/smoke-test.sh -h +# Executes smoke tests in the specified --test-directory, using the provided --os, --platform, and --device. + +# Options: +# --device: Specifies the simulator device for running tests, e.g., 'iPhone 15 Pro' +# --platform: Defines the type of simulator platform for the tests, e.g., 'iOS Simulator' +# --os: Sets the operating system version for the tests, e.g., '17.5' +# --test-directory: Specifies the directory where the smoke tests are located + +set -eo pipefail +source ./tools/utils/argparse.sh +source ./tools/utils/echo_color.sh +source ./tools/utils/current_git.sh + +set_description "Executes smoke tests in the specified --test-directory, using the provided --os, --platform, and --device." +define_arg "test-directory" "" "Specifies the directory where the smoke tests are located" "string" "true" +define_arg "os" "" "Sets the operating system version for the tests, e.g., '17.5'" "string" "true" +define_arg "platform" "" "Defines the type of simulator platform for the tests, e.g., 'iOS Simulator'" "string" "true" +define_arg "device" "" "Specifies the simulator device for running tests, e.g., 'iPhone 15 Pro'" "string" "true" + +check_for_help "$@" +parse_args "$@" + +echo_subtitle "Run 'make clean install test OS=\"$os\" PLATFORM=\"$platform\" DEVICE=\"$device\"' in '$test_directory'" +echo_succ "Smoke testing for git ref: '$(current_git_ref)'" +cd "$test_directory" && make clean install test OS="$os" PLATFORM="$platform" DEVICE="$device" +cd - diff --git a/tools/spm.sh b/tools/spm-build.sh similarity index 50% rename from tools/spm.sh rename to tools/spm-build.sh index c27bb69e68..f11881b047 100755 --- a/tools/spm.sh +++ b/tools/spm-build.sh @@ -1,23 +1,26 @@ #!/bin/zsh # Usage: -# $ ./tools/spm.sh -h -# Builds the SDK only using Package.swift. +# $ ./tools/spm-build.sh -h +# Builds Package.swift for a specified --scheme and --destination. + +# Options: +# --destination: Defines the xcodebuild destination for Package.swift build, e.g. 'generic/platform=visionOS', 'platform=macOS,variant=Mac Catalyst' +# --scheme: Identifies the scheme to build set -eo pipefail source ./tools/utils/echo_color.sh source ./tools/utils/argparse.sh -define_arg "platform" "" "Defines the type of simulator platform for the tests, e.g. 'iOS', 'tvOS, 'visionOS'" "string" "true" +set_description "Builds SPM package for a specified --scheme and --destination." +define_arg "destination" "" "Defines the xcodebuild destination for SPM build, e.g. 'generic/platform=visionOS', 'platform=macOS,variant=Mac Catalyst'" "string" "true" +define_arg "scheme" "" "Identifies the scheme to build" "string" "true" check_for_help "$@" parse_args "$@" WORKSPACE="Datadog.xcworkspace" WORKSPACE_RENAMED="Datadog.xcworkspace.old" -SCHEME="Datadog-Package" - -set -x rename_workspace() { if [ ! -d "$WORKSPACE" ]; then @@ -43,5 +46,7 @@ rename_workspace # try to restore the files even if the script fails trap restore_workspace EXIT INT -echo "Building SDK for platform $platform" -xcodebuild build -scheme $SCHEME -destination generic/platform="$platform" | xcbeautify \ No newline at end of file +echo_subtitle "Run 'xcodebuild build -scheme $scheme -destination "$destination" | xcbeautify'" + +set -x +xcodebuild build -scheme "$scheme" -destination "$destination" | xcbeautify diff --git a/tools/tools-test.sh b/tools/tools-test.sh new file mode 100755 index 0000000000..45fd8e7d25 --- /dev/null +++ b/tools/tools-test.sh @@ -0,0 +1,25 @@ +#!/bin/zsh + +# Usage: +# ./tools/tools-test.sh +# Runs tests for repo tools. + +set -eo pipefail +source ./tools/utils/echo_color.sh + +test_swift_package() { + local package_path="$1" + echo_subtitle "swift test --package-path \"$package_path\" | xcbeautify" + swift test --package-path "$package_path" | xcbeautify +} + +# Test swift packages +test_swift_package tools/http-server-mock +test_swift_package tools/rum-models-generator +test_swift_package tools/sr-snapshots + +# Test release & dogfood automation: +echo_subtitle "Run 'make clean install test' in ./tools/distribution" +cd tools/distribution && make clean install test +cd - + diff --git a/tools/utils/common.mk b/tools/utils/common.mk new file mode 100644 index 0000000000..130ad11037 --- /dev/null +++ b/tools/utils/common.mk @@ -0,0 +1,29 @@ +# Common helpers for all Makefiles +# +# Usage in other Makefiles: +# ``` +# REPO_ROOT := +# include tools/utils/common.mk +# ``` + +ifndef REPO_ROOT +$(error "REPO_ROOT is not set but it is required. It must resolve to the repo root folder.") +endif + +ECHO_TITLE=$(REPO_ROOT)/tools/utils/echo_color.sh --title +ECHO_SUBTITLE=$(REPO_ROOT)/tools/utils/echo_color.sh --subtitle +ECHO_SUBTITLE2=$(REPO_ROOT)/tools/utils/echo_color.sh --subtitle2 +ECHO_ERROR=$(REPO_ROOT)/tools/utils/echo_color.sh --err +ECHO_WARNING=$(REPO_ROOT)/tools/utils/echo_color.sh --warn +ECHO_SUCCESS=$(REPO_ROOT)/tools/utils/echo_color.sh --succ + +define require_param + if [ -z "$${$(1)}" ]; then \ + $(ECHO_ERROR) "Error:" "$(1) parameter is required but not provided."; \ + exit 1; \ + fi +endef + +CURRENT_GIT_TAG := $(shell $(REPO_ROOT)/tools/utils/current_git.sh --print-tag) +CURRENT_GIT_BRANCH := $(shell $(REPO_ROOT)/tools/utils/current_git.sh --print-branch) +CURRENT_GIT_REF := $(shell $(REPO_ROOT)/tools/utils/current_git.sh --print) diff --git a/tools/utils/current_git.sh b/tools/utils/current_git.sh new file mode 100755 index 0000000000..bcbd3a42f9 --- /dev/null +++ b/tools/utils/current_git.sh @@ -0,0 +1,53 @@ +#!/bin/zsh + +# Usage: +# $ ./tools/utils/current_git.sh -h +# Prints the current Git reference, either a tag or a branch name. + +# Options: +# --print: Outputs the current Git reference to STDOUT (tag if available, branch otherwise) +# --print-tag: Outputs the current Git tag to STDOUT (if available) +# --print-branch: Outputs the current Git branch to STDOUT + +set -eo pipefail + +# Prints current git tag (if any) +function current_git_tag() { + if [[ -n "$CI_COMMIT_TAG" ]]; then + echo "$CI_COMMIT_TAG" + fi +} + +# Prints current git branch +function current_git_branch() { + if [[ -n "$CI_COMMIT_BRANCH" ]]; then + echo "$CI_COMMIT_BRANCH" + else + local git_branch=$(git rev-parse --abbrev-ref HEAD) + echo "$git_branch" + fi +} + +# Prints current tag (if any) and current branch otherwise. +function current_git_ref() { + local tag=$(current_git_tag) + if [[ -n "$tag" ]]; then + echo $tag + else + current_git_branch + fi +} + +case "$1" in + --print) + current_git_ref + ;; + --print-tag) + current_git_tag + ;; + --print-branch) + current_git_branch + ;; + *) + ;; +esac diff --git a/tools/utils/echo_color.sh b/tools/utils/echo_color.sh index ed4f5d260e..2a39f45421 100755 --- a/tools/utils/echo_color.sh +++ b/tools/utils/echo_color.sh @@ -10,6 +10,8 @@ # --warn Display the message as a warning in yellow. # --succ Display the message as a success in green. # --title Display the message in a purple title box. +# --subtitle Display the message in a blue title box with "➔" prefix. +# --subtitle2 Display the message in a light blue title box with "➔ ➔" prefix. # Arguments: # "message" Mandatory first argument; content varies based on the chosen option. @@ -21,6 +23,8 @@ GREEN="\e[32m" RESET="\e[0m" BOLD="\e[1m" PURPLE="\e[35m" +BLUE='\033[34m' +BLUE_LIGHT='\033[36m' echo_err() { echo "${RED}$1${RESET} $2" @@ -34,14 +38,30 @@ echo_succ() { echo "${GREEN}$1${RESET} $2" } -echo_title() { +# Usage: +# echo_box COLOR text +echo_box() { echo "" - local len=$((${#1}+2)) + local COLOR=$1 + local text=$2 + local len=$((${#text}+2)) local separator=$(printf '.%.0s' {1..$len}) - echo -e " ${PURPLE}${separator}${RESET}" - echo -e "${PURPLE}┌$(printf '%*s' $len | tr ' ' '─')┐${RESET}" - echo -e "${PURPLE}│ ${BOLD}$1${RESET}${PURPLE} │${RESET}" - echo -e "${PURPLE}└$(printf '%*s' $len | tr ' ' '─')┘${RESET}" + echo -e " ${COLOR}${separator}${RESET}" + echo -e "${COLOR}┌$(printf '%*s' $len | tr ' ' '─')┐${RESET}" + echo -e "${COLOR}│ ${BOLD}$text${RESET}${COLOR} │${RESET}" + echo -e "${COLOR}└$(printf '%*s' $len | tr ' ' '─')┘${RESET}" +} + +echo_title() { + echo_box "$PURPLE" "$1" +} + +echo_subtitle() { + echo_box $BLUE "➔ $1" +} + +echo_subtitle2() { + echo_box $BLUE_LIGHT "➔ ➔ $1" } case "$1" in @@ -57,6 +77,12 @@ case "$1" in --title) echo_title "$2" ;; + --subtitle) + echo_subtitle "$2" + ;; + --subtitle2) + echo_subtitle2 "$2" + ;; *) ;; esac