From 7667ee63638b70970f536c19912a6f9f04e5b188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Thu, 2 Jun 2016 15:20:25 +0200 Subject: [PATCH 1/2] builder update - step version updates --- deplock.json | 2 +- .../bitrise-core/bitrise-init/.gitignore | 3 +- .../bitrise-core/bitrise-init/CHANGELOG.md | 18 ++ .../bitrise-core/bitrise-init/README.md | 4 +- .../bitrise-init/_scripts/get_version.go | 42 +++ .../bitrise-init/_scripts/set_version.sh | 20 ++ .../bitrise-core/bitrise-init/bitrise.yml | 280 +++++++++++++++++- .../bitrise-core/bitrise-init/cli/cli.go | 16 + .../bitrise-init/cli/init_config.go | 16 +- .../bitrise-init/cli/init_manual_config.go | 16 +- .../bitrise-core/bitrise-init/cli/version.go | 55 ++++ .../bitrise-init/release_config.yml | 13 + .../scanners/{ => android}/android.go | 121 +++----- .../scanners/{ => android}/android_test.go | 6 +- .../scanners/{ => fastlane}/fastlane.go | 114 +++---- .../scanners/{ => fastlane}/fastlane_test.go | 4 +- .../bitrise-init/scanners/{ => ios}/ios.go | 165 ++++------- .../scanners/{ => ios}/ios_test.go | 10 +- .../scanners/{scanner.go => scanners.go} | 24 +- .../scanners/{ => xamarin}/xamarin.go | 176 ++++------- .../scanners/{ => xamarin}/xamarin_test.go | 10 +- .../bitrise-core/bitrise-init/steps/steps.go | 176 +++++++++++ .../bitrise-init/version/build.go | 7 + .../bitrise-init/version/version.go | 2 +- 24 files changed, 880 insertions(+), 420 deletions(-) create mode 100644 go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md create mode 100644 go/src/github.com/bitrise-core/bitrise-init/_scripts/get_version.go create mode 100644 go/src/github.com/bitrise-core/bitrise-init/_scripts/set_version.sh create mode 100644 go/src/github.com/bitrise-core/bitrise-init/cli/version.go create mode 100644 go/src/github.com/bitrise-core/bitrise-init/release_config.yml rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => android}/android.go (70%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => android}/android_test.go (93%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => fastlane}/fastlane.go (65%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => fastlane}/fastlane_test.go (92%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => ios}/ios.go (66%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => ios}/ios_test.go (89%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{scanner.go => scanners.go} (50%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => xamarin}/xamarin.go (72%) rename go/src/github.com/bitrise-core/bitrise-init/scanners/{ => xamarin}/xamarin_test.go (73%) create mode 100644 go/src/github.com/bitrise-core/bitrise-init/steps/steps.go create mode 100644 go/src/github.com/bitrise-core/bitrise-init/version/build.go diff --git a/deplock.json b/deplock.json index 06a67c15..e535ba5e 100644 --- a/deplock.json +++ b/deplock.json @@ -2,7 +2,7 @@ "dep_locks": [ { "url": "https://github.com/bitrise-core/bitrise-init.git", - "revision": "49162a7023d6c4af00defb7526d1f7fcf8dc0ac6" + "revision": "b77126bee0e9ff8a1a795eda8427bfc7bc534be1" } ] } \ No newline at end of file diff --git a/go/src/github.com/bitrise-core/bitrise-init/.gitignore b/go/src/github.com/bitrise-core/bitrise-init/.gitignore index 1de45b17..6eb28f97 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/.gitignore +++ b/go/src/github.com/bitrise-core/bitrise-init/.gitignore @@ -1,6 +1,5 @@ _scan_result/ _defaults/ _tmp/ +_bin/ .bitrise* - - diff --git a/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md b/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md new file mode 100644 index 00000000..32b9bd33 --- /dev/null +++ b/go/src/github.com/bitrise-core/bitrise-init/CHANGELOG.md @@ -0,0 +1,18 @@ +## Changelog (Current version: 0.9.1) + +----------------- + +### 0.9.1 (2016 Jun 02) + +* [0aff8d3] release workflow fix +* [48ae75c] Merge pull request #10 from bitrise-core/scanner_packages +* [1cb400b] missing errcheck fix +* [66a1ae8] ci workflow update, release workflows +* [eb604ed] version command, tool versioning +* [3fd1723] code style +* [27859d2] steps package, refactors +* [67dfb3b] scanners moved to separated packages + +----------------- + +Updated: 2016 Jun 02 \ No newline at end of file diff --git a/go/src/github.com/bitrise-core/bitrise-init/README.md b/go/src/github.com/bitrise-core/bitrise-init/README.md index 99545c7b..bb6a9ea8 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/README.md +++ b/go/src/github.com/bitrise-core/bitrise-init/README.md @@ -1,3 +1,3 @@ -# Bitrise CLI Plugin - Init +# Bitrise Init Tool -### Initialize bitrise config, step template or plugin template +Initialize bitrise config, step template or plugin template diff --git a/go/src/github.com/bitrise-core/bitrise-init/_scripts/get_version.go b/go/src/github.com/bitrise-core/bitrise-init/_scripts/get_version.go new file mode 100644 index 00000000..7f3b0a09 --- /dev/null +++ b/go/src/github.com/bitrise-core/bitrise-init/_scripts/get_version.go @@ -0,0 +1,42 @@ +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "log" + "regexp" +) + +func main() { + // Inputs + var ( + versionFilePathParam = flag.String("file", "", `Version file path`) + ) + + flag.Parse() + + if versionFilePathParam == nil || *versionFilePathParam == "" { + log.Fatalf(" [!] No version file parameter specified") + } + versionFilePath := *versionFilePathParam + + // Main + versionFileBytes, err := ioutil.ReadFile(versionFilePath) + if err != nil { + log.Fatalf("Failed to read version file: %s", err) + } + versionFileContent := string(versionFileBytes) + + re := regexp.MustCompile(`const VERSION = "(?P[0-9]+\.[0-9-]+\.[0-9-]+)"`) + results := re.FindAllStringSubmatch(versionFileContent, -1) + versionStr := "" + for _, v := range results { + versionStr = v[1] + } + if versionStr == "" { + log.Fatalf("Failed to determine version") + } + + fmt.Println(versionStr) +} diff --git a/go/src/github.com/bitrise-core/bitrise-init/_scripts/set_version.sh b/go/src/github.com/bitrise-core/bitrise-init/_scripts/set_version.sh new file mode 100644 index 00000000..901c1438 --- /dev/null +++ b/go/src/github.com/bitrise-core/bitrise-init/_scripts/set_version.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -x + +version_file_path="$1" +if [ ! -f "$version_file_path" ] ; then + echo " [!] version_file_path not provided, or file doesn't exist at path: $version_file_path" + exit 1 +fi +versionNumber=$next_version +if [[ "$versionNumber" == "" ]] ; then + echo " [!] versionNumber not provided" + exit 1 +fi + +cat >"${version_file_path}" < 0 { rootGradlewPath = gradlewFiles[0] - detector.HasGradlewFile = true + scanner.HasGradlewFile = true logger.InfofDetails("root gradlew path: %s", rootGradlewPath) } gradleBin := "gradle" - if detector.HasGradlewFile { + if scanner.HasGradlewFile { logger.InfofDetails("adding executable permission to gradlew file") err := os.Chmod(rootGradlewPath, 0770) @@ -212,7 +209,7 @@ func (detector *Android) Options() (models.OptionModel, error) { // Inspect Gradle files gradleFileOption := models.NewOptionModel(gradleFileTitle, gradleFileEnvKey) - for _, gradleFile := range detector.GradleFiles { + for _, gradleFile := range scanner.GradleFiles { logger.InfofSection("Inspecting gradle file: %s", gradleFile) logger.InfofDetails("$ %s tasks --build-file %s", gradleBin, gradleFile) @@ -227,9 +224,9 @@ func (detector *Android) Options() (models.OptionModel, error) { for _, config := range configs { configOption := models.NewEmptyOptionModel() - configOption.Config = androidConfigName(detector.HasGradlewFile) + configOption.Config = configName(scanner.HasGradlewFile) - if detector.HasGradlewFile { + if scanner.HasGradlewFile { gradlewPathOption := models.NewOptionModel(gradlewPathTitle, gradlewPathEnvKey) gradlewPathOption.ValueMap[rootGradlewPath] = configOption @@ -246,14 +243,12 @@ func (detector *Android) Options() (models.OptionModel, error) { } // DefaultOptions ... -func (detector *Android) DefaultOptions() models.OptionModel { - gradleFileOption := models.NewOptionModel(gradleFileTitle, gradleFileEnvKey) - - gradleTaskOption := models.NewOptionModel(gradleTaskTitle, gradleTaskEnvKey) - +func (scanner *Scanner) DefaultOptions() models.OptionModel { configOption := models.NewEmptyOptionModel() - configOption.Config = androidDefaultConfigName() + configOption.Config = defaultConfigName() + gradleFileOption := models.NewOptionModel(gradleFileTitle, gradleFileEnvKey) + gradleTaskOption := models.NewOptionModel(gradleTaskTitle, gradleTaskEnvKey) gradlewPathOption := models.NewOptionModel(gradlewPathTitle, gradlewPathEnvKey) gradlewPathOption.ValueMap["_"] = configOption @@ -264,20 +259,14 @@ func (detector *Android) DefaultOptions() models.OptionModel { } // Configs ... -func (detector *Android) Configs() (map[string]string, error) { - steps := []bitriseModels.StepListItemModel{} +func (scanner *Scanner) Configs() (map[string]string, error) { + stepList := []bitriseModels.StepListItemModel{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // GradleRunner inputs := []envmanModels.EnvironmentItemModel{ @@ -285,31 +274,24 @@ func (detector *Android) Configs() (map[string]string, error) { envmanModels.EnvironmentItemModel{gradleTaskKey: "$" + gradleTaskEnvKey}, } - if detector.HasGradlewFile { + if scanner.HasGradlewFile { inputs = append(inputs, envmanModels.EnvironmentItemModel{ gradlewPathKey: "$" + gradlewPathEnvKey, }) } - // GradleRunner - steps = append(steps, bitriseModels.StepListItemModel{ - stepGradleRunnerIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.GradleRunnerStepListItem(inputs)) // DeployToBitriseIo - steps = append(steps, bitriseModels.StepListItemModel{ - stepDeployToBitriseIoIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.DeployToBitriseIoStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := androidConfigName(detector.HasGradlewFile) + configName := configName(scanner.HasGradlewFile) bitriseDataMap := map[string]string{ configName: string(data), } @@ -318,20 +300,14 @@ func (detector *Android) Configs() (map[string]string, error) { } // DefaultConfigs ... -func (detector *Android) DefaultConfigs() (map[string]string, error) { - steps := []bitriseModels.StepListItemModel{} +func (scanner *Scanner) DefaultConfigs() (map[string]string, error) { + stepList := []bitriseModels.StepListItemModel{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // GradleRunner inputs := []envmanModels.EnvironmentItemModel{ @@ -343,25 +319,18 @@ func (detector *Android) DefaultConfigs() (map[string]string, error) { gradlewPathKey: "$" + gradlewPathEnvKey, }) - // GradleRunner - steps = append(steps, bitriseModels.StepListItemModel{ - stepGradleRunnerIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.GradleRunnerStepListItem(inputs)) // DeployToBitriseIo - steps = append(steps, bitriseModels.StepListItemModel{ - stepDeployToBitriseIoIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.DeployToBitriseIoStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := androidDefaultConfigName() + configName := defaultConfigName() bitriseDataMap := map[string]string{ configName: string(data), } diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/android_test.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/android/android_test.go similarity index 93% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/android_test.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/android/android_test.go index 9a1061fd..f4c321a1 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/android_test.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/android/android_test.go @@ -1,4 +1,4 @@ -package scanners +package android import ( "testing" @@ -73,6 +73,6 @@ func TestFilterGradlewFiles(t *testing.T) { } func TestAndroidConfigName(t *testing.T) { - require.Equal(t, "android-config", androidConfigName(false)) - require.Equal(t, "android-gradlew-config", androidConfigName(true)) + require.Equal(t, "android-config", configName(false)) + require.Equal(t, "android-gradlew-config", configName(true)) } diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go similarity index 65% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go index db3cb01a..968eb9f4 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane.go @@ -1,4 +1,4 @@ -package scanners +package fastlane import ( "bytes" @@ -13,15 +13,14 @@ import ( "gopkg.in/yaml.v2" "github.com/bitrise-core/bitrise-init/models" + "github.com/bitrise-core/bitrise-init/steps" "github.com/bitrise-core/bitrise-init/utility" bitriseModels "github.com/bitrise-io/bitrise/models" envmanModels "github.com/bitrise-io/envman/models" - "github.com/bitrise-io/go-utils/pointers" - stepmanModels "github.com/bitrise-io/stepman/models" ) const ( - fastlaneDetectorName = "fastlane" + scannerName = "fastlane" ) const ( @@ -36,8 +35,10 @@ const ( workDirKey = "work_dir" workDirTitle = "Working directory" workDirEnvKey = "FASTLANE_WORK_DIR" +) - stepFastlaneIDComposite = "fastlane@2.2.0" +var ( + logger = utility.NewLogger() ) //-------------------------------------------------- @@ -101,47 +102,46 @@ func inspectFastFile(fastFile string) ([]string, error) { return lanes, nil } -func fastlaneConfigName() string { - name := "fastlane-" - return name + "config" +func configName() string { + return "fastlane-config" } -func fastlaneDefaultConfigName() string { +func defaultConfigName() string { return "default-fastlane-config" } //-------------------------------------------------- -// Detector +// Scanner //-------------------------------------------------- -// Fastlane ... -type Fastlane struct { +// Scanner ... +type Scanner struct { SearchDir string FastFiles []string } // Name ... -func (detector Fastlane) Name() string { - return fastlaneDetectorName +func (scanner Scanner) Name() string { + return scannerName } // Configure ... -func (detector *Fastlane) Configure(searchDir string) { - detector.SearchDir = searchDir +func (scanner *Scanner) Configure(searchDir string) { + scanner.SearchDir = searchDir } // DetectPlatform ... -func (detector *Fastlane) DetectPlatform() (bool, error) { - fileList, err := utility.FileList(detector.SearchDir) +func (scanner *Scanner) DetectPlatform() (bool, error) { + fileList, err := utility.FileList(scanner.SearchDir) if err != nil { - return false, fmt.Errorf("failed to search for files in (%s), error: %s", detector.SearchDir, err) + return false, fmt.Errorf("failed to search for files in (%s), error: %s", scanner.SearchDir, err) } // Search for Fastfile logger.Info("Searching for Fastfiles") fastFiles := filterFastFiles(fileList) - detector.FastFiles = fastFiles + scanner.FastFiles = fastFiles logger.InfofDetails("%d Fastfile(s) detected", len(fastFiles)) @@ -156,11 +156,11 @@ func (detector *Fastlane) DetectPlatform() (bool, error) { } // Options ... -func (detector *Fastlane) Options() (models.OptionModel, error) { +func (scanner *Scanner) Options() (models.OptionModel, error) { workDirOption := models.NewOptionModel(workDirTitle, workDirEnvKey) // Inspect Fastfiles - for _, fastFile := range detector.FastFiles { + for _, fastFile := range scanner.FastFiles { logger.InfofSection("Inspecting Fastfile: %s", fastFile) logger.InfoDetails("$ fastlane lanes --json") @@ -182,7 +182,7 @@ func (detector *Fastlane) Options() (models.OptionModel, error) { logger.InfofReceipt("fastlane work dir: %s", workDir) configOption := models.NewEmptyOptionModel() - configOption.Config = fastlaneConfigName() + configOption.Config = configName() laneOption := models.NewOptionModel(laneTitle, laneEnvKey) for _, lane := range lanes { @@ -196,108 +196,82 @@ func (detector *Fastlane) Options() (models.OptionModel, error) { } // DefaultOptions ... -func (detector *Fastlane) DefaultOptions() models.OptionModel { - workDirOption := models.NewOptionModel(workDirTitle, workDirEnvKey) - +func (scanner *Scanner) DefaultOptions() models.OptionModel { configOption := models.NewEmptyOptionModel() - configOption.Config = fastlaneDefaultConfigName() + configOption.Config = defaultConfigName() + workDirOption := models.NewOptionModel(workDirTitle, workDirEnvKey) laneOption := models.NewOptionModel(laneTitle, laneEnvKey) laneOption.ValueMap["_"] = configOption - workDirOption.ValueMap["_"] = laneOption return workDirOption } // Configs ... -func (detector *Fastlane) Configs() (map[string]string, error) { - steps := []bitriseModels.StepListItemModel{} +func (scanner *Scanner) Configs() (map[string]string, error) { + stepList := []bitriseModels.StepListItemModel{} bitriseDataMap := map[string]string{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // CertificateAndProfileInstaller - steps = append(steps, bitriseModels.StepListItemModel{ - stepCertificateAndProfileInstallerIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.CertificateAndProfileInstallerStepListItem()) + // Fastlane inputs := []envmanModels.EnvironmentItemModel{ envmanModels.EnvironmentItemModel{laneKey: "$" + laneEnvKey}, envmanModels.EnvironmentItemModel{workDirKey: "$" + workDirEnvKey}, } - // Fastlane - steps = append(steps, bitriseModels.StepListItemModel{ - stepFastlaneIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.FastlaneStepListItem(inputs)) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := fastlaneConfigName() + configName := configName() bitriseDataMap[configName] = string(data) return bitriseDataMap, nil } // DefaultConfigs ... -func (detector *Fastlane) DefaultConfigs() (map[string]string, error) { - steps := []bitriseModels.StepListItemModel{} +func (scanner *Scanner) DefaultConfigs() (map[string]string, error) { + stepList := []bitriseModels.StepListItemModel{} bitriseDataMap := map[string]string{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // CertificateAndProfileInstaller - steps = append(steps, bitriseModels.StepListItemModel{ - stepCertificateAndProfileInstallerIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.CertificateAndProfileInstallerStepListItem()) + // Fastlane inputs := []envmanModels.EnvironmentItemModel{ envmanModels.EnvironmentItemModel{laneKey: "$" + laneEnvKey}, envmanModels.EnvironmentItemModel{workDirKey: "$" + workDirEnvKey}, } - // Fastlane - steps = append(steps, bitriseModels.StepListItemModel{ - stepFastlaneIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.FastlaneStepListItem(inputs)) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := fastlaneDefaultConfigName() + configName := defaultConfigName() bitriseDataMap[configName] = string(data) return bitriseDataMap, nil diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane_test.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane_test.go similarity index 92% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane_test.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane_test.go index bf9174d4..5951ab0b 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane_test.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/fastlane/fastlane_test.go @@ -1,4 +1,4 @@ -package scanners +package fastlane import ( "testing" @@ -38,5 +38,5 @@ func TestFilterFastFiles(t *testing.T) { } func TestFastlaneConfigName(t *testing.T) { - require.Equal(t, "fastlane-config", fastlaneConfigName()) + require.Equal(t, "fastlane-config", configName()) } diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/ios.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios.go similarity index 66% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/ios.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios.go index 85f213a5..60435b81 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/ios.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios.go @@ -1,4 +1,4 @@ -package scanners +package ios import ( "bufio" @@ -14,15 +14,14 @@ import ( log "github.com/Sirupsen/logrus" "github.com/bitrise-core/bitrise-init/models" + "github.com/bitrise-core/bitrise-init/steps" "github.com/bitrise-core/bitrise-init/utility" bitriseModels "github.com/bitrise-io/bitrise/models" envmanModels "github.com/bitrise-io/envman/models" - "github.com/bitrise-io/go-utils/pointers" - stepmanModels "github.com/bitrise-io/stepman/models" ) const ( - iosDetectorName = "ios" + scannerName = "ios" ) const ( @@ -40,10 +39,10 @@ const ( schemeKey = "scheme" schemeTitle = "Scheme name" schemeEnvKey = "BITRISE_SCHEME" +) - stepCocoapodsInstallIDComposite = "cocoapods-install@1.4.0" - stepXcodeArchiveIDComposite = "xcode-archive@1.7.3" - stepXcodeTestIDComposite = "xcode-test@1.13.7" +var ( + logger = utility.NewLogger() ) // SchemeModel ... @@ -157,7 +156,7 @@ func filterSharedSchemes(fileList []string, project string) ([]SchemeModel, erro return schemes, nil } -func iOSConfigName(hasPodfile, hasTest bool) string { +func configName(hasPodfile, hasTest bool) string { name := "ios-" if hasPodfile { name = name + "pod-" @@ -168,16 +167,16 @@ func iOSConfigName(hasPodfile, hasTest bool) string { return name + "config" } -func iOSDefaultConfigName() string { +func defaultConfigName() string { return "default-ios-config" } //-------------------------------------------------- -// Detector +// Scanner //-------------------------------------------------- -// Ios ... -type Ios struct { +// Scanner ... +type Scanner struct { SearchDir string FileList []string XcodeProjectFiles []string @@ -187,28 +186,28 @@ type Ios struct { } // Name ... -func (detector Ios) Name() string { - return iosDetectorName +func (scanner Scanner) Name() string { + return scannerName } // Configure ... -func (detector *Ios) Configure(searchDir string) { - detector.SearchDir = searchDir +func (scanner *Scanner) Configure(searchDir string) { + scanner.SearchDir = searchDir } // DetectPlatform ... -func (detector *Ios) DetectPlatform() (bool, error) { - fileList, err := utility.FileList(detector.SearchDir) +func (scanner *Scanner) DetectPlatform() (bool, error) { + fileList, err := utility.FileList(scanner.SearchDir) if err != nil { - return false, fmt.Errorf("failed to search for files in (%s), error: %s", detector.SearchDir, err) + return false, fmt.Errorf("failed to search for files in (%s), error: %s", scanner.SearchDir, err) } - detector.FileList = fileList + scanner.FileList = fileList // Search for xcodeproj/xcworkspace file logger.Info("Searching for xcodeproj/xcworkspace files") xcodeProjectFiles := filterXcodeprojectFiles(fileList) - detector.XcodeProjectFiles = xcodeProjectFiles + scanner.XcodeProjectFiles = xcodeProjectFiles logger.InfofDetails("%d xcodeproj/xcworkspace file(s) detected", len(xcodeProjectFiles)) @@ -224,12 +223,12 @@ func (detector *Ios) DetectPlatform() (bool, error) { } // Options ... -func (detector *Ios) Options() (models.OptionModel, error) { +func (scanner *Scanner) Options() (models.OptionModel, error) { // Check for Podfiles logger.InfoSection("Searching for Podfiles") - podFiles := filterPodFiles(detector.FileList) - detector.HasPodFile = (len(podFiles) > 0) + podFiles := filterPodFiles(scanner.FileList) + scanner.HasPodFile = (len(podFiles) > 0) logger.InfofDetails("%d Podfile(s) detected", len(podFiles)) @@ -241,7 +240,7 @@ func (detector *Ios) Options() (models.OptionModel, error) { return models.OptionModel{}, err } - podfileWorkspaceMap, err := utility.GetWorkspaces(detector.SearchDir) + podfileWorkspaceMap, err := utility.GetWorkspaces(scanner.SearchDir) if err != nil { return models.OptionModel{}, err } @@ -255,7 +254,7 @@ func (detector *Ios) Options() (models.OptionModel, error) { // Check if project is generated by Pod validProjects := []string{} - for _, project := range detector.XcodeProjectFiles { + for _, project := range scanner.XcodeProjectFiles { _, found := workspaceMap[project] if found { @@ -278,7 +277,7 @@ func (detector *Ios) Options() (models.OptionModel, error) { for _, project := range validProjects { logger.InfofSection("Inspecting project file: %s", project) - schemes, err := filterSharedSchemes(detector.FileList, project) + schemes, err := filterSharedSchemes(scanner.FileList, project) if err != nil { return models.OptionModel{}, err } @@ -294,11 +293,11 @@ func (detector *Ios) Options() (models.OptionModel, error) { for _, scheme := range schemes { hasTest := scheme.HasTest if hasTest { - detector.HasTest = true + scanner.HasTest = true } configOption := models.NewEmptyOptionModel() - configOption.Config = iOSConfigName(detector.HasPodFile, hasTest) + configOption.Config = configName(scanner.HasPodFile, hasTest) schemeOption.ValueMap[scheme.Name] = configOption } @@ -310,82 +309,60 @@ func (detector *Ios) Options() (models.OptionModel, error) { } // DefaultOptions ... -func (detector *Ios) DefaultOptions() models.OptionModel { - projectPathOption := models.NewOptionModel(projectPathTitle, projectPathEnvKey) +func (scanner *Scanner) DefaultOptions() models.OptionModel { + configOption := models.NewEmptyOptionModel() + configOption.Config = defaultConfigName() + projectPathOption := models.NewOptionModel(projectPathTitle, projectPathEnvKey) schemeOption := models.NewOptionModel(schemeTitle, schemeEnvKey) - configOption := models.NewEmptyOptionModel() - configOption.Config = iOSDefaultConfigName() - schemeOption.ValueMap["_"] = configOption - projectPathOption.ValueMap["_"] = schemeOption return projectPathOption } // Configs ... -func (detector *Ios) Configs() (map[string]string, error) { +func (scanner *Scanner) Configs() (map[string]string, error) { bitriseDataMap := map[string]string{} - steps := []bitriseModels.StepListItemModel{} + stepList := []bitriseModels.StepListItemModel{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // CertificateAndProfileInstaller - steps = append(steps, bitriseModels.StepListItemModel{ - stepCertificateAndProfileInstallerIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.CertificateAndProfileInstallerStepListItem()) // CocoapodsInstall - if detector.HasPodFile { - steps = append(steps, bitriseModels.StepListItemModel{ - stepCocoapodsInstallIDComposite: stepmanModels.StepModel{}, - }) + if scanner.HasPodFile { + stepList = append(stepList, steps.CocoapodsInstallStepListItem()) } - // XcodeTest - if detector.HasTest { + if scanner.HasTest { + // XcodeTest inputs := []envmanModels.EnvironmentItemModel{ envmanModels.EnvironmentItemModel{projectPathKey: "$" + projectPathEnvKey}, envmanModels.EnvironmentItemModel{schemeKey: "$" + schemeEnvKey}, } - stepsWithTest := append(steps, bitriseModels.StepListItemModel{ - stepXcodeTestIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepListWithTest := append(stepList, steps.XcodeTestStepListItem(inputs)) // XcodeArchive - stepsWithTest = append(stepsWithTest, bitriseModels.StepListItemModel{ - stepXcodeArchiveIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepListWithTest = append(stepListWithTest, steps.XcodeArchiveStepListItem(inputs)) // DeployToBitriseIo - stepsWithTest = append(stepsWithTest, bitriseModels.StepListItemModel{ - stepDeployToBitriseIoIDComposite: stepmanModels.StepModel{}, - }) + stepListWithTest = append(stepListWithTest, steps.DeployToBitriseIoStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepsWithTest) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepListWithTest) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := iOSConfigName(detector.HasPodFile, true) + configName := configName(scanner.HasPodFile, true) bitriseDataMap[configName] = string(data) } @@ -395,55 +372,39 @@ func (detector *Ios) Configs() (map[string]string, error) { envmanModels.EnvironmentItemModel{schemeKey: "$" + schemeEnvKey}, } - steps = append(steps, bitriseModels.StepListItemModel{ - stepXcodeArchiveIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.XcodeArchiveStepListItem(inputs)) // DeployToBitriseIo - steps = append(steps, bitriseModels.StepListItemModel{ - stepDeployToBitriseIoIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.DeployToBitriseIoStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := iOSConfigName(detector.HasPodFile, false) + configName := configName(scanner.HasPodFile, false) bitriseDataMap[configName] = string(data) return bitriseDataMap, nil } // DefaultConfigs ... -func (detector *Ios) DefaultConfigs() (map[string]string, error) { +func (scanner *Scanner) DefaultConfigs() (map[string]string, error) { bitriseDataMap := map[string]string{} - steps := []bitriseModels.StepListItemModel{} + stepList := []bitriseModels.StepListItemModel{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // CertificateAndProfileInstaller - steps = append(steps, bitriseModels.StepListItemModel{ - stepCertificateAndProfileInstallerIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.CertificateAndProfileInstallerStepListItem()) // CocoapodsInstall - steps = append(steps, bitriseModels.StepListItemModel{ - stepCocoapodsInstallIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.CocoapodsInstallStepListItem()) // XcodeArchive inputs := []envmanModels.EnvironmentItemModel{ @@ -451,24 +412,18 @@ func (detector *Ios) DefaultConfigs() (map[string]string, error) { envmanModels.EnvironmentItemModel{schemeKey: "$" + schemeEnvKey}, } - steps = append(steps, bitriseModels.StepListItemModel{ - stepXcodeArchiveIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.XcodeArchiveStepListItem(inputs)) // DeployToBitriseIo - steps = append(steps, bitriseModels.StepListItemModel{ - stepDeployToBitriseIoIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.DeployToBitriseIoStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := iOSDefaultConfigName() + configName := defaultConfigName() bitriseDataMap[configName] = string(data) return bitriseDataMap, nil diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/ios_test.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios_test.go similarity index 89% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/ios_test.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios_test.go index c6704d8a..c7a5473b 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/ios_test.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/ios/ios_test.go @@ -1,4 +1,4 @@ -package scanners +package ios import ( "testing" @@ -69,8 +69,8 @@ func TestFilterPodFiles(t *testing.T) { } func TestIOSConfigName(t *testing.T) { - require.Equal(t, "ios-config", iOSConfigName(false, false)) - require.Equal(t, "ios-pod-config", iOSConfigName(true, false)) - require.Equal(t, "ios-test-config", iOSConfigName(false, true)) - require.Equal(t, "ios-pod-test-config", iOSConfigName(true, true)) + require.Equal(t, "ios-config", configName(false, false)) + require.Equal(t, "ios-pod-config", configName(true, false)) + require.Equal(t, "ios-test-config", configName(false, true)) + require.Equal(t, "ios-pod-test-config", configName(true, true)) } diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/scanner.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/scanners.go similarity index 50% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/scanner.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/scanners.go index edb88ee0..922ab829 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/scanner.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/scanners.go @@ -2,19 +2,11 @@ package scanners import ( "github.com/bitrise-core/bitrise-init/models" + "github.com/bitrise-core/bitrise-init/steps" bitriseModels "github.com/bitrise-io/bitrise/models" - "github.com/bitrise-io/go-utils/pointers" - stepmanModels "github.com/bitrise-io/stepman/models" "gopkg.in/yaml.v2" ) -const ( - stepActivateSSHKeyIDComposite = "activate-ssh-key@3.1.0" - stepGitCloneIDComposite = "git-clone@3.2.0" - stepCertificateAndProfileInstallerIDComposite = "certificate-and-profile-installer@1.5.0" - stepDeployToBitriseIoIDComposite = "deploy-to-bitrise-io@1.2.3" -) - // ScannerInterface ... type ScannerInterface interface { Name() string @@ -36,21 +28,15 @@ func customConfigName() string { // CustomConfig ... func CustomConfig() (map[string]string, error) { bitriseDataMap := map[string]string{} - steps := []bitriseModels.StepListItemModel{} + stepList := []bitriseModels.StepListItemModel{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin.go similarity index 72% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin.go index 8af4ac98..14c2a81d 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin.go @@ -1,4 +1,4 @@ -package scanners +package xamarin import ( "errors" @@ -13,16 +13,15 @@ import ( log "github.com/Sirupsen/logrus" "github.com/bitrise-core/bitrise-init/models" + "github.com/bitrise-core/bitrise-init/steps" "github.com/bitrise-core/bitrise-init/utility" bitriseModels "github.com/bitrise-io/bitrise/models" envmanModels "github.com/bitrise-io/envman/models" "github.com/bitrise-io/go-utils/fileutil" - "github.com/bitrise-io/go-utils/pointers" - stepmanModels "github.com/bitrise-io/stepman/models" ) const ( - xamarinDetectorName = "xamarin" + scannerName = "xamarin" ) const ( @@ -60,8 +59,6 @@ const ( xamarinPlatformTitle = "Xamarin platform" xamarinPlatformEnvKey = "BITRISE_XAMARIN_PLATFORM" - stepXamarinBuilderIDComposite = "xamarin-builder@1.3.0" - xamarinIosLicenceKey = "xamarin_ios_license" xamarinIosLicenceTitle = "Xamarin.iOS License" xamarinIosLicenceEnvKey = "__XAMARIN_IOS_LICENSE_VALUE__" @@ -69,10 +66,10 @@ const ( xamarinAndroidLicenceKey = "xamarin_android_license" xamarinAndroidLicenceTitle = "Xamarin.Android License" xamarinAndroidLicenceEnvKey = "__XAMARIN_ANDROID_LICENSE_VALUE__" +) - stepXamarinUserManagementIDComposite = "xamarin-user-management@1.0.2" - stepNugetRestoreIDComposite = "nuget-restore@0.9.1" - stepXamarinComponentsRestoreIDComposite = "xamarin-components-restore@0.9.0" +var ( + logger = utility.NewLogger() ) //-------------------------------------------------- @@ -202,7 +199,7 @@ func getProjects(solutionFile string) ([]string, error) { return projects, nil } -func xamarinConfigName(hasNugetPackages, hasXamarinComponents bool) string { +func configName(hasNugetPackages, hasXamarinComponents bool) string { name := "xamarin-" if hasNugetPackages { name = name + "nuget-" @@ -213,16 +210,16 @@ func xamarinConfigName(hasNugetPackages, hasXamarinComponents bool) string { return name + "config" } -func xamarinDefaultConfigName() string { +func defaultConfigName() string { return "default-xamarin-config" } //-------------------------------------------------- -// Detector +// Scanner //-------------------------------------------------- -// Xamarin ... -type Xamarin struct { +// Scanner ... +type Scanner struct { SearchDir string FileList []string SolutionFiles []string @@ -232,28 +229,28 @@ type Xamarin struct { } // Name ... -func (detector Xamarin) Name() string { - return xamarinDetectorName +func (scanner Scanner) Name() string { + return scannerName } // Configure ... -func (detector *Xamarin) Configure(searchDir string) { - detector.SearchDir = searchDir +func (scanner *Scanner) Configure(searchDir string) { + scanner.SearchDir = searchDir } // DetectPlatform ... -func (detector *Xamarin) DetectPlatform() (bool, error) { - fileList, err := utility.FileList(detector.SearchDir) +func (scanner *Scanner) DetectPlatform() (bool, error) { + fileList, err := utility.FileList(scanner.SearchDir) if err != nil { - return false, fmt.Errorf("failed to search for files in (%s), error: %s", detector.SearchDir, err) + return false, fmt.Errorf("failed to search for files in (%s), error: %s", scanner.SearchDir, err) } - detector.FileList = fileList + scanner.FileList = fileList // Search for solution file logger.Info("Searching for solution files") solutionFiles := filterSolutionFiles(fileList) - detector.SolutionFiles = solutionFiles + scanner.SolutionFiles = solutionFiles logger.InfofDetails("%d solution file(s) detected", len(solutionFiles)) @@ -268,15 +265,15 @@ func (detector *Xamarin) DetectPlatform() (bool, error) { } // Options ... -func (detector *Xamarin) Options() (models.OptionModel, error) { +func (scanner *Scanner) Options() (models.OptionModel, error) { logger.InfoSection("Searching for Nuget packages & Xamarin Components") - for _, file := range detector.FileList { + for _, file := range scanner.FileList { // Search for nuget packages - if detector.HasNugetPackages == false { + if scanner.HasNugetPackages == false { baseName := filepath.Base(file) if baseName == "packages.config" { - detector.HasNugetPackages = true + scanner.HasNugetPackages = true } } @@ -284,25 +281,25 @@ func (detector *Xamarin) Options() (models.OptionModel, error) { // /Components/[COMPONENT_NAME]/ dir added // ItemGroup/XamarinComponentReference added to the project // packages.config added to the project's folder - if detector.HasXamarinComponents == false { + if scanner.HasXamarinComponents == false { componentsExp := regexp.MustCompile(".*Components/.+") if result := componentsExp.FindString(file); result != "" { - detector.HasXamarinComponents = true + scanner.HasXamarinComponents = true } } - if detector.HasNugetPackages && detector.HasXamarinComponents { + if scanner.HasNugetPackages && scanner.HasXamarinComponents { break } } - if detector.HasNugetPackages { + if scanner.HasNugetPackages { logger.InfofReceipt("Nuget packages found") } else { logger.InfofDetails("NO Nuget packages found") } - if detector.HasXamarinComponents { + if scanner.HasXamarinComponents { logger.InfofReceipt("Xamarin Components found") } else { logger.InfofDetails("NO Xamarin Components found") @@ -310,7 +307,7 @@ func (detector *Xamarin) Options() (models.OptionModel, error) { // Check for solution configs validSolutionMap := map[string]map[string][]string{} - for _, solutionFile := range detector.SolutionFiles { + for _, solutionFile := range scanner.SolutionFiles { logger.InfofSection("Inspecting solution file: %s", solutionFile) configs, err := getSolutionConfigs(solutionFile) @@ -372,7 +369,7 @@ func (detector *Xamarin) Options() (models.OptionModel, error) { xamarinPlatformOption := models.NewOptionModel(xamarinPlatformTitle, xamarinPlatformEnvKey) for _, platform := range platforms { configOption := models.NewEmptyOptionModel() - configOption.Config = xamarinConfigName(detector.HasNugetPackages, detector.HasXamarinComponents) + configOption.Config = configName(scanner.HasNugetPackages, scanner.HasXamarinComponents) xamarinPlatformOption.ValueMap[platform] = configOption } @@ -387,45 +384,33 @@ func (detector *Xamarin) Options() (models.OptionModel, error) { } // DefaultOptions ... -func (detector *Xamarin) DefaultOptions() models.OptionModel { - xamarinProjectOption := models.NewOptionModel(xamarinProjectTitle, xamarinProjectEnvKey) +func (scanner *Scanner) DefaultOptions() models.OptionModel { + configOption := models.NewEmptyOptionModel() + configOption.Config = defaultConfigName() + xamarinProjectOption := models.NewOptionModel(xamarinProjectTitle, xamarinProjectEnvKey) xamarinConfigurationOption := models.NewOptionModel(xamarinConfigurationTitle, xamarinConfigurationEnvKey) - xamarinPlatformOption := models.NewOptionModel(xamarinPlatformTitle, xamarinPlatformEnvKey) - configOption := models.NewEmptyOptionModel() - configOption.Config = xamarinDefaultConfigName() - xamarinPlatformOption.ValueMap["_"] = configOption - xamarinConfigurationOption.ValueMap["_"] = xamarinPlatformOption - xamarinProjectOption.ValueMap["_"] = xamarinConfigurationOption return xamarinProjectOption } // Configs ... -func (detector *Xamarin) Configs() (map[string]string, error) { - steps := []bitriseModels.StepListItemModel{} +func (scanner *Scanner) Configs() (map[string]string, error) { + stepList := []bitriseModels.StepListItemModel{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // CertificateAndProfileInstaller - steps = append(steps, bitriseModels.StepListItemModel{ - stepCertificateAndProfileInstallerIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.CertificateAndProfileInstallerStepListItem()) // XamarinUserManagement inputs := []envmanModels.EnvironmentItemModel{ @@ -433,25 +418,16 @@ func (detector *Xamarin) Configs() (map[string]string, error) { envmanModels.EnvironmentItemModel{xamarinAndroidLicenceKey: "$" + xamarinAndroidLicenceEnvKey}, } - steps = append(steps, bitriseModels.StepListItemModel{ - stepXamarinUserManagementIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - RunIf: pointers.NewStringPtr(".IsCI"), - }, - }) + stepList = append(stepList, steps.XamarinUserManagementStepListItem(inputs)) // NugetRestore - if detector.HasNugetPackages { - steps = append(steps, bitriseModels.StepListItemModel{ - stepNugetRestoreIDComposite: stepmanModels.StepModel{}, - }) + if scanner.HasNugetPackages { + stepList = append(stepList, steps.NugetRestoreStepListItem()) } // XamarinComponentsRestore - if detector.HasXamarinComponents { - steps = append(steps, bitriseModels.StepListItemModel{ - stepXamarinComponentsRestoreIDComposite: stepmanModels.StepModel{}, - }) + if scanner.HasXamarinComponents { + stepList = append(stepList, steps.XamarinComponentsRestoreStepListItem()) } // XamarinBuilder @@ -461,24 +437,18 @@ func (detector *Xamarin) Configs() (map[string]string, error) { envmanModels.EnvironmentItemModel{xamarinPlatformKey: "$" + xamarinPlatformEnvKey}, } - steps = append(steps, bitriseModels.StepListItemModel{ - stepXamarinBuilderIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.XamarinBuilderStepListItem(inputs)) // DeployToBitriseIo - steps = append(steps, bitriseModels.StepListItemModel{ - stepDeployToBitriseIoIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.DeployToBitriseIoStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := xamarinConfigName(detector.HasNugetPackages, detector.HasXamarinComponents) + configName := configName(scanner.HasNugetPackages, scanner.HasXamarinComponents) bitriseDataMap := map[string]string{ configName: string(data), } @@ -487,24 +457,17 @@ func (detector *Xamarin) Configs() (map[string]string, error) { } // DefaultConfigs ... -func (detector *Xamarin) DefaultConfigs() (map[string]string, error) { - steps := []bitriseModels.StepListItemModel{} +func (scanner *Scanner) DefaultConfigs() (map[string]string, error) { + stepList := []bitriseModels.StepListItemModel{} // ActivateSSHKey - steps = append(steps, bitriseModels.StepListItemModel{ - stepActivateSSHKeyIDComposite: stepmanModels.StepModel{ - RunIf: pointers.NewStringPtr(`{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}`), - }, - }) + stepList = append(stepList, steps.ActivateSSHKeyStepListItem()) + // GitClone - steps = append(steps, bitriseModels.StepListItemModel{ - stepGitCloneIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.GitCloneStepListItem()) // CertificateAndProfileInstaller - steps = append(steps, bitriseModels.StepListItemModel{ - stepCertificateAndProfileInstallerIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.CertificateAndProfileInstallerStepListItem()) // XamarinUserManagement inputs := []envmanModels.EnvironmentItemModel{ @@ -512,22 +475,13 @@ func (detector *Xamarin) DefaultConfigs() (map[string]string, error) { envmanModels.EnvironmentItemModel{xamarinAndroidLicenceKey: "$" + xamarinAndroidLicenceEnvKey}, } - steps = append(steps, bitriseModels.StepListItemModel{ - stepXamarinUserManagementIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - RunIf: pointers.NewStringPtr(".IsCI"), - }, - }) + stepList = append(stepList, steps.XamarinUserManagementStepListItem(inputs)) // NugetRestore - steps = append(steps, bitriseModels.StepListItemModel{ - stepNugetRestoreIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.NugetRestoreStepListItem()) // XamarinComponentsRestore - steps = append(steps, bitriseModels.StepListItemModel{ - stepXamarinComponentsRestoreIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.XamarinComponentsRestoreStepListItem()) // XamarinBuilder inputs = []envmanModels.EnvironmentItemModel{ @@ -536,24 +490,18 @@ func (detector *Xamarin) DefaultConfigs() (map[string]string, error) { envmanModels.EnvironmentItemModel{xamarinPlatformKey: "$" + xamarinPlatformEnvKey}, } - steps = append(steps, bitriseModels.StepListItemModel{ - stepXamarinBuilderIDComposite: stepmanModels.StepModel{ - Inputs: inputs, - }, - }) + stepList = append(stepList, steps.XamarinBuilderStepListItem(inputs)) // DeployToBitriseIo - steps = append(steps, bitriseModels.StepListItemModel{ - stepDeployToBitriseIoIDComposite: stepmanModels.StepModel{}, - }) + stepList = append(stepList, steps.DeployToBitriseIoStepListItem()) - bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(steps) + bitriseData := models.BitriseDataWithPrimaryWorkflowSteps(stepList) data, err := yaml.Marshal(bitriseData) if err != nil { return map[string]string{}, err } - configName := xamarinDefaultConfigName() + configName := defaultConfigName() bitriseDataMap := map[string]string{ configName: string(data), } diff --git a/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin_test.go b/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin_test.go similarity index 73% rename from go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin_test.go rename to go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin_test.go index f1742a05..9f28d404 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin_test.go +++ b/go/src/github.com/bitrise-core/bitrise-init/scanners/xamarin/xamarin_test.go @@ -1,4 +1,4 @@ -package scanners +package xamarin import ( "testing" @@ -36,8 +36,8 @@ func TestFilterSolutionFiles(t *testing.T) { } func TestXamarinConfigName(t *testing.T) { - require.Equal(t, "xamarin-config", xamarinConfigName(false, false)) - require.Equal(t, "xamarin-nuget-config", xamarinConfigName(true, false)) - require.Equal(t, "xamarin-components-config", xamarinConfigName(false, true)) - require.Equal(t, "xamarin-nuget-components-config", xamarinConfigName(true, true)) + require.Equal(t, "xamarin-config", configName(false, false)) + require.Equal(t, "xamarin-nuget-config", configName(true, false)) + require.Equal(t, "xamarin-components-config", configName(false, true)) + require.Equal(t, "xamarin-nuget-components-config", configName(true, true)) } diff --git a/go/src/github.com/bitrise-core/bitrise-init/steps/steps.go b/go/src/github.com/bitrise-core/bitrise-init/steps/steps.go new file mode 100644 index 00000000..99a424a2 --- /dev/null +++ b/go/src/github.com/bitrise-core/bitrise-init/steps/steps.go @@ -0,0 +1,176 @@ +package steps + +import ( + bitrise "github.com/bitrise-io/bitrise/models" + envman "github.com/bitrise-io/envman/models" + "github.com/bitrise-io/go-utils/pointers" + stepman "github.com/bitrise-io/stepman/models" +) + +const ( + // Common Step IDs + activateSSHKeyID = "activate-ssh-key" + gitCloneID = "git-clone" + certificateAndProfileInstallerID = "certificate-and-profile-installer" + deployToBitriseIoID = "deploy-to-bitrise-io" + + // Android Step IDs + gradleRunnerID = "gradle-runner" + + // Fastlane Step IDs + fastlaneID = "fastlane" + + // iOS Step IDs + cocoapodsInstallID = "cocoapods-install" + xcodeArchiveID = "xcode-archive" + xcodeTestID = "xcode-test" + + // Xamarin Step IDs + xamarinUserManagementID = "xamarin-user-management" + nugetRestoreID = "nuget-restore" + xamarinComponentsRestoreID = "xamarin-components-restore" + xamarinBuilderID = "xamarin-builder" +) + +const ( + // Common Step Versions + activateSSHKeyVersion = "3.1.0" + gitCloneVersion = "3.2.0" + certificateAndProfileInstallerVersion = "1.5.0" + deployToBitriseIoVersion = "1.2.3" + + // Android Step Versions + gradleRunnerVersion = "1.3.1" + + // Fatslane Step Versions + fastlaneVersion = "2.2.0" + + // iOS Step Versions + cocoapodsInstallVersion = "1.4.0" + xcodeArchiveVersion = "1.7.3" + xcodeTestVersion = "1.13.7" + + // Xamarin Step Versions + xamarinUserManagementVersion = "1.0.2" + nugetRestoreVersion = "0.9.1" + xamarinComponentsRestoreVersion = "0.9.0" + xamarinBuilderVersion = "1.3.0" +) + +func setpIDComposite(ID, version string) string { + return ID + "@" + version +} + +func stepListItem(stepIDComposite, runIf string, inputs []envman.EnvironmentItemModel) bitrise.StepListItemModel { + step := stepman.StepModel{} + if runIf != "" { + step.RunIf = pointers.NewStringPtr(runIf) + } + if inputs != nil && len(inputs) > 0 { + step.Inputs = inputs + } + + return bitrise.StepListItemModel{ + stepIDComposite: step, + } +} + +//------------------------ +// Common Step List Items +//------------------------ + +// ActivateSSHKeyStepListItem ... +func ActivateSSHKeyStepListItem() bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(activateSSHKeyID, activateSSHKeyVersion) + runIf := `{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}` + return stepListItem(stepIDComposite, runIf, nil) +} + +// GitCloneStepListItem ... +func GitCloneStepListItem() bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(gitCloneID, gitCloneVersion) + return stepListItem(stepIDComposite, "", nil) +} + +// CertificateAndProfileInstallerStepListItem ... +func CertificateAndProfileInstallerStepListItem() bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(certificateAndProfileInstallerID, certificateAndProfileInstallerVersion) + return stepListItem(stepIDComposite, "", nil) +} + +// DeployToBitriseIoStepListItem ... +func DeployToBitriseIoStepListItem() bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(deployToBitriseIoID, deployToBitriseIoVersion) + return stepListItem(stepIDComposite, "", nil) +} + +//------------------------ +// Android Step List Items +//------------------------ + +// GradleRunnerStepListItem ... +func GradleRunnerStepListItem(inputs []envman.EnvironmentItemModel) bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(gradleRunnerID, gradleRunnerVersion) + return stepListItem(stepIDComposite, "", inputs) +} + +//------------------------ +// Fastlane Step List Items +//------------------------ + +// FastlaneStepListItem ... +func FastlaneStepListItem(inputs []envman.EnvironmentItemModel) bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(fastlaneID, fastlaneVersion) + return stepListItem(stepIDComposite, "", inputs) +} + +//------------------------ +// iOS Step List Items +//------------------------ + +// CocoapodsInstallStepListItem ... +func CocoapodsInstallStepListItem() bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(cocoapodsInstallID, cocoapodsInstallVersion) + return stepListItem(stepIDComposite, "", nil) +} + +// XcodeArchiveStepListItem ... +func XcodeArchiveStepListItem(inputs []envman.EnvironmentItemModel) bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(xcodeArchiveID, xcodeArchiveVersion) + return stepListItem(stepIDComposite, "", inputs) +} + +// XcodeTestStepListItem ... +func XcodeTestStepListItem(inputs []envman.EnvironmentItemModel) bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(xcodeTestID, xcodeTestVersion) + return stepListItem(stepIDComposite, "", inputs) +} + +//------------------------ +// Xamarin Step List Items +//------------------------ + +// XamarinUserManagementStepListItem ... +func XamarinUserManagementStepListItem(inputs []envman.EnvironmentItemModel) bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(xamarinUserManagementID, xamarinUserManagementVersion) + runIf := ".IsCI" + return stepListItem(stepIDComposite, runIf, inputs) +} + +// NugetRestoreStepListItem ... +func NugetRestoreStepListItem() bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(nugetRestoreID, nugetRestoreVersion) + return stepListItem(stepIDComposite, "", nil) +} + +// XamarinComponentsRestoreStepListItem ... +func XamarinComponentsRestoreStepListItem() bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(xamarinComponentsRestoreID, xamarinComponentsRestoreVersion) + return stepListItem(stepIDComposite, "", nil) +} + +// XamarinBuilderStepListItem ... +func XamarinBuilderStepListItem(inputs []envman.EnvironmentItemModel) bitrise.StepListItemModel { + stepIDComposite := setpIDComposite(xamarinBuilderID, xamarinBuilderVersion) + return stepListItem(stepIDComposite, "", inputs) +} diff --git a/go/src/github.com/bitrise-core/bitrise-init/version/build.go b/go/src/github.com/bitrise-core/bitrise-init/version/build.go new file mode 100644 index 00000000..06c70c10 --- /dev/null +++ b/go/src/github.com/bitrise-core/bitrise-init/version/build.go @@ -0,0 +1,7 @@ +package version + +// BuildNumber ... +var BuildNumber = "" + +// Commit ... +var Commit = "" diff --git a/go/src/github.com/bitrise-core/bitrise-init/version/version.go b/go/src/github.com/bitrise-core/bitrise-init/version/version.go index 6d659570..3c116d92 100644 --- a/go/src/github.com/bitrise-core/bitrise-init/version/version.go +++ b/go/src/github.com/bitrise-core/bitrise-init/version/version.go @@ -1,4 +1,4 @@ package version // VERSION ... -const VERSION = "0.9.0" +const VERSION = "0.9.1" From 31b1c10dd1e5e6b96a33ac782847c34692c80e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krisztia=CC=81n=20Go=CC=88drei?= Date: Thu, 2 Jun 2016 15:47:35 +0200 Subject: [PATCH 2/2] ci updates, force bitrise-init tool ci mode --- bitrise.yml | 178 +++++++++++++++++++++++++++++++++++++++++++++++++--- step.sh | 2 +- 2 files changed, 169 insertions(+), 11 deletions(-) diff --git a/bitrise.yml b/bitrise.yml index 40de77d6..a68d4ab0 100755 --- a/bitrise.yml +++ b/bitrise.yml @@ -6,37 +6,195 @@ app: # define these in your .bitrise.secrets.yml - BITRISE_SCAN_RESULT_POST_URL: $BITRISE_SCAN_RESULT_POST_URL - BITRISE_APP_API_TOKEN: $BITRISE_APP_API_TOKEN - - SCAN_DIR: "/Users/godrei/Develop/bitrise/sample-apps/sample-apps-ios-cocoapods" - - SCAN_DIR: "/Users/godrei/Develop/bitrise/sample-apps/sample-apps-android" - - SCAN_DIR: "/Users/godrei/Develop/bitrise/sample-apps/sample-apps-xamarin-uitest" - - SCAN_DIR: "/Users/godrei/Develop/bitrise/sample-apps/fastlane-example" workflows: # ---------------------------------------------------------------- # --- workflow to Step Test test: - envs: - - CI: "true" + title: Bitrise Init Test + description: Bitrise Init Test steps: - script: - title: _tmp dir cleanup + title: "Scann test: ios-no-shared-schemes" inputs: - content: |- #!/bin/bash set -x + rm -rf ./_tmp + SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/ios-no-shared-schemes.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + - change-workdir: + title: Switch working dir to ./_tmp + run_if: true + inputs: + - path: ./_tmp/sample-repo + - is_create_path: true + - path::./: + title: Step Test + inputs: + - scan_dir: ./ + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN - script: + title: "Scann test: sample-apps-ios-simple-objc" inputs: - content: |- #!/bin/bash + set -x - SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-ios-watchkit.git - SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/android-sdk22-no-gradlew.git + rm -rf ./_tmp + SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-ios-simple-objc.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + - change-workdir: + title: Switch working dir to ./_tmp + run_if: true + inputs: + - path: ./_tmp/sample-repo + - is_create_path: true + - path::./: + title: Step Test + inputs: + - scan_dir: ./ + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN + - script: + title: "Scann test: sample-apps-android-sdk22" + inputs: + - content: |- + #!/bin/bash + set -x + + rm -rf ./_tmp SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/sample-apps-android-sdk22.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + - change-workdir: + title: Switch working dir to ./_tmp + run_if: true + inputs: + - path: ./_tmp/sample-repo + - is_create_path: true + - path::./: + title: Step Test + inputs: + - scan_dir: ./ + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN + - script: + title: "Scann test: xamarin-sample-app" + inputs: + - content: |- + #!/bin/bash + set -x + + rm -rf ./_tmp + SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/xamarin-sample-app.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + - change-workdir: + title: Switch working dir to ./_tmp + run_if: true + inputs: + - path: ./_tmp/sample-repo + - is_create_path: true + - path::./: + title: Step Test + inputs: + - scan_dir: ./ + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN + - script: + title: "Scann test: sample-apps-ios-watchkit" + inputs: + - content: |- + #!/bin/bash + set -x + + rm -rf ./_tmp + SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-ios-watchkit.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + - change-workdir: + title: Switch working dir to ./_tmp + run_if: true + inputs: + - path: ./_tmp/sample-repo + - is_create_path: true + - path::./: + title: Step Test + inputs: + - scan_dir: ./ + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN + # - script: + # title: "Scann test: android-sdk22-no-gradlew" + # inputs: + # - content: |- + # #!/bin/bash + # set -x + # + # rm -rf ./_tmp + # SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/android-sdk22-no-gradlew.git + # git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + # $SCANNER_BIN --ci config --dir ./_tmp/sample-repo --output-dir ./_tmp/output --format json + - script: + title: "Scann test: sample-apps-xamarin-ios" + inputs: + - content: |- + #!/bin/bash + set -x + + rm -rf ./_tmp SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-xamarin-ios.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + - change-workdir: + title: Switch working dir to ./_tmp + run_if: true + inputs: + - path: ./_tmp/sample-repo + - is_create_path: true + - path::./: + title: Step Test + inputs: + - scan_dir: ./ + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN + - script: + title: "Scann test: android-non-executable-gradlew" + inputs: + - content: |- + #!/bin/bash + set -x + + rm -rf ./_tmp SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-samples/android-non-executable-gradlew.git - SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-xamarin-android.git + git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo + - change-workdir: + title: Switch working dir to ./_tmp + run_if: true + inputs: + - path: ./_tmp/sample-repo + - is_create_path: true + - path::./: + title: Step Test + inputs: + - scan_dir: ./ + - output_dir: ../result + - scan_result_submit_url: $BITRISE_SCAN_RESULT_POST_URL + - scan_result_submit_api_token: $BITRISE_APP_API_TOKEN + - script: + title: "Scann test: sample-apps-xamarin-android" + inputs: + - content: |- + #!/bin/bash + set -x + rm -rf ./_tmp + SAMPLE_APP_REPOSITORY_URL=https://github.com/bitrise-io/sample-apps-xamarin-android.git git clone $SAMPLE_APP_REPOSITORY_URL ./_tmp/sample-repo - change-workdir: title: Switch working dir to ./_tmp diff --git a/step.sh b/step.sh index df45b39d..2a2c1a7c 100755 --- a/step.sh +++ b/step.sh @@ -102,7 +102,7 @@ echo_done "ceated at: ${bin_pth}" # Running scanner echo_info "Running scanner..." -$bin_pth config --dir $scan_dir --output-dir $output_dir --format json +$bin_pth --ci config --dir $scan_dir --output-dir $output_dir --format json echo echo_done "scan finished"