1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Run continuous build tasks.
|
4 | #
|
5 | # Usage:
|
6 | # soil/worker.sh <function name>
|
7 |
|
8 | set -o nounset
|
9 | set -o pipefail
|
10 | set -o errexit
|
11 |
|
12 | REPO_ROOT=$(cd "$(dirname $0)/.."; pwd) # tsv-lib.sh uses this
|
13 | readonly REPO_ROOT
|
14 |
|
15 | source soil/common.sh
|
16 | source test/tsv-lib.sh
|
17 |
|
18 | py-all-and-ninja() {
|
19 | ### baseline for most tasks
|
20 |
|
21 | build/py.sh all
|
22 | ./NINJA-config.sh
|
23 | }
|
24 |
|
25 | ninja-config() {
|
26 | ./NINJA-config.sh
|
27 | }
|
28 |
|
29 | dummy-tasks() {
|
30 | ### Print tasks that execute quickly
|
31 |
|
32 | # (task_name, script, action, result_html)
|
33 | cat <<EOF
|
34 | os-info soil/diagnose.sh os-info -
|
35 | dump-env soil/diagnose.sh dump-env -
|
36 | EOF
|
37 | }
|
38 |
|
39 | raw-vm-tasks() {
|
40 | # The perf tool depends on a specific version of a kernel, so run it outside
|
41 | # a container.
|
42 |
|
43 | # (task_name, script, action, result_html)
|
44 | cat <<EOF
|
45 | os-info soil/diagnose.sh os-info -
|
46 | dump-env soil/diagnose.sh dump-env -
|
47 | perf-install benchmarks/perf.sh soil-install -
|
48 | wait-for-tarball soil/wait.sh for-cpp-tarball -
|
49 | test-install-tar devtools/release-native.sh test-install-tar -
|
50 | perf-profiles benchmarks/perf.sh soil-run _tmp/perf/index.html
|
51 | EOF
|
52 | }
|
53 |
|
54 | # Oh there is a large list of pre-installed software
|
55 | # https://github.com/actions/runner-images#available-images
|
56 | # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md
|
57 | # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
|
58 | #
|
59 | # 1. System deps for building wedges - ninja, cmake, libreadline-dev, etc.
|
60 | # 2. fetch wedges - re2c, cmark, python2, python3, MyPy, pyflakes
|
61 | # - Python 3.10 desired for "pea"
|
62 | # 3. build them
|
63 | # 4. build Oils with them
|
64 |
|
65 | dev-setup-for() {
|
66 | local distro=$1
|
67 | # (task_name, script, action, result_html)
|
68 |
|
69 | cat <<EOF
|
70 | os-info soil/diagnose.sh os-info -
|
71 | dump-env soil/diagnose.sh dump-env -
|
72 | wedge-deps build/deps.sh wedge-deps-$distro -
|
73 | fetch build/deps.sh fetch -
|
74 | install-wedges build/deps.sh install-wedges-fast _build/wedge/logs/index.html
|
75 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
76 | smoke-test build/dev-setup-test.sh smoke-test -
|
77 | wedge-report build/deps.sh wedge-report -
|
78 | EOF
|
79 | }
|
80 |
|
81 | spec-bin-for() {
|
82 | local distro=$1
|
83 | cat <<EOF
|
84 | os-info soil/diagnose.sh os-info -
|
85 | dump-env soil/diagnose.sh dump-env -
|
86 | wedge-deps build/deps.sh wedge-deps-$distro -
|
87 | fetch build/deps.sh fetch -
|
88 | spec-bin build/deps.sh install-spec-bin-fast _build/wedge/logs/index.html
|
89 | EOF
|
90 | }
|
91 |
|
92 | dev-setup-debian-tasks() {
|
93 | # (task_name, script, action, result_html)
|
94 |
|
95 | dev-setup-for debian
|
96 | #spec-bin-for debian
|
97 | }
|
98 |
|
99 | dev-setup-fedora-tasks() {
|
100 | # (task_name, script, action, result_html)
|
101 |
|
102 | dev-setup-for fedora
|
103 | }
|
104 |
|
105 | dev-setup-alpine-tasks() {
|
106 | # (task_name, script, action, result_html)
|
107 |
|
108 | dev-setup-for alpine
|
109 | #spec-bin-for alpine
|
110 | }
|
111 |
|
112 | pea-tasks() {
|
113 | ### Print tasks for the 'pea' build
|
114 |
|
115 | # We need a later version of Python 3 / MyPy both to type check and
|
116 | # to parse
|
117 |
|
118 | # Run py-source so we can type check generated code
|
119 | # We need to type check more than we translate
|
120 |
|
121 | # (task_name, script, action, result_html)
|
122 | cat <<EOF
|
123 | os-info soil/diagnose.sh os-info -
|
124 | dump-env soil/diagnose.sh dump-env -
|
125 | py-source build/py.sh py-source -
|
126 | check-types pea/TEST.sh check-types -
|
127 | run-tests pea/TEST.sh run-tests -
|
128 | parse-all pea/TEST.sh parse-all -
|
129 | EOF
|
130 | }
|
131 |
|
132 | dev-minimal-tasks() {
|
133 | ### Print tasks for the 'dev-minimal' build
|
134 |
|
135 | # repo overview is suggested by README.md
|
136 |
|
137 | # (task_name, script, action, result_html)
|
138 | cat <<EOF
|
139 | os-info soil/diagnose.sh os-info -
|
140 | dump-env soil/diagnose.sh dump-env -
|
141 | build-minimal build/py.sh minimal -
|
142 | repo-overview metrics/source-code.sh overview -
|
143 | lint test/lint.sh soil-run -
|
144 | asdl-types asdl/TEST.sh check-types -
|
145 | oil-types devtools/types.sh soil-run -
|
146 | unit test/unit.sh soil-run -
|
147 | lossless test/lossless.sh soil-run -
|
148 | parse-errors test/parse-errors.sh soil-run-py -
|
149 | runtime-errors test/runtime-errors.sh soil-run-py -
|
150 | ysh-parse-errors test/ysh-parse-errors.sh soil-run-py -
|
151 | ysh-runtime-errors test/ysh-runtime-errors.sh soil-run-py -
|
152 | ysh-every-string test/ysh-every-string.sh soil-run-py -
|
153 | ysh-large ysh/run.sh soil-run -
|
154 | j8-errors data_lang/j8-errors.sh soil-run-py -
|
155 | link-busybox-ash test/spec-bin.sh link-busybox-ash -
|
156 | osh-minimal test/spec-py.sh osh-minimal _tmp/spec/osh-minimal/index.html
|
157 | headless client/run.sh soil-run-py -
|
158 | EOF
|
159 | }
|
160 |
|
161 | interactive-tasks() {
|
162 | ### Print tasks for the 'interactive' build
|
163 |
|
164 | # TODO: also run interactive suite with osh-cpp
|
165 |
|
166 | # TODO: Why does the needs-terminal suite hang in Docker? It doesn't hang in an interactive Docker session.
|
167 | #
|
168 | # needs-terminal test/spec-py.sh needs-terminal-all _tmp/spec/needs-terminal-py/index.html
|
169 | #
|
170 | # https://oilshell.zulipchat.com/#narrow/stream/121539-oil-dev/topic/Spec.20Tests.20for.20Interactive.20Parsing
|
171 |
|
172 | cat <<EOF
|
173 | os-info soil/diagnose.sh os-info -
|
174 | dump-env soil/diagnose.sh dump-env -
|
175 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
176 | interactive-osh test/spec-py.sh interactive-osh _tmp/spec/interactive-osh/index.html
|
177 | nohup test/nohup.sh soil-run -
|
178 | process-table test/process-table.sh soil-run _tmp/process-table/index.html
|
179 | stateful test/stateful.sh soil-run _tmp/spec/stateful/index.html
|
180 | EOF
|
181 |
|
182 | }
|
183 |
|
184 | wild-tasks() {
|
185 | ### Print tasks for the 'wild' build
|
186 |
|
187 | # (task_name, script, action, result_html)
|
188 | cat <<EOF
|
189 | os-info soil/diagnose.sh os-info -
|
190 | dump-env soil/diagnose.sh dump-env -
|
191 | wait-for-tarball soil/wait.sh for-cpp-tarball -
|
192 | test-tar devtools/release-native.sh test-tar -
|
193 | linecount metrics/tarball.sh linecount-oils-cpp -
|
194 | wild test/wild.sh soil-run _tmp/wild-www/index.html
|
195 | EOF
|
196 | }
|
197 |
|
198 | benchmarks-tasks() {
|
199 | # (task_name, script, action, result_html)
|
200 |
|
201 | cat <<EOF
|
202 | os-info soil/diagnose.sh os-info -
|
203 | dump-env soil/diagnose.sh dump-env -
|
204 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
205 | id-test benchmarks/id-test.sh soil-run -
|
206 | native-code metrics/native-code.sh oils-for-unix _tmp/metrics/oils-for-unix/index.html
|
207 | osh-parser benchmarks/osh-parser.sh soil-run _tmp/osh-parser/index.html
|
208 | osh-runtime benchmarks/osh-runtime.sh soil-run _tmp/osh-runtime/index.html
|
209 | vm-baseline benchmarks/vm-baseline.sh soil-run _tmp/vm-baseline/index.html
|
210 | compute benchmarks/compute.sh soil-run _tmp/compute/index.html
|
211 | gc benchmarks/gc.sh soil-run _tmp/gc/index.html
|
212 | mycpp-benchmarks benchmarks/mycpp.sh soil-run _tmp/mycpp-examples/index.html
|
213 | EOF
|
214 | }
|
215 |
|
216 | benchmarks2-tasks() {
|
217 | # Note: id-test doesn't run in 'other-tests' because 'gawk' isn't in that image
|
218 | cat <<EOF
|
219 | os-info soil/diagnose.sh os-info -
|
220 | dump-env soil/diagnose.sh dump-env -
|
221 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
222 | dev-shell-test build/dev-shell-test.sh soil-run -
|
223 | gc-cachegrind benchmarks/gc-cachegrind.sh soil-run _tmp/gc-cachegrind/index.html
|
224 | uftrace benchmarks/uftrace.sh soil-run _tmp/uftrace/index.html
|
225 | EOF
|
226 | }
|
227 |
|
228 | cpp-spec-tasks() {
|
229 | # (task_name, script, action, result_html)
|
230 |
|
231 | cat <<EOF
|
232 | os-info soil/diagnose.sh os-info -
|
233 | dump-env soil/diagnose.sh dump-env -
|
234 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
235 | oils-cpp-smoke build/native.sh soil-run -
|
236 | osh-all test/spec-cpp.sh osh-all _tmp/spec/osh-cpp/compare.html
|
237 | ysh-all test/spec-cpp.sh ysh-all _tmp/spec/ysh-cpp/compare.html
|
238 | ysh-py test/spec-py.sh ysh-all-serial _tmp/spec/ysh-py/index.html
|
239 | EOF
|
240 | }
|
241 |
|
242 | cpp-tarball-tasks() {
|
243 |
|
244 | # Note: build-times task requires _build/oils.sh
|
245 | # It's a bit redundant with test-tar
|
246 |
|
247 | cat <<EOF
|
248 | os-info soil/diagnose.sh os-info -
|
249 | dump-env soil/diagnose.sh dump-env -
|
250 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
251 | oils-cpp-smoke build/native.sh soil-run -
|
252 | make-tar devtools/release-native.sh make-tar _release/oils-for-unix.tar
|
253 | xshar-hello devtools/xshar.sh soil-run-hello _release/hello-xshar.xshar
|
254 | xshar-test-oils devtools/xshar.sh soil-run-test-oils _release/test-oils.xshar
|
255 | build-times build/native.sh measure-build-times -
|
256 | EOF
|
257 |
|
258 | # build-times is a good enough test
|
259 | # test-tar devtools/release-native.sh test-tar -
|
260 | #
|
261 | # Note: tarball is deployed outside the container
|
262 |
|
263 | }
|
264 |
|
265 | cpp-small-tasks() {
|
266 |
|
267 | # yaks could be moved to pea/ image once it has python2-dev
|
268 | cat <<EOF
|
269 | os-info soil/diagnose.sh os-info -
|
270 | dump-env soil/diagnose.sh dump-env -
|
271 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
272 | yaks yaks/TEST.sh soil-run -
|
273 | oils-cpp-smoke build/native.sh soil-run -
|
274 | cpp-unit test/cpp-unit.sh soil-run _test/cpp-unit.html
|
275 | headless client/run.sh soil-run-cpp -
|
276 | asan test/asan.sh soil-run -
|
277 | ltrace test/ltrace.sh soil-run -
|
278 | micro-syntax doctools/micro-syntax.sh soil-run -
|
279 | src-tree doctools/src-tree.sh soil-run _tmp/src-tree-www/index.html
|
280 | line-counts metrics/source-code.sh write-reports _tmp/metrics/line-counts/index.html
|
281 | preprocessed metrics/source-code.sh preprocessed _tmp/metrics/preprocessed/index.html
|
282 | mycpp-examples mycpp/TEST.sh soil-run _test/mycpp-examples.html
|
283 | parse-errors test/parse-errors.sh soil-run-cpp -
|
284 | runtime-errors test/runtime-errors.sh soil-run-cpp -
|
285 | ysh-parse-errors test/ysh-parse-errors.sh soil-run-cpp -
|
286 | ysh-runtime-errors test/ysh-runtime-errors.sh soil-run-cpp -
|
287 | ysh-every-string test/ysh-every-string.sh soil-run-cpp -
|
288 | ysh-large ysh/run.sh soil-run-cpp -
|
289 | j8-errors data_lang/j8-errors.sh soil-run-cpp -
|
290 | EOF
|
291 | }
|
292 |
|
293 | cpp-coverage-tasks() {
|
294 | # dep notes: hnode_asdl.h required by expr_asdl.h in mycpp/examples
|
295 |
|
296 | cat <<EOF
|
297 | os-info soil/diagnose.sh os-info -
|
298 | dump-env soil/diagnose.sh dump-env -
|
299 | py-all-and-ninja soil/worker.sh py-all-and-ninja -
|
300 | extract-clang deps/from-binary.sh extract-clang-in-container -
|
301 | mycpp-unit-coverage mycpp/TEST.sh unit-test-coverage _test/clang-coverage/mycpp/html/index.html
|
302 | mycpp-examples-coverage mycpp/TEST.sh examples-coverage _test/clang-coverage/mycpp/examples/html/index.html
|
303 | cpp-coverage cpp/TEST.sh coverage _test/clang-coverage/cpp/html/index.html
|
304 | unified-coverage test/coverage.sh unified-report _test/clang-coverage/unified/html/index.html
|
305 | compare-gcc-clang metrics/native-code.sh compare-gcc-clang _tmp/metrics/compare-gcc-clang.txt
|
306 | EOF
|
307 | }
|
308 |
|
309 | ovm-tarball-tasks() {
|
310 | ### Print tasks for the 'ovm-tarball' build
|
311 |
|
312 | # notes:
|
313 | # - py-all needed to crawl dependencies to make tarball.
|
314 |
|
315 | # (task_name, script, action, result_html)
|
316 | cat <<EOF
|
317 | os-info soil/diagnose.sh os-info -
|
318 | dump-env soil/diagnose.sh dump-env -
|
319 | py-all build/py.sh all -
|
320 | syscall-by-code test/syscall.sh by-code _tmp/syscall/by-code.txt
|
321 | syscall-by-input test/syscall.sh by-input _tmp/syscall/by-input.txt
|
322 | osh-spec test/spec-py.sh osh-all-serial _tmp/spec/osh-py/index.html
|
323 | gold test/gold.sh soil-run -
|
324 | osh-usage test/osh-usage.sh soil-run -
|
325 | tools-deps test/tools-deps.sh soil-run -
|
326 | make-tarball devtools/release.sh py-tarball _release/oil.tar
|
327 | ysh-ovm-tarball test/spec-py.sh ysh-ovm-tarball _tmp/spec/ysh-py/index.html
|
328 | docs build/doc.sh soil-run _release/VERSION/index.html
|
329 | ref-check build/doc.sh ref-check -
|
330 | EOF
|
331 | }
|
332 |
|
333 | # Reuse ovm-tarball container
|
334 | app-tests-tasks() {
|
335 |
|
336 | cat <<EOF
|
337 | os-info soil/diagnose.sh os-info -
|
338 | dump-env soil/diagnose.sh dump-env -
|
339 | py-all build/py.sh all -
|
340 | ble-clone test/ble.sh clone -
|
341 | ble-build test/ble.sh build -
|
342 | ble-bash-suite test/ble.sh bash-suite -
|
343 | ble-test-osh-py test/ble.sh run-tests-osh-py -
|
344 | wait-for-tarball soil/wait.sh for-cpp-tarball -
|
345 | test-tar devtools/release-native.sh test-tar -
|
346 | ble-test-osh-cpp test/ble.sh run-tests-osh-cpp -
|
347 | EOF
|
348 |
|
349 | # This doesn't work
|
350 | # ble-test-osh-bash test/ble.sh run-tests-osh-bash -
|
351 | }
|
352 |
|
353 | # TODO: Most of these should be Ninja tasks.
|
354 | # Other tests:
|
355 | # find-test, xargs-test, pgen2-test, web/table/csv2html-test.sh
|
356 | # Probably should start using a shell test framework too.
|
357 | other-tests-tasks() {
|
358 | cat <<EOF
|
359 | os-info soil/diagnose.sh os-info -
|
360 | dump-env soil/diagnose.sh dump-env -
|
361 | build-minimal build/py.sh minimal -
|
362 | configure-test ./configure-test.sh soil_run -
|
363 | time-test benchmarks/time-test.sh soil-run -
|
364 | tsv-lib-test test/tsv-lib-test.sh soil-run -
|
365 | ysh-ify test/ysh-ify.sh soil-run -
|
366 | R-test devtools/R-test.sh soil-run -
|
367 | xargs-test test/other.sh xargs-test -
|
368 | csv2html-test test/other.sh csv2html-test -
|
369 | oil-python-symbols metrics/source-code.sh oil-python-symbols -
|
370 | opyc test/opyc.sh soil-run -
|
371 | opy-count-lines opy/soil.sh count-lines -
|
372 | test-gold opy/soil.sh test-gold -
|
373 | build-oil-repo opy/soil.sh build-oil-repo -
|
374 | regtest-compile opy/soil.sh regtest-compile -
|
375 | EOF
|
376 | }
|
377 |
|
378 | tests-todo() {
|
379 | ### More tests to add
|
380 | find . -name '_*' -a -prune -o -name '*-test.sh' -a -print
|
381 |
|
382 | # pgen2/pgen2-test.sh seems mostly broken
|
383 | }
|
384 |
|
385 | # Redefinition for quicker cloud debugging
|
386 | maybe-merge-tasks() {
|
387 | cat <<EOF
|
388 | os-info soil/diagnose.sh os-info -
|
389 | dump-env soil/diagnose.sh dump-env -
|
390 | maybe-merge soil/maybe-merge.sh soil-run -
|
391 | EOF
|
392 | }
|
393 |
|
394 | run-tasks() {
|
395 | ### Run the tasks on stdin and write _tmp/soil/INDEX.tsv.
|
396 | local job_name=$1
|
397 | local out_dir=$2 # should already exist
|
398 | local tty=$3
|
399 |
|
400 | mkdir -p $out_dir/logs
|
401 |
|
402 | # So we can run benchmarks/time_.py.
|
403 | # 2023-02-28: Images like soil-wild based off the new soil-common no longer
|
404 | # have 'cc'. Instead they use a wedge.
|
405 | if command -v cc > /dev/null; then
|
406 | build/py.sh time-helper
|
407 | else
|
408 | echo 'test time-tsv3'
|
409 | time-tsv3 -o /tmp/echo.tsv --append -- echo hi
|
410 |
|
411 | echo '/tmp/echo.tsv:'
|
412 | cat /tmp/echo.tsv
|
413 | fi
|
414 |
|
415 | # For the later deploy step to pick up
|
416 | date +%s > $out_dir/task-run-start-time.txt
|
417 |
|
418 | # This data can go on the dashboard index
|
419 | local tsv=$out_dir/INDEX.tsv
|
420 | rm -f $tsv
|
421 |
|
422 | local status
|
423 | local max_status=0
|
424 |
|
425 | while read task_name script action result_html; do
|
426 | log "--- task: $task_name ---"
|
427 |
|
428 | local log_path=$out_dir/logs/$task_name.txt
|
429 |
|
430 | # 15 minutes per task
|
431 | # One of the longest tasks is test/spec-cpp, which takes around 420 seconds
|
432 | # TODO: should have a configurable timeout
|
433 | local -a timeout=(timeout 900)
|
434 | local stdin_tty=''
|
435 |
|
436 | case $script in
|
437 | test/process-table.sh)
|
438 | # Workaround for weird interaction, see
|
439 | # $ test/process-table.sh timeout-issue
|
440 | timeout=()
|
441 | ;;
|
442 | test/nohup.sh)
|
443 | # Only run test/nohup.sh with TTY. For some reason build/py.sh all hangs
|
444 | # with $tty?
|
445 | stdin_tty=$tty
|
446 | ;;
|
447 | esac
|
448 |
|
449 | local -a argv=(
|
450 | time-tsv3 -o $tsv --append
|
451 | --field $task_name --field $script --field $action
|
452 | --field $result_html --
|
453 | "${timeout[@]}" "$script" "$action"
|
454 | )
|
455 |
|
456 | # Run task and save status
|
457 | set +o errexit
|
458 | if test -n "$stdin_tty"; then
|
459 | # explicitly connect TTY, e.g. for soil/interactive
|
460 | "${argv[@]}" > $log_path 2>&1 < $stdin_tty
|
461 | else
|
462 | "${argv[@]}" > $log_path 2>&1
|
463 | fi
|
464 | status=$?
|
465 | set -o errexit
|
466 |
|
467 | if test "$status" -gt "$max_status"; then
|
468 | max_status=$status
|
469 | fi
|
470 |
|
471 | # Show the last line
|
472 | echo
|
473 | tsv-row status elapsed task script action result_html
|
474 | tail -n 1 $tsv
|
475 | echo
|
476 | log "status=$status max_status=$max_status"
|
477 | done
|
478 |
|
479 | log '--- done ---'
|
480 | ls -l $out_dir
|
481 | wc -l $out_dir/logs/*
|
482 |
|
483 | # This suppressed the deployment of logs, which we don't want. So all our
|
484 | # Travis builds succeed? But then we can't use their failure notifications
|
485 | # (which might be OK).
|
486 | if false; then
|
487 | # exit with the maximum exit code.
|
488 | awk '
|
489 | BEGIN { max = 0 }
|
490 | { if ($1 > max) { max = $1 } }
|
491 | END { exit(max) }
|
492 | ' $tsv
|
493 | fi
|
494 |
|
495 | # To fail later. Important: this dir persists across jobs; it's NOT removed
|
496 | # by 'host-shim.sh job-reset'.
|
497 | mkdir -p _soil-jobs
|
498 |
|
499 | # Hack: Assign job_id and write it to the status file. Other jobs can poll
|
500 | # for completion of this job and access its resources.
|
501 |
|
502 | local job_id
|
503 | job_id="$(date +%Y-%m-%d__%H-%M-%S)"
|
504 |
|
505 | # e.g. _soil-jobs/dummy.status.txt
|
506 | echo "$max_status $job_id" > _soil-jobs/$job_name.status.txt
|
507 | }
|
508 |
|
509 | save-metadata() {
|
510 | ### Write metadata files to be saved as JSON
|
511 |
|
512 | # NOTE: host-shim.sh also writes image-pull-time.txt
|
513 |
|
514 | local job_name=$1
|
515 | local meta_dir=$2
|
516 |
|
517 | echo "$job_name" > $meta_dir/job-name.txt
|
518 |
|
519 | # command to show current branch
|
520 | # This does NOT work in detached HEAD! Travis puts the branch in an env
|
521 | # variable, but sr.ht doesn't.
|
522 | # git rev-parse --abbrev-ref HEAD > $meta_dir/git-branch.txt
|
523 |
|
524 | git log -n 1 --pretty='format:%H' > $meta_dir/commit-hash.txt
|
525 |
|
526 | # ISO 8601 format
|
527 | # Note: this can get confused with rebases. Two different commits can have
|
528 | # the same date.
|
529 | git log -n 1 --pretty='format:%aI' > $meta_dir/commit-date.txt
|
530 |
|
531 | git log -n 1 --pretty='format:%s' > $meta_dir/commit-line.txt # "subject"
|
532 | }
|
533 |
|
534 | disable-git-errors() {
|
535 |
|
536 | # 2023-02: The build started failing because of the permissions we set in
|
537 | # soil/host-shim.sh mount-perms.
|
538 | #
|
539 | # The issue is that the guest needs to be able to write to the Docker mount
|
540 | # of the repo. I think it may have been related to podman vs. Docker.
|
541 | # Should check if mount-perms is necessary in both places.
|
542 | #
|
543 | # git fails unless we have this workaround.
|
544 |
|
545 | # https://stackoverflow.com/questions/72978485/git-submodule-update-failed-with-fatal-detected-dubious-ownership-in-repositor
|
546 |
|
547 | # https://github.blog/2022-04-12-git-security-vulnerability-announced/
|
548 |
|
549 | #git config --global --add safe.directory '*'
|
550 |
|
551 | git config --global --add safe.directory /home/uke/oil
|
552 | }
|
553 |
|
554 | job-main() {
|
555 | local job_name=$1
|
556 |
|
557 | local out_dir=_tmp/soil
|
558 |
|
559 | # Report for debugging
|
560 | export EXTRA_MYCPP_ARGS='--stack-roots-warn 16'
|
561 |
|
562 | log-context 'job-main'
|
563 | mkdir -v -p $out_dir
|
564 | ls -l -d $out_dir
|
565 |
|
566 | disable-git-errors
|
567 |
|
568 | save-metadata $job_name $out_dir
|
569 |
|
570 | local captured
|
571 |
|
572 | set +o errexit
|
573 | captured=$(tty)
|
574 | status=$?
|
575 | set -o errexit
|
576 |
|
577 | if test $status -eq 0; then
|
578 | echo "TTY = $captured"
|
579 | local tty=$captured
|
580 | else
|
581 | echo "captured = $captured"
|
582 | local tty='' # clear the output
|
583 | fi
|
584 | echo
|
585 |
|
586 | ${job_name}-tasks | run-tasks $job_name $out_dir "$tty"
|
587 | }
|
588 |
|
589 | JOB-dummy() { job-main 'dummy'; }
|
590 | JOB-raw-vm() { job-main 'raw-vm'; }
|
591 | JOB-dev-setup-debian() { job-main 'dev-setup-debian'; }
|
592 | JOB-dev-setup-fedora() { job-main 'dev-setup-fedora'; }
|
593 | JOB-dev-setup-alpine() { job-main 'dev-setup-alpine'; }
|
594 |
|
595 | JOB-dev-minimal() { job-main 'dev-minimal'; }
|
596 | JOB-interactive() { job-main 'interactive'; }
|
597 |
|
598 | JOB-other-tests() { job-main 'other-tests'; }
|
599 |
|
600 | JOB-pea() { job-main 'pea'; }
|
601 |
|
602 | JOB-ovm-tarball() { job-main 'ovm-tarball'; }
|
603 | JOB-app-tests() { job-main 'app-tests'; }
|
604 |
|
605 | JOB-cpp-coverage() { job-main 'cpp-coverage'; }
|
606 | JOB-cpp-small() { job-main 'cpp-small'; }
|
607 | JOB-cpp-tarball() { job-main 'cpp-tarball'; }
|
608 | JOB-cpp-spec() { job-main 'cpp-spec'; }
|
609 |
|
610 | JOB-benchmarks() { job-main 'benchmarks'; }
|
611 | JOB-benchmarks2() { job-main 'benchmarks2'; }
|
612 |
|
613 | JOB-wild() { job-main 'wild'; }
|
614 |
|
615 | JOB-maybe-merge() { job-main 'maybe-merge'; }
|
616 |
|
617 | list-jobs() {
|
618 | # dev-setup-fedora for Fedora, disable
|
619 | compgen -A function | grep -- '^JOB-' | sed 's/^JOB-//g' | egrep -v 'maybe-merge|dev-setup-fedora|dev-setup-alpine'
|
620 | }
|
621 |
|
622 | "$@"
|