Check-in [0c6ea4c365]
Overview
Comment:Stubbed out more functionality
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0c6ea4c365cf0e600b4f915cb4157e8a856092779fe7ad1e52135669601efc7f
User & Date: rkeene on 2017-10-26 20:06:37.150
Other Links: manifest | tags
Context
2017-10-26
20:07
Re-added this code accidentally removed in the last commit Leaf check-in: 3115f53525 user: rkeene tags: trunk
20:06
Stubbed out more functionality check-in: 0c6ea4c365 user: rkeene tags: trunk
18:14
Updated to compute width based on what has been icon-ized check-in: 9f3f36f9d7 user: rkeene tags: trunk
Changes
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
fossil sync -R "${repository}" >/dev/null 2>/dev/null || :

# 4. Get a list of branches
branches=( $(fossil branch -R "${repository}" list) )

# 5. Get Fossil CI configuration from the trunk branch
## 5.a. Set default config

excludedBranches=()
includedBranches=('')
buildCommands=('./autogen.sh || :' ./configure make)
initCommands=()
postCommands=()
branchPostCommands=()
testCommands=()
builderID=''
projectName="$(fossil info -R "${repository}" | awk '/^project-name:/{ sub(/^project-name: */, ""); gsub(/ /, ""); print; }')"
tagSuffix=''
tagPrefix=''
tagOmitRedundant='0'
tagOmitPass='0'































## 5.b. Read config
config="$(fossil cat -R "${repository}" -r trunk "${fossilCIDir}/config" 2>/dev/null)" || :

## 5.c Load config
if [ -f  ~/.fossil-ci/config ]; then
	. ~/.fossil-ci/config
fi

eval "${config}"

if [ -f ~/.fossil-ci/"${projectName}"/config ]; then
	. ~/.fossil-ci/"${projectName}"/config
fi

## 5.d. Post-process config
### 5.d.i. Add builderID as a tag suffix if none was given
if [ -z "${tagSuffix}" ]; then
	if [ -n "${builderID}" ]; then
		tagSuffix="-${builderID}"
	fi
fi

# 6. Perform any configured initialization
for cmd in "${initCommands[@]}"; do
	eval "${cmd}" >/dev/null 2>/dev/null || :
done

# 7. For each branch, attempt to build
for branch in "${branches[@]}"; do







>











|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>















<
<
<
<
<
<
<
<







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
fossil sync -R "${repository}" >/dev/null 2>/dev/null || :

# 4. Get a list of branches
branches=( $(fossil branch -R "${repository}" list) )

# 5. Get Fossil CI configuration from the trunk branch
## 5.a. Set default config
### 5.a.i. Set default variables
excludedBranches=()
includedBranches=('')
buildCommands=('./autogen.sh || :' ./configure make)
initCommands=()
postCommands=()
branchPostCommands=()
testCommands=()
builderID=''
projectName="$(fossil info -R "${repository}" | awk '/^project-name:/{ sub(/^project-name: */, ""); gsub(/ /, ""); print; }')"
tagSuffix=''
tagPrefix=''
# tagOmit='all|pass|redundant|none'
tagOmit='none'
# buildResultsUpload='fail|all|none'
buildResultsUpload='fail'
# testResultsUpload='fail|all|none'
testResultsUpload='fail'

### 5.a.ii. Default functions
function uploadBuildResults() {
	### XXX:TODO
	:
}

function uploadTestResults() {
	### XXX:TODO
	:
}

function uploadBuildArtifacts() {
	### XXX:TODO
	:
}

function fossilSetWikiPage() {
	### XXX:TODO
	:
}

function fossilUploadUV() {
	### XXX:TODO
	:
}

## 5.b. Read config
config="$(fossil cat -R "${repository}" -r trunk "${fossilCIDir}/config" 2>/dev/null)" || :

## 5.c Load config
if [ -f  ~/.fossil-ci/config ]; then
	. ~/.fossil-ci/config
fi

eval "${config}"

if [ -f ~/.fossil-ci/"${projectName}"/config ]; then
	. ~/.fossil-ci/"${projectName}"/config
fi









# 6. Perform any configured initialization
for cmd in "${initCommands[@]}"; do
	eval "${cmd}" >/dev/null 2>/dev/null || :
done

# 7. For each branch, attempt to build
for branch in "${branches[@]}"; do
147
148
149
150
151
152
153

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168



169
170


171
172
173



174
175


176
177
178
179
180
181
182
183
184
185
186
187
188
189
190






191






192








193
194

195
196
197
198
199
200
201

		for cmd in "${buildCommands[@]}"; do
			( eval "set -x; ${cmd}" ) || exit 1
		done
	) > "${builddir}/build.log" 2>&1 || build_pass='0'

	### 7.g. Test the branch

	if [ "${build_pass}" = '1' ]; then
		tests_pass='1'
		(
			cd "${branchdir}" || exit 1

			for cmd in "${testCommands[@]}"; do
				( eval "set -x; ${cmd}" ) || exit 1
			done
		) > "${builddir}/test.log" 2>&1 || tests_pass='0'
	fi

	### 7.h. Tag the branch with
	tagsToAdd=()
	if [ "${build_pass}" = '1' ]; then
		if [ "${tagOmitRedundant}" != '1' -a "${tagOmitPass}" != '1' ]; then



			tagsToAdd=("${tagsToAdd[@]}" build-pass)
		fi



		if [ "${tests_pass}" = '1' ]; then
			if [ "${tagOmitPass}" != '1' ]; then



				tagsToAdd=("${tagsToAdd[@]}" tests-pass)
			fi


		else
			tagsToAdd=("${tagsToAdd[@]}" tests-fail)
		fi
	else
		tagsToAdd=("${tagsToAdd[@]}" build-fail)
	fi

	tagsToAddOpts=()
	for tag in "${tagsToAdd[@]}"; do
		tagsToAddOpts=("${tagsToAddOpts[@]}" --tag "${tagPrefix}${tag}${tagSuffix}")
	done

	fossil amend -R "${repository}" "${branch}" "${tagsToAddOpts[@]}" > "${builddir}/update.log" 2>&1

	### 7.i. Upload the logs somewhere if requested






	#### XXX:TODO















	### 7.j. Upload build artifacts somewhere if requested
	#### XXX:TODO


	### 7.k. Get a list of tags
	tags=( $(fossil tag -R "${repository}" list "${branch}") )

	# 8. Perform post-build work (e.g., for release engineering)
	(
		cd "${branchdir}" || exit 1







>














|
>
>
>
|
<
>
>


|
>
>
>
|
<
>
>















>
>
>
>
>
>
|
>
>
>
>
>
>

>
>
>
>
>
>
>
>

<
>







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196

197
198
199
200
201
202
203
204
205

206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
253

		for cmd in "${buildCommands[@]}"; do
			( eval "set -x; ${cmd}" ) || exit 1
		done
	) > "${builddir}/build.log" 2>&1 || build_pass='0'

	### 7.g. Test the branch
	tests_pass='-1'
	if [ "${build_pass}" = '1' ]; then
		tests_pass='1'
		(
			cd "${branchdir}" || exit 1

			for cmd in "${testCommands[@]}"; do
				( eval "set -x; ${cmd}" ) || exit 1
			done
		) > "${builddir}/test.log" 2>&1 || tests_pass='0'
	fi

	### 7.h. Tag the branch with
	tagsToAdd=()
	if [ "${build_pass}" = '1' ]; then
		case "${tagOmit}" in
			all|pass|redundant)
				;;
			*)
				tagsToAdd=("${tagsToAdd[@]}" build-pass)

				;;
		esac

		if [ "${tests_pass}" = '1' ]; then
			case "${tagOmit}" in
				all|pass)
					;;
				*)
					tagsToAdd=("${tagsToAdd[@]}" tests-pass)

					;;
			esac
		else
			tagsToAdd=("${tagsToAdd[@]}" tests-fail)
		fi
	else
		tagsToAdd=("${tagsToAdd[@]}" build-fail)
	fi

	tagsToAddOpts=()
	for tag in "${tagsToAdd[@]}"; do
		tagsToAddOpts=("${tagsToAddOpts[@]}" --tag "${tagPrefix}${tag}${tagSuffix}")
	done

	fossil amend -R "${repository}" "${branch}" "${tagsToAddOpts[@]}" > "${builddir}/update.log" 2>&1

	### 7.i. Upload the logs somewhere if requested
	uploadBuildResults='0'
	case "${buildResultsUpload}-${build_pass}" in
		all-0|all-1|fail-0|pass-1)
			uploadBuildResults='1'
			;;
	esac

	uploadTestResults='0'
	case "${buildResultsUpload}-${tests_pass}" in
		all-0|all-1|fail-0|pass-1)
			uploadTestResults='1'
			;;
	esac

	if [ "${uploadBuildResults}" ]; then
		uploadBuildResults "${branch}" "${checkout}" "${builddir}/build.log" || :
	fi

	if [ "${uploadBuildResults}" ]; then
		uploadTestResults "${branch}" "${checkout}" "${builddir}/test.log" || :
	fi

	### 7.j. Upload build artifacts somewhere if requested

	uploadBuildArtifacts "${branch}" "${checkout}" "${branchdir}" || :

	### 7.k. Get a list of tags
	tags=( $(fossil tag -R "${repository}" list "${branch}") )

	# 8. Perform post-build work (e.g., for release engineering)
	(
		cd "${branchdir}" || exit 1