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

Missing shared schemes #270

Merged
merged 7 commits into from
Sep 1, 2023
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
143 changes: 61 additions & 82 deletions _tests/integration/ios_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,51 @@ package integration

import (
"fmt"
"os"
"path/filepath"
"strings"
"testing"

"github.com/bitrise-io/bitrise-init/_tests/integration/helper"
"github.com/bitrise-io/bitrise-init/models"
"github.com/bitrise-io/bitrise-init/output"
"github.com/bitrise-io/bitrise-init/scanner"
"github.com/bitrise-io/bitrise-init/steps"
"github.com/bitrise-io/go-utils/fileutil"
"github.com/stretchr/testify/require"
)

const workspaceSettingsWithAutocreateSchemesDisabledContent = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
`

func TestIOSNoSchemes(t *testing.T) {
sampleAppDir := t.TempDir()

helper.GitClone(t, sampleAppDir, "https://github.com/bitrise-samples/ios-no-shared-schemes.git")
xcodeProjectPath := filepath.Join(sampleAppDir, "BitriseXcode7Sample.xcodeproj")
projectEmbeddedWorksaceSettingsPth := filepath.Join(xcodeProjectPath, "project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings")
require.NoError(t, os.MkdirAll(filepath.Dir(projectEmbeddedWorksaceSettingsPth), os.ModePerm))
require.NoError(t, fileutil.WriteStringToFile(projectEmbeddedWorksaceSettingsPth, workspaceSettingsWithAutocreateSchemesDisabledContent))

result, err := scanner.GenerateAndWriteResults(sampleAppDir, sampleAppDir, output.YAMLFormat)
require.Error(t, err)

iosWarnings := result.ScannerToWarningsWithRecommendations["ios"]
require.Equal(t, 1, len(iosWarnings))
require.True(t, strings.Contains(iosWarnings[0].Error, "no schemes found and the Xcode project's 'Autocreate schemes' option is disabled"))

generalErrors := result.ScannerToErrorsWithRecommendations["general"]
require.Equal(t, 1, len(generalErrors))
require.Equal(t, "No known platform detected", generalErrors[0].Error)
}

func TestIOS(t *testing.T) {
var testCases = []helper.TestCase{
{
Expand Down Expand Up @@ -78,13 +116,11 @@ var iosNoSharedSchemesVersions = []interface{}{
models.FormatVersion,
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.RecreateUserSchemesVersion,
steps.XcodeTestVersion,
steps.XcodeArchiveVersion,
steps.DeployToBitriseIoVersion,
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.RecreateUserSchemesVersion,
steps.XcodeTestVersion,
steps.DeployToBitriseIoVersion,
}
Expand Down Expand Up @@ -117,16 +153,16 @@ var iosNoSharedSchemesResultYML = fmt.Sprintf(`options:
type: selector
value_map:
ad-hoc:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
app-store:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
development:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
enterprise:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
configs:
ios:
ios-test-missing-shared-schemes-config: |
ios-test-config: |
format_version: "%s"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
Expand All @@ -140,9 +176,6 @@ configs:
steps:
- activate-ssh-key@%s: {}
- git-clone@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- xcode-test@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
Expand All @@ -164,9 +197,6 @@ configs:
steps:
- activate-ssh-key@%s: {}
- git-clone@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- xcode-test@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
Expand All @@ -177,19 +207,7 @@ configs:
warnings:
ios: []
warnings_with_recommendations:
ios:
- error: |-
No shared schemes found for project: BitriseXcode7Sample.xcodeproj.
Automatically generated schemes may differ from the ones in your project.
Make sure to <a href="https://support.bitrise.io/hc/en-us/articles/4405779956625">share your schemes</a> for the expected behaviour.
recommendations:
DetailedError:
title: We couldn't parse your project files.
description: |-
You can fix the problem and try again, or skip auto-configuration and set up your project manually. Our auto-configurator returned the following error:
No shared schemes found for project: BitriseXcode7Sample.xcodeproj.
Automatically generated schemes may differ from the ones in your project.
Make sure to <a href="https://support.bitrise.io/hc/en-us/articles/4405779956625">share your schemes</a> for the expected behaviour.
ios: []
`, iosNoSharedSchemesVersions...)

var iosCocoapodsAtRootVersions = []interface{}{
Expand Down Expand Up @@ -889,37 +907,33 @@ var appleMultiplatformAppVersions = []interface{}{
// iOS
models.FormatVersion,

// ios-test-missing-shared-schemes-config/deploy
// ios-test-config/deploy
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.RecreateUserSchemesVersion,
steps.XcodeTestVersion,
steps.XcodeArchiveVersion,
steps.DeployToBitriseIoVersion,

// ios-test-missing-shared-schemes-config/primary
// ios-test-config/primary
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.RecreateUserSchemesVersion,
steps.XcodeTestVersion,
steps.DeployToBitriseIoVersion,

// macOS
models.FormatVersion,

// ios-test-missing-shared-schemes-config/deploy
// ios-test-config/deploy
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.CertificateAndProfileInstallerVersion,
steps.RecreateUserSchemesVersion,
steps.XcodeTestMacVersion,
steps.XcodeArchiveMacVersion,
steps.DeployToBitriseIoVersion,

// ios-test-missing-shared-schemes-config/primary
// ios-test-config/primary
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.RecreateUserSchemesVersion,
steps.XcodeTestMacVersion,
steps.DeployToBitriseIoVersion,
}
Expand Down Expand Up @@ -952,13 +966,13 @@ var appleMultiplatformAppResultYAML = fmt.Sprintf(`options:
type: selector
value_map:
ad-hoc:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
app-store:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
development:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
enterprise:
config: ios-test-missing-shared-schemes-config
config: ios-test-config
macos:
title: Project or Workspace path
summary: The location of your Xcode project, Xcode workspace or SPM project files
Expand Down Expand Up @@ -988,16 +1002,16 @@ var appleMultiplatformAppResultYAML = fmt.Sprintf(`options:
type: selector
value_map:
app-store:
config: macos-test-missing-shared-schemes-config
config: macos-test-config
developer-id:
config: macos-test-missing-shared-schemes-config
config: macos-test-config
development:
config: macos-test-missing-shared-schemes-config
config: macos-test-config
none:
config: macos-test-missing-shared-schemes-config
config: macos-test-config
configs:
ios:
ios-test-missing-shared-schemes-config: |
ios-test-config: |
format_version: "%s"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
Expand All @@ -1011,9 +1025,6 @@ configs:
steps:
- activate-ssh-key@%s: {}
- git-clone@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- xcode-test@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
Expand All @@ -1035,9 +1046,6 @@ configs:
steps:
- activate-ssh-key@%s: {}
- git-clone@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- xcode-test@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
Expand All @@ -1046,7 +1054,7 @@ configs:
- cache_level: none
- deploy-to-bitrise-io@%s: {}
macos:
macos-test-missing-shared-schemes-config: |
macos-test-config: |
format_version: "%s"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: macos
Expand All @@ -1056,9 +1064,6 @@ configs:
- activate-ssh-key@%s: {}
- git-clone@%s: {}
- certificate-and-profile-installer@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- xcode-test-mac@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
Expand All @@ -1073,9 +1078,6 @@ configs:
steps:
- activate-ssh-key@%s: {}
- git-clone@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- xcode-test-mac@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
Expand All @@ -1085,32 +1087,9 @@ warnings:
ios: []
macos: []
warnings_with_recommendations:
ios:
- error: |-
No shared schemes found for project: Bitrise TODOs Sample.xcodeproj.
Automatically generated schemes may differ from the ones in your project.
Make sure to <a href="https://support.bitrise.io/hc/en-us/articles/4405779956625">share your schemes</a> for the expected behaviour.
recommendations:
DetailedError:
title: We couldn't parse your project files.
description: |-
You can fix the problem and try again, or skip auto-configuration and set up your project manually. Our auto-configurator returned the following error:
No shared schemes found for project: Bitrise TODOs Sample.xcodeproj.
Automatically generated schemes may differ from the ones in your project.
Make sure to <a href="https://support.bitrise.io/hc/en-us/articles/4405779956625">share your schemes</a> for the expected behaviour.
macos:
- error: |-
No shared schemes found for project: Bitrise TODOs Sample.xcodeproj.
Automatically generated schemes may differ from the ones in your project.
Make sure to <a href="https://support.bitrise.io/hc/en-us/articles/4405779956625">share your schemes</a> for the expected behaviour.
recommendations:
DetailedError:
title: We couldn't parse your project files.
description: |-
You can fix the problem and try again, or skip auto-configuration and set up your project manually. Our auto-configurator returned the following error:
No shared schemes found for project: Bitrise TODOs Sample.xcodeproj.
Automatically generated schemes may differ from the ones in your project.
Make sure to <a href="https://support.bitrise.io/hc/en-us/articles/4405779956625">share your schemes</a> for the expected behaviour.`, appleMultiplatformAppVersions...)
ios: []
macos: []
`, appleMultiplatformAppVersions...)

var sampleSPMVersions = []interface{}{
// iOS
Expand Down
18 changes: 1 addition & 17 deletions _tests/integration/manual_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var customConfigVersions = []interface{}{
steps.CacheSaveGradleVersion,
steps.DeployToBitriseIoVersion,

// default-android-config-kts
// default-android-config-kts
models.FormatVersion,
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
Expand Down Expand Up @@ -177,7 +177,6 @@ var customConfigVersions = []interface{}{
models.FormatVersion,
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.RecreateUserSchemesVersion,
steps.CocoapodsInstallVersion,
steps.XcodeTestVersion,
steps.XcodeArchiveVersion,
Expand All @@ -187,7 +186,6 @@ var customConfigVersions = []interface{}{
steps.GitCloneVersion,
steps.CacheRestoreCocoapodsVersion,
steps.CacheRestoreSPMVersion,
steps.RecreateUserSchemesVersion,
steps.CocoapodsInstallVersion,
steps.XcodeTestVersion,
steps.CacheSaveCocoapodsVersion,
Expand All @@ -199,7 +197,6 @@ var customConfigVersions = []interface{}{
steps.ActivateSSHKeyVersion,
steps.GitCloneVersion,
steps.CertificateAndProfileInstallerVersion,
steps.RecreateUserSchemesVersion,
steps.CocoapodsInstallVersion,
steps.XcodeTestMacVersion,
steps.XcodeArchiveMacVersion,
Expand All @@ -209,7 +206,6 @@ var customConfigVersions = []interface{}{
steps.GitCloneVersion,
steps.CacheRestoreCocoapodsVersion,
steps.CacheRestoreSPMVersion,
steps.RecreateUserSchemesVersion,
steps.CocoapodsInstallVersion,
steps.XcodeTestMacVersion,
steps.CacheSaveCocoapodsVersion,
Expand Down Expand Up @@ -926,9 +922,6 @@ configs:
- activate-ssh-key@%s:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- cocoapods-install@%s:
inputs:
- is_cache_disabled: "true"
Expand Down Expand Up @@ -956,9 +949,6 @@ configs:
- git-clone@%s: {}
- restore-cocoapods-cache@%s: {}
- restore-spm-cache@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- cocoapods-install@%s:
inputs:
- is_cache_disabled: "true"
Expand All @@ -983,9 +973,6 @@ configs:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@%s: {}
- certificate-and-profile-installer@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- cocoapods-install@%s:
inputs:
- is_cache_disabled: "true"
Expand All @@ -1006,9 +993,6 @@ configs:
- git-clone@%s: {}
- restore-cocoapods-cache@%s: {}
- restore-spm-cache@%s: {}
- recreate-user-schemes@%s:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- cocoapods-install@%s:
inputs:
- is_cache_disabled: "true"
Expand Down
Loading