|
| 1 | +format_version: 5 |
| 2 | +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git |
| 3 | + |
| 4 | +app: |
| 5 | + envs: |
| 6 | + - BITRISE_STEP_ID: android-unit-test |
| 7 | + - BITRISE_STEP_VERSION: "0.9.0" |
| 8 | + - BITRISE_STEP_GIT_CLONE_URL: https://github.com/bitrise-steplib/bitrise-step-android-unit-test.git |
| 9 | + - MY_STEPLIB_REPO_FORK_GIT_URL: $MY_STEPLIB_REPO_FORK_GIT_URL |
| 10 | + - SAMPLE_REPO_GIT_CLONE_URL: https://github.com/bitrise-samples/android-multiple-test-results-sample.git |
| 11 | + |
| 12 | +workflows: |
| 13 | + test: |
| 14 | + title: Test simple android project & mono repo projects |
| 15 | + before_run: |
| 16 | + - audit-this-step |
| 17 | + - go-tests |
| 18 | + after_run: |
| 19 | + - test-in-src-dir |
| 20 | + - test-in-root-tmp-dir |
| 21 | + - check-artifacts |
| 22 | + |
| 23 | + test-in-src-dir: |
| 24 | + title: Test android project & mono repo projects in source dir |
| 25 | + steps: |
| 26 | + - script: |
| 27 | + inputs: |
| 28 | + - content: rm -rf _tmp |
| 29 | + - change-workdir: |
| 30 | + title: cd $BITRISE_SOURCE_DIR/_tmp |
| 31 | + run_if: true |
| 32 | + inputs: |
| 33 | + - path: ./_tmp |
| 34 | + - is_create_path: true |
| 35 | + - script: |
| 36 | + inputs: |
| 37 | + - content: git clone -b no-failures $SAMPLE_REPO_GIT_CLONE_URL . |
| 38 | + - path::./: |
| 39 | + title: Test simple android project |
| 40 | + |
| 41 | + test-in-root-tmp-dir: |
| 42 | + title: Test android project & mono repo projects in /tmp dir |
| 43 | + steps: |
| 44 | + - script: |
| 45 | + inputs: |
| 46 | + - content: rm -rf /tmp/_tmp |
| 47 | + - change-workdir: |
| 48 | + title: cd /tmp/_tmp |
| 49 | + run_if: true |
| 50 | + inputs: |
| 51 | + - path: /tmp/_tmp |
| 52 | + - is_create_path: true |
| 53 | + - script: |
| 54 | + inputs: |
| 55 | + - content: git clone -b no-failures $SAMPLE_REPO_GIT_CLONE_URL . |
| 56 | + - path::./: |
| 57 | + title: Test simple repo |
| 58 | + |
| 59 | + check-artifacts: |
| 60 | + steps: |
| 61 | + - script: |
| 62 | + title: Check if files are existing |
| 63 | + inputs: |
| 64 | + - content: |- |
| 65 | + #!/usr/bin/env bash |
| 66 | + set -ex |
| 67 | +
|
| 68 | + # without timestamps |
| 69 | + if [ ! -f $BITRISE_DEPLOY_DIR/another_app-reports.zip ]; then |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | + if [ ! -f $BITRISE_DEPLOY_DIR/app-reports.zip ]; then |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | + if [ ! -f $BITRISE_DEPLOY_DIR/another_app-test-results.zip ]; then |
| 76 | + exit 1 |
| 77 | + fi |
| 78 | + if [ ! -f $BITRISE_DEPLOY_DIR/app-test-results.zip ]; then |
| 79 | + exit 1 |
| 80 | + fi |
| 81 | +
|
| 82 | + # with timestamps |
| 83 | + if [ ! -f $(ls $BITRISE_DEPLOY_DIR/another_app-reports-20*.zip) ]; then |
| 84 | + exit 1 |
| 85 | + fi |
| 86 | + if [ ! -f $(ls $BITRISE_DEPLOY_DIR/app-reports-20*.zip) ]; then |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | + if [ ! -f $(ls $BITRISE_DEPLOY_DIR/another_app-test-results-20*.zip) ]; then |
| 90 | + exit 1 |
| 91 | + fi |
| 92 | + if [ ! -f $(ls $BITRISE_DEPLOY_DIR/app-test-results-20*.zip) ]; then |
| 93 | + exit 1 |
| 94 | + fi |
| 95 | +
|
| 96 | + go-tests: |
| 97 | + steps: |
| 98 | + - script: |
| 99 | + title: Export go files to test |
| 100 | + inputs: |
| 101 | + - content: |- |
| 102 | + #!/usr/bin/env bash |
| 103 | + set -ex |
| 104 | +
|
| 105 | + no_vendor_paths="$(go list ./... | grep -v vendor)" |
| 106 | + envman add --key GOLIST_WITHOUT_VENDOR --value "$no_vendor_paths" |
| 107 | + - script: |
| 108 | + title: Err check |
| 109 | + inputs: |
| 110 | + - content: |- |
| 111 | + #!/usr/bin/env bash |
| 112 | + set -ex |
| 113 | + go get -u -v github.com/kisielk/errcheck |
| 114 | + errcheck -asserts=true -blank=true $GOLIST_WITHOUT_VENDOR |
| 115 | + - script: |
| 116 | + title: Go lint |
| 117 | + inputs: |
| 118 | + - content: |- |
| 119 | + #!/usr/bin/env bash |
| 120 | + set -ex |
| 121 | + go get -u -v github.com/golang/lint/golint |
| 122 | + while read -r line; do |
| 123 | + echo "-> Linting: $line" |
| 124 | + golint_out="$(golint $line)" |
| 125 | + if [[ "${golint_out}" != "" ]] ; then |
| 126 | + echo "=> Golint issues found:" |
| 127 | + echo "${golint_out}" |
| 128 | + exit 1 |
| 129 | + fi |
| 130 | + done <<< "$GOLIST_WITHOUT_VENDOR" |
| 131 | + - script: |
| 132 | + title: Go test |
| 133 | + inputs: |
| 134 | + - content: |- |
| 135 | + #!/usr/bin/env bash |
| 136 | + set -ex |
| 137 | + go test ./... |
| 138 | +
|
| 139 | + # ---------------------------------------------------------------- |
| 140 | + # --- workflows to Share this step into a Step Library |
| 141 | + audit-this-step: |
| 142 | + steps: |
| 143 | + - script: |
| 144 | + inputs: |
| 145 | + - content: |- |
| 146 | + #!/usr/bin/env bash |
| 147 | + set -ex |
| 148 | + stepman audit --step-yml ./step.yml |
| 149 | +
|
| 150 | + # ---------------------------------------------------------------- |
| 151 | + # --- workflows to create Release |
| 152 | + create-release: |
| 153 | + steps: |
| 154 | + - script: |
| 155 | + title: |
| 156 | + inputs: |
| 157 | + - content: | |
| 158 | + #!/usr/bin/env bash |
| 159 | + set -e |
| 160 | + export CI=true |
| 161 | + releaseman create --version $BITRISE_STEP_VERSION |
| 162 | + |
| 163 | + share-this-step: |
| 164 | + envs: |
| 165 | + # if you want to share this step into a StepLib |
| 166 | + - MY_STEPLIB_REPO_FORK_GIT_URL: $MY_STEPLIB_REPO_FORK_GIT_URL |
| 167 | + - BITRISE_STEP_ID: $BITRISE_STEP_ID |
| 168 | + - BITRISE_STEP_VERSION: $BITRISE_STEP_VERSION |
| 169 | + - BITRISE_STEP_GIT_CLONE_URL: $BITRISE_STEP_GIT_CLONE_URL |
| 170 | + description: |- |
| 171 | + If this is the first time you try to share a Step you should |
| 172 | + first call: $ bitrise share |
| 173 | +
|
| 174 | + This will print you a guide, and information about how Step sharing |
| 175 | + works. Please read it at least once! |
| 176 | +
|
| 177 | + As noted in the Step sharing guide you'll have to fork the |
| 178 | + StepLib you want to share this step into. Once you're done with forking |
| 179 | + the repository you should set your own fork's git clone URL |
| 180 | + in the `.bitrise.secrets.yml` file, or here in the `envs` section, |
| 181 | + as the value of the `MY_STEPLIB_REPO_FORK_GIT_URL` environment. |
| 182 | +
|
| 183 | + You're now ready to share this Step, just make sure that |
| 184 | + the `BITRISE_STEP_ID` and `BITRISE_STEP_VERSION` |
| 185 | + environments are set to the desired values! |
| 186 | +
|
| 187 | + To share this Step into a StepLib you can just run: $ bitrise run share-this-step |
| 188 | +
|
| 189 | + Once it finishes the only thing left is to actually create a Pull Request, |
| 190 | + the way described in the guide printed at the end of the process. |
| 191 | + before_run: |
| 192 | + - audit-this-step |
| 193 | + steps: |
| 194 | + - script: |
| 195 | + inputs: |
| 196 | + - content: |- |
| 197 | + #!/usr/bin/env bash |
| 198 | + set -ex |
| 199 | + bitrise share start -c "${MY_STEPLIB_REPO_FORK_GIT_URL}" |
| 200 | + bitrise share create --stepid "${BITRISE_STEP_ID}" --tag "${BITRISE_STEP_VERSION}" --git "${BITRISE_STEP_GIT_CLONE_URL}" |
| 201 | + bitrise share finish |
0 commit comments