-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbitrise.yml
132 lines (124 loc) · 3.69 KB
/
bitrise.yml
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
format_version: 1.3.1
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
- RELEASE_VERSION: 1.1.0
workflows:
audit-this-step:
steps:
- script:
inputs:
- content: |-
#!/bin/bash
set -ex
stepman audit --step-yml ./step.yml
deps-update:
steps:
- script:
title: Dependency update
inputs:
- content: |
#!/bin/bash
set -ex
go get -u -v github.com/golang/dep/cmd/dep
dep ensure -v
dep ensure -v -update
test:
envs:
- TEST_FILE_PATH: ./test.txt
- ORIGINAL_TEST_FILE_CONTENT: |-
this is the first line
the second line
and finally the third line
- REPLACE_THIS: second
- REPLACE_WITH: 2nd
- EXPECTED_TEST_FILE_CONTENT_AFTER_REPLACE: |-
this is the first line
the 2nd line
and finally the third line
steps:
- change-workdir:
title: Switch working dir to test _tmp dir
description: |-
To prevent step testing issues, like referencing relative
files with just './some-file' in the step's code, which would
work for testing the step from this directory directly
but would break if the step is included in another `bitrise.yml`.
run_if: "true"
inputs:
- path: ./_tmp
- is_create_path: true
- script:
title: Generate test input file
inputs:
- content: |-
#!/bin/bash
set -ex
echo -n "$ORIGINAL_TEST_FILE_CONTENT" > "$TEST_FILE_PATH"
- path::./:
run_if: "true"
inputs:
- show_file: "true"
- file: $TEST_FILE_PATH
- old_value: $REPLACE_THIS
- new_value: $REPLACE_WITH
- script:
title: Test the step's output
inputs:
- content: |-
#!/bin/bash
set -ex
file_content="$(cat "$TEST_FILE_PATH")"
if [[ "$file_content" != "$EXPECTED_TEST_FILE_CONTENT_AFTER_REPLACE" ]] ; then
echo "Not what we expected!"
exit 1
fi
echo "Perfect!"
test_not_found:
steps:
- script:
title: Start a failing workflow, wrapped in a script.
inputs:
- content: |-
#!/bin/env bash
set -x # Do not set -e as bitrise command is expected to fail
bitrise run utility_test_not_found
if [ $? -ne 1 ] ; then
echo "Workflow was excepted to fail, exit code not 1."
exit 1
fi
utility_test_not_found:
envs:
- TEST_FILE_PATH: ./test.txt
- ORIGINAL_TEST_FILE_CONTENT: |-
this is the first line
and finally the third line
- REPLACE_THIS: second
- REPLACE_WITH: 2nd
steps:
- change-workdir:
title: Switch working dir to test _tmp dir
description: |-
To prevent step testing issues, like referencing relative
files with just './some-file' in the step's code, which would
work for testing the step from this directory directly
but would break if the step is included in another `bitrise.yml`.
run_if: "true"
inputs:
- path: ./_tmp
- is_create_path: true
- script:
title: Generate test input file
inputs:
- content: |-
#!/bin/bash
set -ex
echo -n "$ORIGINAL_TEST_FILE_CONTENT" > "$TEST_FILE_PATH"
- path::./:
run_if: "true"
inputs:
- show_file: "true"
- file: $TEST_FILE_PATH
- old_value: $REPLACE_THIS
- new_value: $REPLACE_WITH
- notfound_exit: true