本文整理汇总了Golang中github.com/bitrise-io/go-utils/log.Detail函数的典型用法代码示例。如果您正苦于以下问题:Golang Detail函数的具体用法?Golang Detail怎么用?Golang Detail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Detail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: print
func (configs ConfigsModel) print() {
log.Info("Configs:")
log.Detail("- GradleFile: %s", configs.GradleFile)
log.Detail("- UnitTestTasks: %s", configs.UnitTestTasks)
log.Detail("- GradlewPath: %s", configs.GradlewPath)
log.Detail("- UnitTestFlags: %s", configs.UnitTestFlags)
log.Detail("- DeployDir: %s", configs.DeployDir)
}
开发者ID:bitrise-io,项目名称:steps-gradle-unit-test,代码行数:9,代码来源:main.go
示例2: print
func (configs ConfigsModel) print() {
log.Info("Configs:")
log.Detail("- CarthageCommand: %s", configs.CarthageCommand)
log.Detail("- CarthageOptions: %s", configs.CarthageOptions)
log.Detail("- GithubAccessToken: %s", configs.GithubAccessToken)
fmt.Println()
}
开发者ID:bitrise-steplib,项目名称:steps-carthage,代码行数:9,代码来源:main.go
示例3: print
func (configs ConfigsModel) print() {
log.Info("Build Configs:")
log.Detail("- XamarinSolution: %s", configs.XamarinSolution)
log.Detail("- XamarinConfiguration: %s", configs.XamarinConfiguration)
log.Detail("- XamarinPlatform: %s", configs.XamarinPlatform)
log.Info("Nunit Configs:")
log.Detail("- CustomOptions: %s", configs.CustomOptions)
log.Info("Other Configs:")
log.Detail("- DeployDir: %s", configs.DeployDir)
}
开发者ID:bitrise-steplib,项目名称:steps-nunit-runner,代码行数:15,代码来源:main.go
示例4: runXcodeBuildCmd
func runXcodeBuildCmd(useStdOut bool, args ...string) (string, int, error) {
// command
buildCmd := cmd.CreateXcodebuildCmd(args...)
// output buffer
var outBuffer bytes.Buffer
// additional output writers, like StdOut
outWritters := []io.Writer{}
if useStdOut {
outWritters = append(outWritters, os.Stdout)
}
// unify as a single writer
outWritter := cmd.CreateBufferedWriter(&outBuffer, outWritters...)
// and set the writer
buildCmd.Stdin = nil
buildCmd.Stdout = outWritter
buildCmd.Stderr = outWritter
buildCmd.Env = append(os.Environ(), xcodeCommandEnvs...)
cmdArgsForPrint := cmd.PrintableCommandArgsWithEnvs(buildCmd.Args, xcodeCommandEnvs)
log.Detail("$ %s", cmdArgsForPrint)
err := buildCmd.Run()
if err != nil {
if exitError, ok := err.(*exec.ExitError); ok {
waitStatus, ok := exitError.Sys().(syscall.WaitStatus)
if !ok {
return outBuffer.String(), 1, errors.New("Failed to cast exit status")
}
return outBuffer.String(), waitStatus.ExitStatus(), err
}
return outBuffer.String(), 1, err
}
return outBuffer.String(), 0, nil
}
开发者ID:bitrise-io,项目名称:steps-xcode-test,代码行数:35,代码来源:main.go
示例5: print
func (configs ConfigsModel) print() {
log.Info("Configs:")
log.Detail("- JSONKeyPath: %s", secureInput(configs.JSONKeyPath))
log.Detail("- PackageName: %s", configs.PackageName)
log.Detail("- ApkPath: %s", configs.ApkPath)
log.Detail("- Track: %s", configs.Track)
log.Detail("- UserFraction: %s", configs.UserFraction)
log.Detail("- WhatsnewsDir: %s", configs.WhatsnewsDir)
log.Info("Deprecated Configs:")
log.Detail("- ServiceAccountEmail: %s", secureInput(configs.ServiceAccountEmail))
log.Detail("- P12KeyPath: %s", secureInput(configs.P12KeyPath))
}
开发者ID:bitrise-steplib,项目名称:steps-google-play-deploy,代码行数:12,代码来源:main.go
示例6: print
func (configs ConfigsModel) print() {
fmt.Println()
log.Info("Configs:")
log.Detail(" - CertificateURL: %s", secureInput(configs.CertificateURL))
log.Detail(" - CertificatePassphrase: %s", secureInput(configs.CertificatePassphrase))
log.Detail(" - ProvisioningProfileURL: %s", secureInput(configs.ProvisioningProfileURL))
log.Detail(" - DefaultCertificateURL: %s", secureInput(configs.DefaultCertificateURL))
log.Detail(" - DefaultCertificatePassphrase: %s", secureInput(configs.DefaultCertificatePassphrase))
log.Detail(" - DefaultProvisioningProfileURL: %s", secureInput(configs.DefaultProvisioningProfileURL))
log.Detail(" - KeychainPath: %s", configs.KeychainPath)
log.Detail(" - KeychainPassword: %s", secureInput(configs.KeychainPassword))
}
开发者ID:bitrise-io,项目名称:steps-certificate-and-profile-installer,代码行数:14,代码来源:main.go
示例7: print
func (configs ConfigsModel) print() {
log.Info("Build Configs:")
log.Detail("- XamarinSolution: %s", configs.XamarinSolution)
log.Detail("- XamarinConfiguration: %s", configs.XamarinConfiguration)
log.Detail("- XamarinPlatform: %s", configs.XamarinPlatform)
log.Info("Xamarin UITest Configs:")
log.Detail("- TestToRun: %s", configs.TestToRun)
log.Detail("- SimulatorDevice: %s", configs.SimulatorDevice)
log.Detail("- SimulatorOsVersion: %s", configs.SimulatorOsVersion)
log.Info("Other Configs:")
log.Detail("- DeployDir: %s", configs.DeployDir)
}
开发者ID:bitrise-steplib,项目名称:steps-xamarin-ios-test,代码行数:17,代码来源:main.go
示例8: BootSimulator
// BootSimulator ...
func BootSimulator(simulator models.SimInfoModel, xcodebuildVersion models.XcodebuildVersionModel) error {
simulatorApp := "Simulator"
if xcodebuildVersion.MajorVersion == 6 {
simulatorApp = "iOS Simulator"
}
xcodeDevDirPth, err := getXcodeDeveloperDirPath()
if err != nil {
return fmt.Errorf("Failed to get Xcode Developer Directory - most likely Xcode.app is not installed")
}
simulatorAppFullPath := filepath.Join(xcodeDevDirPth, "Applications", simulatorApp+".app")
openCmd := exec.Command("open", simulatorAppFullPath, "--args", "-CurrentDeviceUDID", simulator.SimID)
log.Detail("$ %s", cmd.PrintableCommandArgs(openCmd.Args))
out, err := openCmd.CombinedOutput()
outStr := string(out)
if err != nil {
return fmt.Errorf("failed to start simulators (%s), output: %s, error: %s", simulator.SimID, outStr, err)
}
return nil
}
开发者ID:bitrise-io,项目名称:steps-xcode-test,代码行数:24,代码来源:xcodeutil.go
示例9: runPrettyXcodeBuildCmd
func runPrettyXcodeBuildCmd(useStdOut bool, xcprettyArgs []string, xcodebuildArgs []string) (string, int, error) {
//
buildCmd := cmd.CreateXcodebuildCmd(xcodebuildArgs...)
prettyCmd := cmd.CreateXcprettyCmd(xcprettyArgs...)
//
var buildOutBuffer bytes.Buffer
//
pipeReader, pipeWriter := io.Pipe()
//
// build outputs:
// - write it into a buffer
// - write it into the pipe, which will be fed into xcpretty
buildOutWriters := []io.Writer{pipeWriter}
buildOutWriter := cmd.CreateBufferedWriter(&buildOutBuffer, buildOutWriters...)
//
var prettyOutWriter io.Writer
if useStdOut {
prettyOutWriter = os.Stdout
}
// and set the writers
buildCmd.Stdin = nil
buildCmd.Stdout = buildOutWriter
buildCmd.Stderr = buildOutWriter
//
prettyCmd.Stdin = pipeReader
prettyCmd.Stdout = prettyOutWriter
prettyCmd.Stderr = prettyOutWriter
//
buildCmd.Env = append(os.Environ(), xcodeCommandEnvs...)
log.Detail("$ set -o pipefail && %s | %v",
cmd.PrintableCommandArgsWithEnvs(buildCmd.Args, xcodeCommandEnvs),
cmd.PrintableCommandArgs(prettyCmd.Args))
fmt.Println()
if err := buildCmd.Start(); err != nil {
return buildOutBuffer.String(), 1, err
}
if err := prettyCmd.Start(); err != nil {
return buildOutBuffer.String(), 1, err
}
defer func() {
if err := pipeWriter.Close(); err != nil {
log.Warn("Failed to close xcodebuild-xcpretty pipe, error: %s", err)
}
if err := prettyCmd.Wait(); err != nil {
log.Warn("xcpretty command failed, error: %s", err)
}
}()
if err := buildCmd.Wait(); err != nil {
if exitError, ok := err.(*exec.ExitError); ok {
waitStatus, ok := exitError.Sys().(syscall.WaitStatus)
if !ok {
return buildOutBuffer.String(), 1, errors.New("Failed to cast exit status")
}
return buildOutBuffer.String(), waitStatus.ExitStatus(), err
}
return buildOutBuffer.String(), 1, err
}
return buildOutBuffer.String(), 0, nil
}
开发者ID:bitrise-io,项目名称:steps-xcode-test,代码行数:67,代码来源:main.go
示例10: main
//.........这里部分代码省略.........
// Artifacts
resultLog := ""
for testProjectName, testProjectOutput := range testProjectOutputMap {
if len(testProjectOutput.ReferredProjectNames) == 0 {
log.Warn("Test project (%s) does not refers to any project, skipping...", testProjectName)
continue
}
for _, projectName := range testProjectOutput.ReferredProjectNames {
projectOutput, ok := projectOutputMap[projectName]
if !ok {
continue
}
appPth := ""
for _, output := range projectOutput.Outputs {
if output.OutputType == constants.OutputTypeAPP {
appPth = output.Pth
}
}
if appPth == "" {
log.Error("No app generated for project: %s", projectName)
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
os.Exit(1)
}
// Set APP_BUNDLE_PATH env to let the test know which .app file should be tested
// This env is used in the Xamarin.UITest project to refer to the .app path
if err := os.Setenv("APP_BUNDLE_PATH", appPth); err != nil {
log.Error("Failed to set APP_BUNDLE_PATH environment, without this env test will fail, error: %s", err)
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
os.Exit(1)
}
// Run test
fmt.Println()
log.Info("Testing (%s) against (%s)", testProjectName, projectName)
log.Detail("test dll: %s", testProjectOutput.Output.Pth)
log.Detail("app: %s", appPth)
nunitConsole.SetDLLPth(testProjectOutput.Output.Pth)
nunitConsole.SetTestToRun(configs.TestToRun)
fmt.Println()
log.Info("Running Xamarin UITest")
log.Done("$ %s", nunitConsole.PrintableCommand())
fmt.Println()
err := nunitConsole.Run()
testLog, readErr := testResultLogContent(resultLogPth)
if readErr != nil {
log.Warn("Failed to read test result, error: %s", readErr)
}
resultLog = testLog
if err != nil {
log.Error("Test failed, error: %s", err)
if errorMsg, err := parseErrorFromResultLog(resultLog); err != nil {
log.Warn("Failed to parse error message from result log, error: %s", err)
} else if errorMsg != "" {
log.Error("%s", errorMsg)
}
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
if resultLog != "" {
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", resultLog); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", err)
}
}
os.Exit(1)
}
}
}
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_RESULT", "succeeded"); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_RESULT", err)
}
if resultLog != "" {
if err := exportEnvironmentWithEnvman("BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", resultLog); err != nil {
log.Warn("Failed to export environment: %s, error: %s", "BITRISE_XAMARIN_TEST_FULL_RESULTS_TEXT", err)
}
}
}
开发者ID:bitrise-steplib,项目名称:steps-xamarin-ios-test,代码行数:101,代码来源:main.go
示例11: main
func main() {
configs := createConfigsModelFromEnvs()
fmt.Println()
configs.print()
if err := configs.validate(); err != nil {
fmt.Println()
log.Error("Issue with input: %s", err)
os.Exit(1)
}
//
// Create client
fmt.Println()
log.Info("Authenticateing")
jwtConfig := new(jwt.Config)
if configs.JSONKeyPath != "" {
jsonKeyPth := ""
if strings.HasPrefix(configs.JSONKeyPath, "file://") {
jsonKeyPth = strings.TrimPrefix(configs.JSONKeyPath, "file://")
} else {
tmpDir, err := pathutil.NormalizedOSTempDirPath("__google-play-deploy__")
if err != nil {
log.Error("Failed to create tmp dir, error: %s", err)
os.Exit(1)
}
jsonKeyPth = filepath.Join(tmpDir, "key.json")
if err := downloadFile(configs.JSONKeyPath, jsonKeyPth); err != nil {
log.Error("Failed to download json key file, error: %s", err)
os.Exit(1)
}
}
authConfig, err := jwtConfigFromJSONKeyFile(jsonKeyPth)
if err != nil {
log.Error("Failed to create auth config from json key file, error: %s", err)
os.Exit(1)
}
jwtConfig = authConfig
} else {
p12KeyPath := ""
if strings.HasPrefix(configs.P12KeyPath, "file://") {
p12KeyPath = strings.TrimPrefix(configs.P12KeyPath, "file://")
} else {
tmpDir, err := pathutil.NormalizedOSTempDirPath("__google-play-deploy__")
if err != nil {
log.Error("Failed to create tmp dir, error: %s", err)
os.Exit(1)
}
p12KeyPath = filepath.Join(tmpDir, "key.p12")
if err := downloadFile(configs.P12KeyPath, p12KeyPath); err != nil {
log.Error("Failed to download p12 key file, error: %s", err)
os.Exit(1)
}
}
authConfig, err := jwtConfigFromP12KeyFile(p12KeyPath, configs.ServiceAccountEmail)
if err != nil {
log.Error("Failed to create auth config from p12 key file, error: %s", err)
os.Exit(1)
}
jwtConfig = authConfig
}
client := jwtConfig.Client(oauth2.NoContext)
service, err := androidpublisher.New(client)
if err != nil {
log.Error("Failed to create publisher service, error: %s", err)
os.Exit(1)
}
log.Done("Authenticated client created")
// ---
//
// Create insert edit
fmt.Println()
log.Info("Create new edit")
editsService := androidpublisher.NewEditsService(service)
editsInsertCall := editsService.Insert(configs.PackageName, nil)
appEdit, err := editsInsertCall.Do()
if err != nil {
log.Error("Failed to perform edit insert call, error: %s", err)
os.Exit(1)
}
log.Detail(" editID: %s", appEdit.Id)
//.........这里部分代码省略.........
开发者ID:bitrise-steplib,项目名称:steps-google-play-deploy,代码行数:101,代码来源:main.go
示例12: print
func (configs ConfigsModel) print() {
log.Info("Build Configs:")
log.Detail("- XamarinSolution: %s", configs.XamarinSolution)
log.Detail("- XamarinConfiguration: %s", configs.XamarinConfiguration)
log.Detail("- XamarinPlatform: %s", configs.XamarinPlatform)
log.Info("Xamarin Test Cloud Configs:")
log.Detail("- User: %s", configs.User)
log.Detail("- APIKey: %s", configs.APIKey)
log.Detail("- Devices: %s", configs.Devices)
log.Detail("- IsAsync: %s", configs.IsAsync)
log.Detail("- Series: %s", configs.Series)
log.Detail("- Parallelization: %s", configs.Parallelization)
log.Detail("- CustomOptions: %s", configs.CustomOptions)
log.Info("Other Configs:")
log.Detail("- DeployDir: %s", configs.DeployDir)
}
开发者ID:bitrise-steplib,项目名称:steps-xamarin-test-cloud-for-ios,代码行数:21,代码来源:main.go
示例13: print
func (configs ConfigsModel) print() {
fmt.Println()
log.Info("Project Parameters:")
log.Detail("- ProjectPath: %s", configs.ProjectPath)
log.Detail("- Scheme: %s", configs.Scheme)
fmt.Println()
log.Info("Simulator Configs:")
log.Detail("- SimulatorPlatform: %s", configs.SimulatorPlatform)
log.Detail("- SimulatorDevice: %s", configs.SimulatorDevice)
log.Detail("- SimulatorOsVersion: %s", configs.SimulatorOsVersion)
fmt.Println()
log.Info("Test Run Configs:")
log.Detail("- OutputTool: %s", configs.OutputTool)
log.Detail("- IsCleanBuild: %s", configs.IsCleanBuild)
log.Detail("- IsSingleBuild: %s", configs.IsSingleBuild)
log.Detail("- ShouldBuildBeforeTest: %s", configs.ShouldBuildBeforeTest)
log.Detail("- ShouldRetryTestOnFail: %s", configs.ShouldRetryTestOnFail)
log.Detail("- GenerateCodeCoverageFiles: %s", configs.GenerateCodeCoverageFiles)
log.Detail("- ExportUITestArtifacts: %s", configs.ExportUITestArtifacts)
log.Detail("- TestOptions: %s", configs.TestOptions)
log.Detail("- XcprettyTestOptions: %s", configs.XcprettyTestOptions)
log.Detail("- WaitForSimulatorBoot: %s", configs.WaitForSimulatorBoot)
}
开发者ID:bitrise-io,项目名称:steps-xcode-test,代码行数:28,代码来源:main.go
示例14: main
func main() {
configs := createConfigsModelFromEnvs()
fmt.Println()
configs.print()
if err := configs.validate(); err != nil {
fail("Issue with input: %s", err)
}
customOptions := []string{}
if configs.CarthageOptions != "" {
options, err := shellquote.Split(configs.CarthageOptions)
if err != nil {
fail("Failed to shell split CarthageOptions (%s), error: %s", configs.CarthageOptions)
}
customOptions = options
}
//
// Exit if bootstrap is cached
log.Info("Check if cache is available")
hasCachedItems, err := isCacheAvailable(configs.SourceDir)
if err != nil {
fail("Failed to check cached files, error: %s", err)
}
log.Detail("has cahched items: %v", hasCachedItems)
if configs.CarthageCommand == "bootstrap" && hasCachedItems {
log.Done("Using cached dependencies for bootstrap command. If you would like to force update your dependencies, select `update` as CarthageCommand and re-run your build.")
os.Exit(0)
}
fmt.Println()
// ---
//
// Run carthage command
log.Info("Running Carthage command")
args := append([]string{configs.CarthageCommand}, customOptions...)
cmd := cmdex.NewCommand("carthage", args...)
if configs.GithubAccessToken != "" {
log.Detail("Appending GITHUB_ACCESS_TOKEN to process environments")
cmd.AppendEnvs([]string{fmt.Sprintf("GITHUB_ACCESS_TOKEN=%s", configs.GithubAccessToken)})
}
cmd.SetStdout(os.Stdout)
cmd.SetStderr(os.Stderr)
log.Done("$ %s", cmdex.PrintableCommandArgs(false, cmd.GetCmd().Args))
fmt.Println()
if err := cmd.Run(); err != nil {
fail("Carthage command failed, error: %s", err)
}
// ---
//
// Create cache
if configs.CarthageCommand == "bootstrap" {
fmt.Println()
log.Info("Creating cache")
cacheFilePth := filepath.Join(configs.SourceDir, carthageDirName, cacheFileName)
swiftVersion, err := swiftVersion()
if err != nil {
fail("Failed to get swift version, error: %s", err)
}
resolvedFilePath := filepath.Join(configs.SourceDir, resolvedFileName)
resolved, err := contentsOfCartfileResolved(resolvedFilePath)
if err != nil {
fail("Failed to get resolved file content, error: %s", err)
}
cacheContent := fmt.Sprintf("--Swift version: %s --Swift version \n --%s: %s --%s", swiftVersion, resolvedFileName, resolved, resolvedFileName)
carthageDir := filepath.Join(configs.SourceDir, carthageDirName)
if exist, err := pathutil.IsPathExists(carthageDir); err != nil {
fail("Failed to check if dir exists at (%s), error: %s", carthageDir, err)
} else if !exist {
if err := os.Mkdir(carthageDir, 0777); err != nil {
fail("Failed to create dir (%s), error: %s", carthageDir, err)
}
}
if err := fileutil.WriteStringToFile(cacheFilePth, cacheContent); err != nil {
fail("Failed to write cahe file, error: %s", err)
}
log.Done("Cachefile: %s", cacheFilePth)
}
// ---
}
开发者ID:bitrise-steplib,项目名称:steps-carthage,代码行数:100,代码来源:main.go
示例15: main
func main() {
configs := createConfigsModelFromEnvs()
fmt.Println()
configs.print()
if err := configs.validate(); err != nil {
registerFail("Issue with input: %s", err)
}
//
// Determining calabash-android version
fmt.Println()
log.Info("Determining calabash-android version...")
rubyCommand, err := rubycmd.NewRubyCommandModel()
if err != nil {
registerFail("Failed to create ruby command, err: %s", err)
}
calabashAndroidVersion := ""
useBundler := false
if configs.GemFilePath != "" {
if exist, err := pathutil.IsPathExists(configs.GemFilePath); err != nil {
registerFail("Failed to check if Gemfile exists at (%s) exist, error: %s", configs.GemFilePath, err)
} else if exist {
log.Detail("Gemfile exists at: %s", configs.GemFilePath)
gemfileDir := filepath.Dir(configs.GemFilePath)
gemfileLockPth := filepath.Join(gemfileDir, "Gemfile.lock")
if exist, err := pathutil.IsPathExists(gemfileLockPth); err != nil {
registerFail("Failed to check if Gemfile.lock exists at (%s), error: %s", gemfileLockPth, err)
} else if exist {
log.Detail("Gemfile.lock exists at: %s", gemfileLockPth)
version, err := calabashAndroidVersionFromGemfileLock(gemfileLockPth)
if err != nil {
registerFail("Failed to get calabash-android version from Gemfile.lock, error: %s", err)
}
log.Detail("calabash-android version in Gemfile.lock: %s", version)
calabashAndroidVersion = version
useBundler = true
} else {
log.Warn("Gemfile.lock doest no find with calabash-android gem at: %s", gemfileLockPth)
}
} else {
log.Warn("Gemfile doest no find with calabash-android gem at: %s", configs.GemFilePath)
}
}
if configs.CalabashAndroidVersion != "" {
log.Detail("calabash-android version in configs: %s", configs.CalabashAndroidVersion)
calabashAndroidVersion = configs.CalabashAndroidVersion
useBundler = false
}
if calabashAndroidVersion == "" {
log.Done("using calabash-android latest version")
} else {
log.Done("using calabash-android version: %s", calabashAndroidVersion)
}
// ---
//
// Intsalling calabash-android gem
fmt.Println()
log.Info("Installing calabash-android gem...")
calabashAndroidArgs := []string{}
// If Gemfile given with calabash-android and calabash_android_version input does not override calabash-android version
// Run `bundle install`
// Run calabash-android with `bundle exec`
if useBundler {
bundleInstallArgs := []string{"bundle", "install", "--jobs", "20", "--retry", "5"}
// bundle install
bundleInstallCmd, err := rubyCommand.Command(false, bundleInstallArgs)
if err != nil {
registerFail("Failed to create command, error: %s", err)
}
bundleInstallCmd.AppendEnvs([]string{"BUNDLE_GEMFILE=" + configs.GemFilePath})
log.Detail("$ %s", cmdex.PrintableCommandArgs(false, bundleInstallArgs))
if err := bundleInstallCmd.Run(); err != nil {
registerFail("bundle install failed, error: %s", err)
}
// ---
calabashAndroidArgs = []string{"bundle", "exec"}
}
calabashAndroidArgs = append(calabashAndroidArgs, "calabash-android")
//.........这里部分代码省略.........
开发者ID:bitrise-steplib,项目名称:steps-calabash-android-uitest,代码行数:101,代码来源:main.go
示例16: main
func main() {
configs := createConfigsModelFromEnvs()
configs.print()
if err := configs.validate(); err != nil {
log.Error("Issue with input: %s", err)
os.Exit(1)
}
fmt.Println()
// Validate Certificates
certificateURLPassphraseMap := map[string]string{}
if configs.CertificateURL != "" {
certificateURLs := strings.Split(configs.CertificateURL, "|")
certificatePassphrases := strings.Split(configs.CertificatePassphrase, "|")
if len(certificateURLs) != len(certificatePassphrases) {
log.Error("Certificate url count: (%d), not equals to Certificate Passphrase count: (%d)", len(certificateURLs), len(certificatePassphrases))
os.Exit(1)
}
for i := 0; i < len(certificateURLs); i++ {
certificateURL := certificateURLs[i]
certificatePassphrase := certificatePassphrases[i]
certificateURLPassphraseMap[certificateURL] = certificatePassphrase
}
}
if configs.DefaultCertificateURL != "" {
log.Detail("Default Certificate given")
certificateURLPassphraseMap[configs.DefaultCertificateURL] = configs.DefaultCertificatePassphrase
}
certificateCount := len(certificateURLPassphraseMap)
log.Detail("Provided Certificate count: %d", certificateCount)
if certificateCount == 0 {
log.Error("No Certificate provided")
os.Exit(1)
}
// Validate Provisioning Profiles
provisioningProfileURLs := strings.Split(configs.ProvisioningProfileURL, "|")
if configs.DefaultProvisioningProfileURL != "" {
log.Detail("Default Provisioning Profile given")
provisioningProfileURLs = append(provisioningProfileURLs, configs.DefaultProvisioningProfileURL)
}
profileCount := len(provisioningProfileURLs)
log.Detail("Provided Provisioning Profile count: %d", profileCount)
if profileCount == 0 {
log.Error("No Provisioning Profile provided")
os.Exit(1)
}
//
// Init
homeDir := os.Getenv("HOME")
provisioningProfileDir := path.Join(homeDir, "Library/MobileDevice/Provisioning Profiles")
if exist, err := pathutil.IsPathExists(provisioningProfileDir); err != nil {
log.Error("Failed to check path (%s), err: %s", provisioningProfileDir, err)
os.Exit(1)
} else if !exist {
if err := os.MkdirAll(provisioningProfileDir, 0777); err != nil {
log.Error("Failed to create path (%s), err: %s", provisioningProfileDir, err)
os.Exit(1)
}
}
tempDir, err := pathutil.NormalizedOSTempDirPath("bitrise-cert-tmp")
if err != nil {
log.Error("Failed to create tmp directory, err: %s", err)
os.Exit(1)
}
if exist, err := pathutil.IsPathExists(configs.KeychainPath); err != nil {
log.Error("Failed to check path (%s), err: %s", configs.KeychainPath, err)
os.Exit(1)
} else if !exist {
fmt.Println()
log.Warn("Keychain (%s) does not exist", configs.KeychainPath)
keychainPth := fmt.Sprintf("%s-db", configs.KeychainPath)
log.Detail(" Checking (%s)", keychainPth)
if exist, err := pathutil.IsPathExists(keychainPth); err != nil {
log.Error("Failed to check path (%s), err: %s", keychainPth, err)
os.Exit(1)
} else if !exist {
log.Info("Creating keychain: %s", configs.KeychainPath)
if out, err := runCommandAndReturnCombinedStdoutAndStderr("security", "-v", "create-keychain", "-p", configs.KeychainPassword, configs.KeychainPath); err != nil {
log.Error("Failed to create keychain, output: %s", out)
log.Error("Failed to create keychain, err: %s", err)
os.Exit(1)
}
//.........这里部分代码省略.........
开发者ID:bitrise-io,项目名称:steps-certificate-and-profile-installer,代码行数:101,代码来源:main.go
示例17: downloadFile
func downloadFile(destionationPath, URL string) error {
url, err := url.Parse(URL)
if err != nil {
return err
}
scheme := url.Scheme
tmpDstFilePath := ""
if scheme != "file" {
log.Detail(" Downloading (%s) to (%s)", secureInput(URL), destionationPath)
tmpDir, err := pathutil.NormalizedOSTempDirPath("download")
if err != nil {
return err
}
tmpDst := path.Join(tmpDir, "tmp_file")
tmpDstFile, err := os.Create(tmpDst)
if err != nil {
return err
}
defer func() {
if err := tmpDstFile.Close(); err != nil {
log.Error("Failed to close file (%s), error: %s", tmpDst, err)
}
}()
success := false
var response *http.Response
for i := 0; i < 3 && !success; i++ {
if i > 0 {
fmt.Println("-> Retrying...")
time.Sleep(3 * time.Second)
}
response, err = http.Get(URL)
if err != nil {
log.Error(err.Error())
} else {
success = true
}
if response != nil {
defer func() {
if err := response.Body.Close(); err != nil {
log.Error("Failed to close response body, error: %s", err)
}
}()
}
}
if !success {
return err
}
_, err = io.Copy(tmpDstFile, response.Body)
if err != nil {
return err
}
tmpDstFilePath = tmpDstFile.Name()
} else {
log.Detail(" Moving (%s) to (%s)", secureInput(URL), destionationPath)
tmpDstFilePath = strings.Replace(URL, scheme+"://", "", -1)
}
if out, err := runCommandAndReturnCombinedStdoutAndStderr("cp", tmpDstFilePath, destionationPath); err != nil {
log.Detail("Move out: %s", out)
return err
}
return nil
}
开发者ID:bitrise-io,项目名称:steps-certificate-and-profile-installer,代码行数:73,代码来源:main.go
示例18: runTest
func runTest(buildTestParams models.XcodeBuildTestParamsModel, outputTool, xcprettyOptions string, isAutomaticRetryOnReason, isRetryOnFail bool) (string, int, error) {
handleTestError := func(fullOutputStr string, exitCode int, testError error) (string, int, error) {
//
// Automatic retry
for _, retryReasonPattern := range automaticRetryReasonPatterns {
if isStringFoundInOutput(retryReasonPattern, fullOutputStr) {
log.Warn("Automatic retry reason found in log: %s", retryReasonPattern)
if isAutomaticRetryOnReason {
log.Detail("isAutomaticRetryOnReason=true - retrying...")
return runTest(buildTestParams, outputTool, xcprettyOptions, false, false)
}
log.Error("isAutomaticRetryOnReason=false, no more retry, stopping the test!")
return fullOutputStr, exitCode, testError
}
}
//
// Retry on fail
if isRetryOnFail {
log.Warn("Test run failed")
log.Detail("isRetryOnFail=true - retrying...")
return runTest(buildTestParams, outputTool, xcprettyOptions, false, false)
}
return fullOutputStr, exitCode, testError
}
buildParams := buildTestParams.BuildParams
xcodebuildArgs := []string{buildParams.Action, buildParams.ProjectPath, "-scheme", buildParams.Scheme}
if buildTestParams.CleanBuild {
xcodebuildArgs = append(xcodebuildArgs, "clean")
}
// the 'build' argument is required *before* the 'test' arg, to prevent
// the Xcode bug described in the README, which causes:
// 'iPhoneSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.'
// in case the compilation takes a long time.
// Related Radar link: https://openradar.appspot.com/22413115
// Demonstration project: https://github.com/bitrise-io/simulator-launch-timeout-includes-build-time
// for builds < 120 seconds or fixed Xcode versions, one should
// have the possibility of opting out, because the explicit build arg
// leads the project to be compiled twice and increase the duration
// Related issue link: https://github.com/bitrise-io/steps-xcode-test/issues/55
if buildTestParams.BuildBeforeTest {
xcodebuildArgs = append(xcodebuildArgs, "build")
}
xcodebuildArgs = append(xcodebuildArgs, "test", "-destination", buildParams.DeviceDestination)
if buildTestParams.GenerateCodeCoverage {
xcodebuildArgs = append(xcodebuildArgs, "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES")
xcodebuildArgs = append(xcodebuildArgs, "GCC_GENERATE_TEST_COVERAGE_FILES=YES")
}
if buildTestParams.AdditionalOptions != "" {
options, err := shellquote.Split(buildTestParams.AdditionalOptions)
if err != nil {
return "", 1, fmt.Errorf("failed to parse additional options (%s), error: %s", buildTestParams.AdditionalOptions, err)
}
xcodebuildArgs = append(xcodebuildArgs, options...)
}
xcprettyArgs := []string{}
if xcprettyOptions != "" {
options, err := shellquote.Split(xcprettyOptions)
if err != nil {
return "", 1, fmt.Errorf("failed to parse additional options (%s), error: %s", xcprettyOptions, err)
}
// get and delete the xcpretty output file, if exists
xcprettyOutputFilePath := ""
isNextOptOutputPth := false
for _, aOpt := range options {
if isNextOptOutputPth {
xcprettyOutputFilePath = aOpt
break
}
if aOpt == "--output" {
isNextOptOutputPth = true
continue
}
}
if xcprettyOutputFilePath != "" {
if isExist, err := pathutil.IsPathExists(xcprettyOutputFilePath); err != nil {
log.Error("Failed to check xcpretty output file status (path: %s), error: %s", xcprettyOutputFilePath, err)
} else if isExist {
log.Warn("=> Deleting existing xcpretty output: %s", xcprettyOutputFilePath)
if err := os.Remove(xcprettyOutputFilePath); err != nil {
log.Error("Failed to delete xcpretty output file (path: %s), error: %s", xcprettyOutputFilePath, err)
}
}
}
//
xcprettyArgs = append(xcprettyArgs, options...)
}
log.Info("Running the tests...")
var rawOutput string
var err error
var exit int
//.........这里部分代码省略.........
开发者ID:bitrise-io,项目名称:steps-xcode-test,代码行数:101,代码来源:main.go
示例19: print
func (configs ConfigsModel) print() {
log.Info("ipa export configs:")
useCustomExportOptions := (configs.CustomExportOptionsPlistContent != "")
if useCustomExportOptions {
fmt.Println()
log.Warn("Ignoring the following options because CustomExportOptionsPlistContent provided:")
}
log.Detail("- ExportMethod: %s", configs.ExportMethod)
log.Detail("- UploadBitcode: %s", configs.UploadBitcode)
log.Detail("- CompileBitcode: %s", configs.CompileBitcode)
log.Detail("- TeamID: %s", configs.TeamID)
if useCustomExportOptions {
log.Warn("----------")
}
log.Detail("- UseDeprecatedExport: %s", configs.UseDeprecatedExport)
log.Detail("- ForceTeamID: %s", configs.ForceTeamID)
log.Detail("- ForceProvisioningProfileSpecifier: %s", configs.ForceProvisioningProfileSpecifier)
log.Detail("- ForceProvisioningProfile: %s", configs.ForceProvisioningProfile)
log.Detail("- ForceCodeSignIdentity: %s", configs.ForceCodeSignIdentity)
log.Detail("- CustomExportOptionsPlistContent:")
if configs.CustomExportOptionsPlistContent != "" {
log.Detail(configs.CustomExportOptionsPlistContent)
}
fmt.Println()
log.Info("xcodebuild configs:")
log.Detail("- OutputTool: %s", configs.OutputTool)
log.Detail("- Workdir: %s", configs.Workdir)
log.Detail("- ProjectPath: %s", configs.ProjectPath)
log.Detail("- Scheme: %s", configs.Scheme)
log.Detail("- Configuration: %s", configs.Configuration)
log.Detail("- OutputDir: %s", configs.OutputDir)
log.Detail("- IsCleanBuild: %s", configs.IsCleanBuild)
log.Detail("- XcodebuildOptions: %s", configs.XcodebuildOptions)
fmt.Println()
log.Info("step output configs:")
log.Detail("- IsExportXcarchiveZip: %s", configs.IsExportXcarchiveZip)
log.Detail("- ExportAllDsyms: %s", configs.ExportAllDsyms)
log.Detail("- ArtifactName: %s", configs.ArtifactName)
fmt.Println()
}
开发者ID:bitrise-io,项目名称:steps-xcode-archive,代码行数:46,代码来源:main.go
示例20: main
func main() {
configs := createConfigsModelFromEnvs()
configs.print()
if err := configs.validate(); err != nil {
log.Error("Issue with input: %s", err)
os.Exit(1)
}
fmt.Println()
log.Info("Other Configs:")
cleanBuild := (configs.IsCleanBuild == "yes")
generateCodeCoverage := (configs.GenerateCodeCoverageFiles == "yes")
exportUITestArtifacts := (configs.ExportUITestArtifacts == "true")
singleBuild := (configs.IsSingleBuild == "true")
buildBeforeTest := (configs.ShouldBuildBeforeTest == "yes")
retryOnFail := (configs.ShouldRetryTestOnFail == "yes")
// Project-or-Workspace flag
action := ""
if strings.HasSuffix(configs.ProjectPath, ".xcodeproj") {
action = "-project"
} else if strings.HasSuffix(configs.ProjectPath, ".xcworkspace") {
action = "-workspace"
} else {
log.Error("Iinvalid project file (%s), extension should be (.xcodeproj/.xcworkspace)", configs.ProjectPath)
if err := cmd.ExportEnvironmentWithEnvman("BITRISE_XCODE_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export: BITRISE_XCODE_TEST_RESULT, error: %s", err)
}
os.Exit(1)
}
log.Detail("* action: %s", action)
// Device Destination
deviceDestination := fmt.Sprintf("platform=%s,name=%s,OS=%s", configs.SimulatorPlatform, configs.SimulatorDevice, configs.SimulatorOsVersion)
log.Detail("* device_destination: %s", deviceDestination)
// Output tools versions
xcodebuildVersion, err := xcodeutil.GetXcodeVersion()
if err != nil {
log.Error("Failed to get the version of xcodebuild! Error: %s", err)
if err := cmd.ExportEnvironmentWithEnvman("BITRISE_XCODE_TEST_RESULT", "failed"); err != nil {
log.Warn("Failed to export: BITRISE_XCODE_TEST_RESULT, error: %s", err)
}
os.Exit(1)
}
log.Detail("* xcodebuild_version: %s (%s)", xcodebuildVersion.Version, xcodebuildVersion.BuildVersion)
xcprettyVersion, err := cmd.GetXcprettyVersion()
if err != nil {
log.Warn("
|
请发表评论