From e2167b9f531bb4b608b32de2fcbd29b0ee84c54d Mon Sep 17 00:00:00 2001 From: TL Lee Date: Thu, 6 Sep 2018 17:16:22 -0400 Subject: [PATCH] Add build test for Flutter codelabs (#19579) * Add build test for Flutter codelabs * Fix indentation in build test script * Correct filename for the codelabs build test run by travis * Change if statement to elif * Replace echo statements with set -x * Add BSD-style license * Add codelabs build test to Cirrus * Remove codelabs_build_test from Travis. * Remove codelabs_build_test from travis_script.sh * Update documentation for codelabs_build_test.sh * Update readme for build test * Add link to open a new issue to MDC-Flutter * Add phrase to address "if you think you really need to break this test, please escalate this" --- .cirrus.yml | 5 ++++ dev/bots/README.md | 14 +++++++++++ dev/bots/codelabs_build_test.sh | 43 +++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100755 dev/bots/codelabs_build_test.sh diff --git a/.cirrus.yml b/.cirrus.yml index f5a7233b2a53d..ba45aec1d5b13 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -61,6 +61,11 @@ task: container: cpu: 4 memory: 8G + - name: codelabs-build-test + env: + SHARD: codelabs-build-test + build_test_script: ./dev/bots/codelabs_build_test.sh + task: windows_container: diff --git a/dev/bots/README.md b/dev/bots/README.md index a340fd1a34726..19ca89df908b8 100644 --- a/dev/bots/README.md +++ b/dev/bots/README.md @@ -148,3 +148,17 @@ components need to be updated or installed, follow the steps below: 6. Run upload_android_tools.py -t ndk `$ cd ../..` `$ dev/bots/upload_android_tools.py -t ndk` + +## Flutter codelabs build test + +The Flutter codelabs exercise Material Components in the form of a demo application. Note that the +code for the codelabs is similar to but distinct from the code for the Shrine demo app in Flutter Gallery. +The Flutter codelabs build test ensures that the final version of +[Material Components for Flutter Codelabs](https://github.com/material-components/material-components-flutter-codelabs) +can be built. This test serves as a smoke test for the Flutter framework and should not fail. Please +address the issue from within your PR and rerun the test. If you feel that the test failing is not a +direct result of changes made in your PR or that breaking this test is absolutely necessary, escalate this issue by +[submitting an issue](https://github.com/material-components/material-components-flutter-codelabs/issues/new?title=%5BURGENT%5D%20Flutter%20Framework%20breaking%20PR) +to the MDC-Flutter Team. + + diff --git a/dev/bots/codelabs_build_test.sh b/dev/bots/codelabs_build_test.sh new file mode 100755 index 0000000000000..721bd5c6f04c7 --- /dev/null +++ b/dev/bots/codelabs_build_test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2018 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. + +set -ex + +readonly SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly ROOT_DIR="$SCRIPTS_DIR/.." + +function is_expected_failure() { + # A test target was specified with the 'build' command. + grep --quiet "is not configured for Running" "$1" +} + +log_file="build_log_for_104_complete.txt" +build_command="flutter build bundle" + +# Attempt to build 104-complete Shrine app from the Flutter codelabs +git clone https://github.com/material-components/material-components-flutter-codelabs.git +cd material-components-flutter-codelabs/mdc_100_series/ +git checkout 104-complete + +all_builds_ok=1 +echo "$build_command" +$build_command 2>&1 | tee "$log_file" + +if [ ${PIPESTATUS[0]} -eq 0 ] || is_expected_failure "$log_file"; then + rm "$log_file" +else + all_builds_ok=0 + echo "View https://github.com/flutter/flutter/blob/master/dev/bots/README.md for steps to resolve this failed build test." >> ${log_file} + echo + echo "Log left in $log_file." + echo +fi + +# If any build failed, exit with a failure exit status so continuous integration +# tools can react appropriately. +if [ "$all_builds_ok" -eq 1 ]; then + exit 0 +else + exit 1 +fi