Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUM-4079 chore: Migrate E2E Tests app workflow to GitLab #1957

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Carthage/Build
Carthage/Checkouts

xcuserdata/

*.local.xcconfig
E2ETests/code-signing

# Ignore files for Python tools:
.idea
Expand Down
23 changes: 23 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ stages:
- test
- ui-test
- smoke-test
- e2e-test
- release-build
- release-publish

Expand Down Expand Up @@ -61,6 +62,7 @@ ENV check:
- !reference [.test-pipeline-job, rules]
- !reference [.release-pipeline-job, rules]
script:
- ./tools/runner-setup.sh --datadog-ci # temporary, waiting for AMI
- make env-check

# ┌──────────────────────────┐
Expand Down Expand Up @@ -245,6 +247,27 @@ Smoke Tests (watchOS):
- make clean repo-setup ENV=ci
- make spm-build-watchos

# ┌──────────────────────┐
# │ E2E Test app upload: │
# └──────────────────────┘

E2E Test (upload to s8s):
stage: e2e-test
rules:
- if: '$CI_COMMIT_BRANCH == $DEVELOP_BRANCH'
variables:
XCODE: "15.3.0"
OS: "17.4"
artifacts:
paths:
- artifacts
expire_in: 2 weeks
script:
- ./tools/runner-setup.sh --xcode "$XCODE" --iOS --os "$OS" --datadog-ci # temporary, waiting for AMI
- make clean
- export DRY_RUN=${DRY_RUN:-0} # default to 0 if not specified
- make e2e-build-upload ARTIFACTS_PATH="artifacts/e2e"

# ┌──────────────┐
# │ SDK release: │
# └──────────────┘
Expand Down
58 changes: 43 additions & 15 deletions E2ETests/Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,58 @@
all: dependencies archive upload
.PHONY: clean archive export upload

dependencies:
@echo "⚙️ Installing datadog-ci..."
@npm install -g @datadog/datadog-ci
REPO_ROOT := ../
include ../tools/utils/common.mk

BUILD_DIR := .build
ARCHIVE_PATH := $(BUILD_DIR)/Runner.xcarchive
IPA_PATH := $(ARTIFACTS_PATH)/Runner.ipa

clean:
@$(ECHO_SUBTITLE2) "make clean"
rm -rf "$(BUILD_DIR)"
ifdef ARTIFACTS_PATH
rm -rf "$(IPA_PATH)"
endif

archive:
xcrun agvtool new-version "$(shell git rev-parse --short HEAD)"

set -o pipefail && xcodebuild \
@:$(eval VERSION ?= $(CURRENT_GIT_COMMIT_SHORT))
@$(ECHO_SUBTITLE2) "make archive VERSION='$(VERSION)'"
@xcrun agvtool new-version "$(VERSION)"
set -eo pipefail; \
xcodebuild \
-project E2ETests.xcodeproj \
-scheme Runner \
-sdk iphoneos \
-configuration Synthetics \
-destination generic/platform=iOS \
-archivePath .build/Runner.xcarchive \
archive | xcbeautify
-archivePath $(ARCHIVE_PATH) \
archive | xcbeautify
git restore E2ETests.xcodeproj/project.pbxproj
@$(ECHO_SUCCESS) "Archive ready in '$(ARCHIVE_PATH)'"

set -o pipefail && xcodebuild -exportArchive \
-archivePath .build/Runner.xcarchive \
export:
@$(call require_param,ARTIFACTS_PATH)
@:$(eval VERSION ?= $(CURRENT_GIT_COMMIT_SHORT))
@$(ECHO_SUBTITLE2) "make export VERSION='$(VERSION)' ARTIFACTS_PATH='$(ARTIFACTS_PATH)'"
set -o pipefaill; \
xcodebuild -exportArchive \
-archivePath $(ARCHIVE_PATH) \
-exportOptionsPlist exportOptions.plist \
-exportPath .build \
| xcbeautify
-exportPath $(BUILD_DIR) \
| xcbeautify
mkdir -p "$(ARTIFACTS_PATH)"
cp -v "$(BUILD_DIR)/Runner.ipa" "$(IPA_PATH)"
@$(ECHO_SUCCESS) "IPA exported to '$(IPA_PATH)'"

upload:
@$(call require_param,ARTIFACTS_PATH)
@$(call require_param,DATADOG_API_KEY)
@$(call require_param,DATADOG_APP_KEY)
@$(call require_param,S8S_APPLICATION_ID)
@:$(eval VERSION ?= $(CURRENT_GIT_COMMIT_SHORT))
@$(ECHO_SUBTITLE2) "make upload VERSION='$(VERSION)' ARTIFACTS_PATH='$(ARTIFACTS_PATH)'"
datadog-ci synthetics upload-application \
--mobileApp ".build/Runner.ipa" \
--mobileApp "$(IPA_PATH)" \
--mobileApplicationId "${S8S_APPLICATION_ID}" \
--versionName "$(shell agvtool vers -terse)" \
--versionName "$(VERSION)" \
--latest
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ all: env-check repo-setup templates
tools-test \
smoke-test smoke-test-ios smoke-test-ios-all smoke-test-tvos smoke-test-tvos-all \
spm-build spm-build-ios spm-build-tvos spm-build-visionos spm-build-macos spm-build-watchos \
e2e-build-upload \
models-generate rum-models-generate sr-models-generate models-verify rum-models-verify sr-models-verify \
release-build release-validate release-publish-github \
release-publish-podspec release-publish-internal-podspecs release-publish-dependent-podspecs release-publish-legacy-podspecs \
Expand Down Expand Up @@ -259,6 +260,13 @@ spm-build-macos:
@$(MAKE) spm-build DESTINATION="platform=macOS" SCHEME="DatadogTrace"
@$(MAKE) spm-build DESTINATION="platform=macOS" SCHEME="DatadogCrashReporting"

# Builds a new version of the E2E app and publishes it to synthetics.
e2e-build-upload:
@$(call require_param,ARTIFACTS_PATH)
@:$(eval DRY_RUN ?= 1)
@$(ECHO_TITLE) "make e2e-build-upload ARTIFACTS_PATH='$(ARTIFACTS_PATH)' DRY_RUN='$(DRY_RUN)'"
DRY_RUN=$(DRY_RUN) ./tools/e2e-build-upload.sh --artifacts-path "$(ARTIFACTS_PATH)"

xcodeproj-session-replay:
@echo "⚙️ Generating 'DatadogSessionReplay.xcodeproj'..."
@cd DatadogSessionReplay/ && swift package generate-xcodeproj
Expand Down Expand Up @@ -430,6 +438,3 @@ bump:
git add . ; \
git commit -m "Bumped version to $$version"; \
echo Bumped version to $$version

e2e-upload:
./tools/code-sign.sh -- $(MAKE) -C E2ETests
33 changes: 0 additions & 33 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ workflows:
This workflow is triggered for each new commit pushed to `develop` or `master` branch.
after_run:
- _make_dependencies
- run_e2e_s8s_upload
- _deploy_artifacts
- _notify_failure_on_slack

push_to_dogfooding:
after_run:
Expand Down Expand Up @@ -109,34 +107,3 @@ workflows:
- destination: platform=iOS Simulator,name=iPhone 11,OS=latest
- project_path: Datadog.xcworkspace
- xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/E2E-instrumentation-tests.html"

run_e2e_s8s_upload:
description: |-
Upload E2E application to Synthetics.
steps:
- script:
title: Upload E2E application to Synthetics.
run_if: '{{enveq "BITRISE_GIT_BRANCH" "develop"}}'
inputs:
- content: |-
#!/usr/bin/env bash
set -e

# prepare certificate
export P12_PATH=e2e_cert.p12
export P12_PASSWORD=$E2E_CERTIFICATE_P12_PASSWORD
echo $E2E_CERTIFICATE_P12_BASE64 | base64 --decode -o $P12_PATH

# prepare provisioning profile
export PP_PATH=e2e.mobileprovision
echo $E2E_PROVISIONING_PROFILE_BASE64 | base64 --decode -o $PP_PATH

# prepare xcconfig
echo $E2E_XCCONFIG_BASE64 | base64 --decode -o E2ETests/xcconfigs/E2E.local.xcconfig

# prepare for synthetics upload
export DATADOG_API_KEY=$E2E_S8S_API_KEY
export DATADOG_APP_KEY=$E2E_S8S_APPLICATION_KEY
export S8S_APPLICATION_ID=$E2E_S8S_APPLICATION_ID

make e2e-upload
79 changes: 0 additions & 79 deletions tools/code-sign.sh

This file was deleted.

Loading