Skip to content

Commit

Permalink
bitrise-init update (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
godrei authored Dec 13, 2016
1 parent bf8867d commit a647c34
Show file tree
Hide file tree
Showing 77 changed files with 14,842 additions and 3,604 deletions.
2 changes: 1 addition & 1 deletion deplock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dep_locks": [
{
"url": "https://github.com/bitrise-core/bitrise-init.git",
"revision": "a96564a4385140b60e0b1ca4314d626ed03273bd"
"revision": "b978e1a28b9d66dfaba3f33ac22cc41feacd5f80"
}
]
}
48 changes: 26 additions & 22 deletions go/src/github.com/bitrise-core/bitrise-init/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
package integration

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

"github.com/bitrise-core/bitrise-init/models"
"github.com/bitrise-core/bitrise-init/steps"
"github.com/bitrise-io/go-utils/cmdex"
"github.com/bitrise-io/go-utils/fileutil"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/stretchr/testify/require"
)

func TestAndroid(t *testing.T) {
tmpDir, err := pathutil.NormalizedOSTempDirPath("__android__")
require.NoError(t, err)
defer func() {
require.NoError(t, os.RemoveAll(tmpDir))
}()

t.Log("sample-apps-android-sdk22")
{
sampleAppDir := filepath.Join(tmpDir, "sample-apps-android-sdk22")
sampleAppURL := "https://github.com/bitrise-samples/sample-apps-android-sdk22.git"
require.NoError(t, cmdex.GitClone(sampleAppURL, sampleAppDir))

cmd := cmdex.NewCommand(binPath(), "--ci", "config", "--dir", sampleAppDir, "--output-dir", sampleAppDir)
out, err := cmd.RunAndReturnTrimmedCombinedOutput()
require.NoError(t, err, out)

scanResultPth := filepath.Join(sampleAppDir, "result.yml")

result, err := fileutil.ReadStringFromFile(scanResultPth)
require.NoError(t, err)
require.Equal(t, strings.TrimSpace(sampleAppsAndroid22ResultYML), strings.TrimSpace(result))
}

t.Log("android-non-executable-gradlew")
{
sampleAppDir := filepath.Join(tmpDir, "android-non-executable-gradlew")
sampleAppURL := "https://github.com/bitrise-samples/android-non-executable-gradlew.git"
require.NoError(t, cmdex.GitClone(sampleAppURL, sampleAppDir))

cmd := cmdex.NewCommand(binPath(), "--ci", "config", "--dir", sampleAppDir, "--output-dir", sampleAppDir)
out, err := cmd.RunAndReturnTrimmedCombinedOutput()
require.NoError(t, err, out)

scanResultPth := filepath.Join(sampleAppDir, "result.yml")

result, err := fileutil.ReadStringFromFile(scanResultPth)
require.NoError(t, err)
require.Equal(t, strings.TrimSpace(androidNonExecutableGradlewResultYML), strings.TrimSpace(result))
}
}

var androidNonExecutableGradlewResultYML = fmt.Sprintf(`options:
android:
title: Path to the gradle file to use
env_key: GRADLE_BUILD_FILE_PATH
value_map:
build.gradle:
title: Gradle task to run
env_key: GRADLE_TASK
value_map:
assemble:
title: Gradlew file path
env_key: GRADLEW_PATH
value_map:
./gradlew:
config: android-config
assembleDebug:
title: Gradlew file path
env_key: GRADLEW_PATH
value_map:
./gradlew:
config: android-config
assembleRelease:
title: Gradlew file path
env_key: GRADLEW_PATH
value_map:
./gradlew:
config: android-config
configs:
android:
android-config: |
format_version: %s
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
trigger_map:
- workflow: primary
pattern: '*'
is_pull_request_allowed: true
workflows:
primary:
steps:
- activate-ssh-key@%s:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@%s: {}
- script@%s:
title: Do anything with Script step
- script@%s:
title: Update Android Extra packages
inputs:
- content: |
#!/bin/bash
set -ex
echo y | android update sdk --no-ui --all --filter platform-tools | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-android-m2repository | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-google-m2repository | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-google-google_play_services | grep 'package installed'
- gradle-runner@%s:
inputs:
- gradle_file: $GRADLE_BUILD_FILE_PATH
- gradle_task: $GRADLE_TASK
- gradlew_path: $GRADLEW_PATH
- deploy-to-bitrise-io@%s: {}
warnings:
android: []
`, models.FormatVersion,
steps.ActivateSSHKeyVersion, steps.GitCloneVersion, steps.ScriptVersion, steps.ScriptVersion, steps.GradleRunnerVersion, steps.DeployToBitriseIoVersion)

var sampleAppsAndroid22ResultYML = fmt.Sprintf(`options:
android:
title: Path to the gradle file to use
env_key: GRADLE_BUILD_FILE_PATH
value_map:
build.gradle:
title: Gradle task to run
env_key: GRADLE_TASK
value_map:
assemble:
title: Gradlew file path
env_key: GRADLEW_PATH
value_map:
./gradlew:
config: android-config
assembleDebug:
title: Gradlew file path
env_key: GRADLEW_PATH
value_map:
./gradlew:
config: android-config
assembleRelease:
title: Gradlew file path
env_key: GRADLEW_PATH
value_map:
./gradlew:
config: android-config
configs:
android:
android-config: |
format_version: %s
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
trigger_map:
- workflow: primary
pattern: '*'
is_pull_request_allowed: true
workflows:
primary:
steps:
- activate-ssh-key@%s:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@%s: {}
- script@%s:
title: Do anything with Script step
- script@%s:
title: Update Android Extra packages
inputs:
- content: |
#!/bin/bash
set -ex
echo y | android update sdk --no-ui --all --filter platform-tools | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-android-m2repository | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-google-m2repository | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-google-google_play_services | grep 'package installed'
- gradle-runner@%s:
inputs:
- gradle_file: $GRADLE_BUILD_FILE_PATH
- gradle_task: $GRADLE_TASK
- gradlew_path: $GRADLEW_PATH
- deploy-to-bitrise-io@%s: {}
warnings:
android: []
`, models.FormatVersion,
steps.ActivateSSHKeyVersion, steps.GitCloneVersion, steps.ScriptVersion, steps.ScriptVersion, steps.GradleRunnerVersion, steps.DeployToBitriseIoVersion)
Loading

0 comments on commit a647c34

Please sign in to comment.