Ian Hickson | 449f4a6 | 2019-11-27 15:04:02 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # Copyright 2014 The Flutter Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
TL Lee | e2167b9 | 2018-09-06 17:16:22 -0400 | [diff] [blame] | 5 | |
| 6 | set -ex |
| 7 | |
| 8 | readonly SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 9 | readonly ROOT_DIR="$SCRIPTS_DIR/.." |
| 10 | |
| 11 | function is_expected_failure() { |
| 12 | # A test target was specified with the 'build' command. |
| 13 | grep --quiet "is not configured for Running" "$1" |
| 14 | } |
| 15 | |
| 16 | log_file="build_log_for_104_complete.txt" |
| 17 | build_command="flutter build bundle" |
| 18 | |
| 19 | # Attempt to build 104-complete Shrine app from the Flutter codelabs |
| 20 | git clone https://github.com/material-components/material-components-flutter-codelabs.git |
| 21 | cd material-components-flutter-codelabs/mdc_100_series/ |
| 22 | git checkout 104-complete |
| 23 | |
| 24 | all_builds_ok=1 |
| 25 | echo "$build_command" |
| 26 | $build_command 2>&1 | tee "$log_file" |
| 27 | |
| 28 | if [ ${PIPESTATUS[0]} -eq 0 ] || is_expected_failure "$log_file"; then |
| 29 | rm "$log_file" |
| 30 | else |
| 31 | all_builds_ok=0 |
| 32 | echo "View https://github.com/flutter/flutter/blob/master/dev/bots/README.md for steps to resolve this failed build test." >> ${log_file} |
| 33 | echo |
| 34 | echo "Log left in $log_file." |
| 35 | echo |
| 36 | fi |
| 37 | |
| 38 | # If any build failed, exit with a failure exit status so continuous integration |
| 39 | # tools can react appropriately. |
| 40 | if [ "$all_builds_ok" -eq 1 ]; then |
| 41 | exit 0 |
| 42 | else |
| 43 | exit 1 |
| 44 | fi |