Skip to content

Commit

Permalink
Groom travis stuff (#424)
Browse files Browse the repository at this point in the history
* Groom travis stuff

* decompose
  • Loading branch information
Rob Walker authored Apr 20, 2020
1 parent 7e4ad1c commit d0488aa
Showing 1 changed file with 34 additions and 43 deletions.
77 changes: 34 additions & 43 deletions integrations/ci-tools/build.sh
Original file line number Diff line number Diff line change
@@ -1,78 +1,69 @@
#!/bin/bash
#!/usr/bin/env bash

die() {
echo " *** ERROR: " "${*}"
exit 1
}
#
# In support of Travis CI which communicates via environment variables,
# this script supports the following:
#
# TASK a mnemonic for a supported build/test CI task to be mapped
# to a set of bash commands
# IMAGE the location (under integrations/docker/image) of the desired
# run.sh
#

write_bash_template() {
echo '#!/bin/bash
' >./build/scripts/build_command.sh
chmod +x ./build/scripts/build_command.sh
}
me=$(basename "$0")

write_bash_command() {
echo "$1" >>./build/scripts/build_command.sh
die() {
echo "$me: *** ERROR: " "${*}"
exit 1
}

write_bash_bootstrap() {
write_bash_command 'if [[ ! -f build/default/config.status ]]; then mkdir -p build/default; (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage); else ./bootstrap -w make; fi'
}
bootstrap='if [[ ! -f build/default/config.status ]]; then mkdir -p build/default; (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage); else ./bootstrap -w make; fi'

docker_run_bash_command() {
./integrations/docker/images/chip-build/run.sh "build/scripts/build_command.sh"
integrations/docker/images/"${IMAGE:-chip-build}"/run.sh bash -c "$1"
}

set -x

case "$TASK" in

# You can add more tasks here, the top one shows an example of running a build inside our build container
self-test)
docker_run_bash_command 'echo looks ok to me && echo compound commands look good'
;;

build-ubuntu-linux)
write_bash_template
write_bash_bootstrap
write_bash_command 'make -C build/default'
docker_run_bash_command
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default'
;;

build-nrf-example-lock-app)
write_bash_template
write_bash_command 'make -C examples/lock-app/nrf5'
docker_run_bash_command
docker_run_bash_command 'make VERBOSE=1 -C examples/lock-app/nrf5'
;;

build-distribution-check)
write_bash_template
write_bash_bootstrap
write_bash_command 'make -C build/default distcheck'
docker_run_bash_command
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default'
;;

run-unit-and-functional-tests)
write_bash_template
write_bash_bootstrap
write_bash_command 'make -C build/default check'
docker_run_bash_command
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default distcheck'
;;

run-code-coverage)
write_bash_template
write_bash_bootstrap
write_bash_command 'make -C build/default coverage'
docker_run_bash_command
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default coverage'
;;

run-crypto-tests)
write_bash_template
write_bash_bootstrap
write_bash_command 'make -C build/default/src/crypto check'
docker_run_bash_command
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default/src/crypto check'
;;

run-setup-payload-tests)
write_bash_template
write_bash_bootstrap
write_bash_command 'make -C build/default/src/setup_payload check'
docker_run_bash_command
docker_run_bash_command "$bootstrap"
docker_run_bash_command 'make V=1 -C build/default/src/setup_payload check'
;;

*)
Expand Down

0 comments on commit d0488aa

Please sign in to comment.