From 0f9ab1a5b05a7bdd297174eb6087e90c2c67290a Mon Sep 17 00:00:00 2001 From: LaszloP <7979773+lpusok@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:26:55 +0200 Subject: [PATCH 1/8] Add/Fix visionOS test support --- e2e/bitrise.yml | 39 +++++++++++++++++++ go.mod | 4 +- go.sum | 8 ++-- .../bitrise-io/go-utils/command/command.go | 4 +- .../bitrise-io/go-utils/progress/spinner.go | 8 +++- .../bitrise-io/go-utils/progress/wrapper.go | 8 ++++ .../go-xcode/v2/destination/device_finder.go | 3 +- .../go-xcode/v2/simulator/simulator.go | 3 +- vendor/modules.txt | 4 +- 9 files changed, 66 insertions(+), 15 deletions(-) diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml index 7b12c507..3a0482a0 100644 --- a/e2e/bitrise.yml +++ b/e2e/bitrise.yml @@ -140,6 +140,45 @@ workflows: mkdir -p ./_tmp2 echo "A=a" > ./_tmp2/p.xcconfig + test_visionOS: + description: visionOS requires Xcode >= 15 + before_run: + - _expose_xcode_version + steps: + - script: + inputs: + - content: |- + #!/bin/env bash + set -e + if [[ "$XCODE_MAJOR_VERSION" -lt 15 ]]; then + echo "This test case requires Xcode >= 15, skipping..." + exit 0 + fi + envman add --key XCODE_MAJOR_VERSION_AT_LEAST_15 --value true + - bitrise-run: + run_if: |- + {{ or (enveq "XCODE_MAJOR_VERSION_AT_LEAST_15" "true") (not .IsCI) }} + inputs: + - workflow_id: utility_test_visionOS + - bitrise_config_path: ./e2e/bitrise.yml + + utility_test_visionOS: + envs: + - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-visionOS-HelloWorld.git + - TEST_APP_BRANCH: main + - BITRISE_PROJECT_PATH: World.xcodeproj + - BITRISE_SCHEME: World + - TEST_PLAN: "" + - DESTINATION: platform=visionOS Simulator,name=Apple Vision Pro + - LOG_FORMATTER: xcbeautify + - RETRY_ON_FAILURE: "no" + - EXPECT_TEST_FAILURE: "false" + - CACHE_LEVEL: none + after_run: + - _run + - _check_outputs + - _check_exported_artifacts + _run: before_run: - _clear_outputs diff --git a/go.mod b/go.mod index 7520b1a4..121c97f9 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/bitrise-io/bitrise v0.0.0-20230707121919-a5b9e2d27ea9 github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.18 - github.com/bitrise-io/go-utils v1.0.9 + github.com/bitrise-io/go-utils v1.0.12 github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.19 - github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.36 + github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.44.0.20240618131947-99f09bec3d8b github.com/hashicorp/go-version v1.6.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index f28ce3ee..4308954e 100644 --- a/go.sum +++ b/go.sum @@ -7,12 +7,12 @@ github.com/bitrise-io/go-steputils v1.0.5/go.mod h1:YIUaQnIAyK4pCvQG0hYHVkSzKNT9 github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.18 h1:43cs5DGgfTWEcaod3hZ7eqOQjhVnOL1QiY6TN3xDhhw= github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.18/go.mod h1:/ueNOKnsjcUrlt8Ck75WRNspL7E6nAAylvl9oGJtYio= github.com/bitrise-io/go-utils v1.0.1/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY= -github.com/bitrise-io/go-utils v1.0.9 h1:wy7FewUpseNSTZr41BbGH0csfFqzptFt4zy2pOAEOg0= -github.com/bitrise-io/go-utils v1.0.9/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY= +github.com/bitrise-io/go-utils v1.0.12 h1:iJV1ZpyvSA0NCte/N6x+aIQ9TrNr5sIBlcJBf0dn1dE= +github.com/bitrise-io/go-utils v1.0.12/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY= github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.19 h1:55as5Iv0N4btuRP3YwRzN+BCMtKO210MnJ8mpxmeI7o= github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.19/go.mod h1:Laih4ji980SQkRgdnMCH0g4u2GZI/5nnbqmYT9UfKFQ= -github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.36 h1:X0eYAHxpeK1i/4yyU5XAqfMdap3t1nXFEUxOlxFIQ0I= -github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.36/go.mod h1:Y3K7ay6Q+znVKFmGGvr4jijnN8QmTBxB5+CatRtBl30= +github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.44.0.20240618131947-99f09bec3d8b h1:lvYFe6Nnd62lZRIxtzOPMCPW92Q3YV+S/MQ8gwKpFFU= +github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.44.0.20240618131947-99f09bec3d8b/go.mod h1:BFDhHF1ftPWpnZt4sjpPQ+H6QaQLkRoNwQZC2/xdcgg= github.com/bitrise-io/stepman v0.0.0-20230728094915-939f0fe5c19a h1:XM2PrNSUjpI4pIOZ1TcZdD4kh7KYN2D+yC6WYy22hoo= github.com/bitrise-io/stepman v0.0.0-20230728094915-939f0fe5c19a/go.mod h1:Z46oQnRMHlbuiV0mCJBigT2bWO5j3TPQncKaL3jCwsk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/vendor/github.com/bitrise-io/go-utils/command/command.go b/vendor/github.com/bitrise-io/go-utils/command/command.go index c068490e..3dcdac50 100644 --- a/vendor/github.com/bitrise-io/go-utils/command/command.go +++ b/vendor/github.com/bitrise-io/go-utils/command/command.go @@ -2,10 +2,10 @@ package command import ( "errors" + "fmt" "io" "os" "os/exec" - "strconv" "strings" ) @@ -125,7 +125,7 @@ func (m Model) PrintableCommandArgs() string { func PrintableCommandArgs(isQuoteFirst bool, fullCommandArgs []string) string { cmdArgsDecorated := []string{} for idx, anArg := range fullCommandArgs { - quotedArg := strconv.Quote(anArg) + quotedArg := fmt.Sprintf("\"%s\"", anArg) if idx == 0 && !isQuoteFirst { quotedArg = anArg } diff --git a/vendor/github.com/bitrise-io/go-utils/progress/spinner.go b/vendor/github.com/bitrise-io/go-utils/progress/spinner.go index 878ae403..78c70f32 100644 --- a/vendor/github.com/bitrise-io/go-utils/progress/spinner.go +++ b/vendor/github.com/bitrise-io/go-utils/progress/spinner.go @@ -35,10 +35,14 @@ func NewSpinner(message string, chars []string, delay time.Duration, writer io.W // NewDefaultSpinner ... func NewDefaultSpinner(message string) Spinner { + return NewDefaultSpinnerWithOutput(message, os.Stdout) +} + +// NewDefaultSpinnerWithOutput ... +func NewDefaultSpinnerWithOutput(message string, output io.Writer) Spinner { chars := []string{"⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"} delay := 100 * time.Millisecond - writer := os.Stdout - return NewSpinner(message, chars, delay, writer) + return NewSpinner(message, chars, delay, output) } func (s *Spinner) erase() { diff --git a/vendor/github.com/bitrise-io/go-utils/progress/wrapper.go b/vendor/github.com/bitrise-io/go-utils/progress/wrapper.go index d226a494..68de39e2 100644 --- a/vendor/github.com/bitrise-io/go-utils/progress/wrapper.go +++ b/vendor/github.com/bitrise-io/go-utils/progress/wrapper.go @@ -2,6 +2,7 @@ package progress import ( "fmt" + "io" "os" "strings" @@ -30,6 +31,13 @@ func NewDefaultWrapper(message string) Wrapper { return NewWrapper(spinner, interactiveMode) } +// NewDefaultWrapperWithOutput ... +func NewDefaultWrapperWithOutput(message string, output io.Writer) Wrapper { + spinner := NewDefaultSpinnerWithOutput(message, output) + interactiveMode := OutputDeviceIsTerminal() + return NewWrapper(spinner, interactiveMode) +} + // WrapAction ... func (w Wrapper) WrapAction(action func()) { if w.interactiveMode { diff --git a/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go b/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go index ea931246..6681a423 100644 --- a/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go +++ b/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go @@ -95,7 +95,8 @@ func (d deviceFinder) FindDevice(destination Simulator) (Device, error) { // XcodebuildDestination returns the required xcodebuild -destination flag value for a device func (d Device) XcodebuildDestination() string { // `arch` doesn't seem to work together with `id` - if d.Arch == "" { + if d.Arch == "" || // `arch` doesn't seem to work together with `id` + d.Platform != string(VisionOSSimulator) { // visionOS does not start tests with `id` (as of Xcode 15) return fmt.Sprintf("id=%s", d.ID) } diff --git a/vendor/github.com/bitrise-io/go-xcode/v2/simulator/simulator.go b/vendor/github.com/bitrise-io/go-xcode/v2/simulator/simulator.go index 379fe631..e686e891 100644 --- a/vendor/github.com/bitrise-io/go-xcode/v2/simulator/simulator.go +++ b/vendor/github.com/bitrise-io/go-xcode/v2/simulator/simulator.go @@ -3,7 +3,6 @@ package simulator import ( "bytes" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -196,7 +195,7 @@ func (m manager) CollectDiagnostics() (string, error) { return "", err } - diagnosticsOutDir, err := ioutil.TempDir("", diagnosticsName) + diagnosticsOutDir, err := os.MkdirTemp("", diagnosticsName) if err != nil { return "", fmt.Errorf("failed to collect Simulator diagnostics, could not create temporary directory: %v", err) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 9f166b18..51388648 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -20,7 +20,7 @@ github.com/bitrise-io/go-steputils/v2/export github.com/bitrise-io/go-steputils/v2/ruby github.com/bitrise-io/go-steputils/v2/stepconf github.com/bitrise-io/go-steputils/v2/stepenv -# github.com/bitrise-io/go-utils v1.0.9 +# github.com/bitrise-io/go-utils v1.0.12 ## explicit; go 1.13 github.com/bitrise-io/go-utils/colorstring github.com/bitrise-io/go-utils/command @@ -44,7 +44,7 @@ github.com/bitrise-io/go-utils/v2/fileutil github.com/bitrise-io/go-utils/v2/log github.com/bitrise-io/go-utils/v2/log/colorstring github.com/bitrise-io/go-utils/v2/pathutil -# github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.36 +# github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.44.0.20240618131947-99f09bec3d8b ## explicit; go 1.20 github.com/bitrise-io/go-xcode/v2/destination github.com/bitrise-io/go-xcode/v2/errorfinder From d54803c6d5bdf29f6c1659f010a3cace391446c2 Mon Sep 17 00:00:00 2001 From: LaszloP <7979773+lpusok@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:41:16 +0200 Subject: [PATCH 2/8] test fix --- e2e/bitrise.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml index 3a0482a0..f35aecde 100644 --- a/e2e/bitrise.yml +++ b/e2e/bitrise.yml @@ -23,7 +23,7 @@ workflows: steps: - bitrise-run: run_if: |- - {{ or (enveq "IS_LATEST_STACK_XCODE" "true") (not .IsCI) }} + {{ or (enveq "XCODE_MAJOR_VERSION" "15") (not .IsCI) }} inputs: - workflow_id: utility_test_rosetta_simulator - bitrise_config_path: ./e2e/bitrise.yml @@ -164,7 +164,7 @@ workflows: utility_test_visionOS: envs: - - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-visionOS-HelloWorld.git + - TEST_APP_URL: https://github.com/bitrise-io/visionOS-HelloWorld.git - TEST_APP_BRANCH: main - BITRISE_PROJECT_PATH: World.xcodeproj - BITRISE_SCHEME: World From 7224a7752d161e6f092360cf126c0d47f3a125da Mon Sep 17 00:00:00 2001 From: LaszloP <7979773+lpusok@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:51:01 +0200 Subject: [PATCH 3/8] Fix device selection --- .../bitrise-io/go-xcode/v2/destination/device_finder.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go b/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go index 6681a423..5dcd479a 100644 --- a/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go +++ b/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go @@ -94,9 +94,12 @@ func (d deviceFinder) FindDevice(destination Simulator) (Device, error) { // XcodebuildDestination returns the required xcodebuild -destination flag value for a device func (d Device) XcodebuildDestination() string { + if d.Platform == string(VisionOSSimulator) { // visionOS does not start tests with `id` (as of Xcode 15) + return fmt.Sprintf("platform=%s,name=%s,OS=%s", d.Platform, d.Name, d.OS) + } + // `arch` doesn't seem to work together with `id` - if d.Arch == "" || // `arch` doesn't seem to work together with `id` - d.Platform != string(VisionOSSimulator) { // visionOS does not start tests with `id` (as of Xcode 15) + if d.Arch == "" { // `arch` doesn't seem to work together with `id` return fmt.Sprintf("id=%s", d.ID) } From 09d982491a40a2fbfb67c14f112aa204f2c30c09 Mon Sep 17 00:00:00 2001 From: LaszloP <7979773+lpusok@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:18:25 +0200 Subject: [PATCH 4/8] Update sample app --- e2e/bitrise.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml index f35aecde..f7818a91 100644 --- a/e2e/bitrise.yml +++ b/e2e/bitrise.yml @@ -141,7 +141,7 @@ workflows: echo "A=a" > ./_tmp2/p.xcconfig test_visionOS: - description: visionOS requires Xcode >= 15 + description: visionOS requires Xcode >= 15.1 before_run: - _expose_xcode_version steps: @@ -151,20 +151,24 @@ workflows: #!/bin/env bash set -e if [[ "$XCODE_MAJOR_VERSION" -lt 15 ]]; then - echo "This test case requires Xcode >= 15, skipping..." + echo "This test case requires Xcode >= 15.1, skipping..." exit 0 fi - envman add --key XCODE_MAJOR_VERSION_AT_LEAST_15 --value true + if [[ "$XCODE_MINOR_VERSION" -lt 1 ]]; then + echo "This test case requires Xcode >= 15.1, skipping..." + exit 0 + fi + envman add --key XCODE_VERSION_AT_LEAST_15_1 --value true - bitrise-run: run_if: |- - {{ or (enveq "XCODE_MAJOR_VERSION_AT_LEAST_15" "true") (not .IsCI) }} + {{ or (enveq "XCODE_VERSION_AT_LEAST_15_1" "true") (not .IsCI) }} inputs: - workflow_id: utility_test_visionOS - bitrise_config_path: ./e2e/bitrise.yml utility_test_visionOS: envs: - - TEST_APP_URL: https://github.com/bitrise-io/visionOS-HelloWorld.git + - TEST_APP_URL: https://github.com/bitrise-io/sample-apps-visionOS-HelloWorld.git - TEST_APP_BRANCH: main - BITRISE_PROJECT_PATH: World.xcodeproj - BITRISE_SCHEME: World @@ -270,6 +274,10 @@ workflows: echo "Xcode major version: $xcode_major_version" envman add --key XCODE_MAJOR_VERSION --value $xcode_major_version + xcode_minor_version=${BASH_REMATCH[2]} + echo "Xcode minor version: $xcode_minor_version" + envman add --key XCODE_MINOR_VERSION --value $xcode_minor_version + _clear_outputs: steps: - script: From 03b7df7965c8c252de6d70bbf080731697ccc6da Mon Sep 17 00:00:00 2001 From: LaszloP <7979773+lpusok@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:37:17 +0200 Subject: [PATCH 5/8] Fix regexp --- e2e/bitrise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml index f7818a91..35fc947c 100644 --- a/e2e/bitrise.yml +++ b/e2e/bitrise.yml @@ -264,7 +264,7 @@ workflows: fi version=`xcodebuild -version` - regex="Xcode ([0-9]*)." + regex="Xcode ([0-9]*).([0-9]*)" if [[ ! $version =~ $regex ]]; then echo "Failed to determine Xcode major version" exit 1 From 047e07215a69c03abcb7798db95239eadef884d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Thu, 20 Jun 2024 18:12:42 +0200 Subject: [PATCH 6/8] Disable verbose log and simulator diagnostics --- e2e/bitrise.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml index 35fc947c..a2c6796c 100644 --- a/e2e/bitrise.yml +++ b/e2e/bitrise.yml @@ -178,6 +178,7 @@ workflows: - RETRY_ON_FAILURE: "no" - EXPECT_TEST_FAILURE: "false" - CACHE_LEVEL: none + - COLLECT_SIM_DIAGNOSTICS: never after_run: - _run - _check_outputs @@ -244,7 +245,7 @@ workflows: - log_formatter: $LOG_FORMATTER - perform_clean_action: "yes" - xcodebuild_options: -verbose - - verbose_log: "yes" + - verbose_log: "no" - should_retry_test_on_fail: $RETRY_ON_FAILURE - cache_level: $CACHE_LEVEL - collect_simulator_diagnostics: $COLLECT_SIM_DIAGNOSTICS From 113e637c2baf88d2d361c88fc989d1278bfa55f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Fri, 21 Jun 2024 15:24:43 +0200 Subject: [PATCH 7/8] Test only on 16.0 --- e2e/bitrise.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/bitrise.yml b/e2e/bitrise.yml index a2c6796c..c525fc3d 100644 --- a/e2e/bitrise.yml +++ b/e2e/bitrise.yml @@ -141,7 +141,7 @@ workflows: echo "A=a" > ./_tmp2/p.xcconfig test_visionOS: - description: visionOS requires Xcode >= 15.1 + description: visionOS requires Xcode >= 15.2 before_run: - _expose_xcode_version steps: @@ -150,18 +150,18 @@ workflows: - content: |- #!/bin/env bash set -e - if [[ "$XCODE_MAJOR_VERSION" -lt 15 ]]; then - echo "This test case requires Xcode >= 15.1, skipping..." + if [[ "$XCODE_MAJOR_VERSION" -lt 16 ]]; then + echo "This test case requires Xcode >= 16.0, skipping..." exit 0 fi - if [[ "$XCODE_MINOR_VERSION" -lt 1 ]]; then - echo "This test case requires Xcode >= 15.1, skipping..." + if [[ "$XCODE_MINOR_VERSION" -lt 0 ]]; then + echo "This test case requires Xcode >= 16.0, skipping..." exit 0 fi - envman add --key XCODE_VERSION_AT_LEAST_15_1 --value true + envman add --key XCODE_VERSION_AT_LEAST_16_0 --value true - bitrise-run: run_if: |- - {{ or (enveq "XCODE_VERSION_AT_LEAST_15_1" "true") (not .IsCI) }} + {{ or (enveq "XCODE_VERSION_AT_LEAST_16_0" "true") (not .IsCI) }} inputs: - workflow_id: utility_test_visionOS - bitrise_config_path: ./e2e/bitrise.yml From 2cb07be7084461794e8f7866b98f794a34568932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Tue, 10 Dec 2024 15:51:47 +0100 Subject: [PATCH 8/8] Fix master rebase --- .../bitrise-io/go-xcode/v2/destination/device_finder.go | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go b/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go index 228c9685..e27df467 100644 --- a/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go +++ b/vendor/github.com/bitrise-io/go-xcode/v2/destination/device_finder.go @@ -132,4 +132,3 @@ func (d deviceFinder) FindDevice(destination Simulator) (Device, error) { return device, err } -