Repository navigation
Expand file tree
/
Copy pathbitrise.yml
More file actions
156 lines (144 loc) · 5.68 KB
/
Copy pathbitrise.yml
File metadata and controls
156 lines (144 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
format_version: "11"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
# Set these in .bitrise.secrets.yml (git-ignored) when running locally, or as
# Secrets on the Bitrise app that builds this repository.
# - TESTINGBOT_KEY
# - TESTINGBOT_SECRET
#
# A sample app and a directory of Maestro flows. The `test` workflow runs
# them on a real device, so these have to be genuine artifacts.
- SAMPLE_APP: $SAMPLE_APP
- SAMPLE_FLOWS: $SAMPLE_FLOWS
- SAMPLE_DEVICE: Pixel 9
# Used by `share-this-step`.
- BITRISE_STEP_ID: testingbot-maestro
- BITRISE_STEP_VERSION: 1.0.0
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/testingbot/bitrise-step-testingbot-maestro.git
- MY_STEPLIB_REPO_FORK_GIT_URL: $MY_STEPLIB_REPO_FORK_GIT_URL
workflows:
test:
summary: Runs real Maestro flows on TestingBot and checks the outputs.
description: |-
Requires TESTINGBOT_KEY, TESTINGBOT_SECRET, SAMPLE_APP and SAMPLE_FLOWS.
Offline tests that need no credentials and spend no device minutes live in
tests/run.sh in the development monorepo.
steps:
- script:
title: Fail fast if the test configuration is missing
inputs:
- content: |-
#!/usr/bin/env bash
set -eo pipefail
for var in TESTINGBOT_KEY TESTINGBOT_SECRET SAMPLE_APP SAMPLE_FLOWS; do
if [ -z "${!var}" ]; then
echo "error: \$$var is not set -- see bitrise.yml for what this workflow needs" >&2
exit 1
fi
done
- path::./:
title: Run the flows
inputs:
- testingbot_key: $TESTINGBOT_KEY
- testingbot_secret: $TESTINGBOT_SECRET
- app_path: $SAMPLE_APP
- flows: $SAMPLE_FLOWS
- device: $SAMPLE_DEVICE
- test_name: Step self-test
- script:
title: Check the outputs
inputs:
- content: |-
#!/usr/bin/env bash
set -eo pipefail
echo "TESTINGBOT_TEST_STATUS=$TESTINGBOT_TEST_STATUS"
echo "TESTINGBOT_JUNIT_REPORT_PATH=$TESTINGBOT_JUNIT_REPORT_PATH"
[ "$TESTINGBOT_TEST_STATUS" = "passed" ] || {
echo "error: expected the sample flows to pass" >&2; exit 1; }
[ -f "$TESTINGBOT_JUNIT_REPORT_PATH" ] || {
echo "error: no JUnit report was downloaded" >&2; exit 1; }
# Bitrise gives each Step its own $BITRISE_TEST_RESULT_DIR under a
# per-build parent, so look in the parent rather than in this
# script's own (empty) directory.
results_root="$(dirname "$BITRISE_TEST_RESULT_DIR")"
info="$(find "$results_root" -type f -name test-info.json \
-path '*Step self-test*' 2>/dev/null | head -1)"
[ -n "$info" ] || {
echo "error: the Test Reports export is missing under $results_root" >&2
find "$results_root" >&2
exit 1; }
echo "Test Reports export: $info"
- path::./:
title: Sharding and artifact download
inputs:
- testingbot_key: $TESTINGBOT_KEY
- testingbot_secret: $TESTINGBOT_SECRET
- app_path: $SAMPLE_APP
- flows: $SAMPLE_FLOWS
- device: $SAMPLE_DEVICE
- test_name: Sharded self-test
- shard_split: "2"
- download_artifacts: all
- script:
title: Check that artifacts were downloaded
inputs:
- content: |-
#!/usr/bin/env bash
set -eo pipefail
ls -la "$TESTINGBOT_ARTIFACTS_PATH"
[ -n "$(find "$TESTINGBOT_ARTIFACTS_PATH" -name '*.zip' -type f)" ] || {
echo "error: no artifacts zip was downloaded" >&2; exit 1; }
check:
summary: Lints step.yml and the README against each other.
steps:
- git::https://github.com/bitrise-steplib/steps-check.git:
inputs:
# These are bash Steps: there is no Go code to lint, and no Go unit
# tests to run. The offline suite lives in the development monorepo.
- workflow: lint
- skip_go_checks: "yes"
generate_readme:
summary: Regenerates README.md from step.yml plus docs/.
steps:
- git::https://github.com/bitrise-steplib/steps-readme-generator.git@main:
inputs:
- example_section: docs/examples.md
- contrib_section: docs/contributing.md
audit-this-step:
steps:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -eo pipefail
stepman audit --step-yml ./step.yml
share-this-step:
description: |-
Shares this version of the Step to a fork of the Bitrise StepLib.
Set MY_STEPLIB_REPO_FORK_GIT_URL and bump BITRISE_STEP_VERSION above, tag
the release in git, then run this workflow and open a pull request.
envs:
- BITRISE_STEP_ID: $BITRISE_STEP_ID
- BITRISE_STEP_VERSION: $BITRISE_STEP_VERSION
- BITRISE_STEP_GIT_CLONE_URL: $BITRISE_STEP_GIT_CLONE_URL
- MY_STEPLIB_REPO_FORK_GIT_URL: $MY_STEPLIB_REPO_FORK_GIT_URL
before_run:
- audit-this-step
steps:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -eo pipefail
for var in MY_STEPLIB_REPO_FORK_GIT_URL BITRISE_STEP_ID BITRISE_STEP_VERSION BITRISE_STEP_GIT_CLONE_URL; do
if [ -z "${!var}" ]; then
echo "error: \$$var is not set" >&2
exit 1
fi
done
bitrise share start -c "$MY_STEPLIB_REPO_FORK_GIT_URL"
bitrise share create --stepid "$BITRISE_STEP_ID" \
--tag "$BITRISE_STEP_VERSION" \
--git "$BITRISE_STEP_GIT_CLONE_URL"
bitrise share finish