blob: 98fc27b9194c694d85e5525ed6a22bd70c84f625 [file] [log] [blame]
Devon Carew1ae663b2018-08-06 17:39:02 -07001#!/bin/bash
2
3# Copyright 2018 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Fast fail the script on failures.
Danny Tuppeny4f5adf82019-06-24 16:57:04 +01008set -ex
Devon Carew1ae663b2018-08-06 17:39:02 -07009
Kenzie Davissone5d14fa2023-11-15 13:28:59 -080010source ./tool/ci/setup.sh
Polina Cherkasovaa5250b62022-04-19 14:52:07 -070011
Devon Carew69f25312020-09-07 18:52:05 -070012# Change the CI to the packages/devtools_app directory.
Kenzie Davisson98388952023-09-21 10:18:51 -070013pushd $DEVTOOLS_DIR/packages/devtools_app
Devon Carew69f25312020-09-07 18:52:05 -070014echo `pwd`
15
Kenzie Davisson6e3c71f2023-11-08 17:53:47 -080016if [ "$BOT" = "main" ]; then
Kenzie Schmolld72e2692018-12-27 13:22:35 -080017
Kenzie (Schmoll) Davisson01a59702022-02-04 08:29:53 -080018 # Verify that dart format has been run.
19 echo "Checking formatting..."
20 # Here, we use the dart instance from the flutter sdk.
21 $(dirname $(which flutter))/dart format --output=none --set-exit-if-changed .
Devon Carewbd549552019-01-31 14:57:41 -080022
Devon Carewe9258272019-02-28 16:57:21 -080023 # Make sure the app versions are in sync.
Kenzie Davissona6de07d2023-09-05 16:01:07 -070024 devtools_tool repo-check
Devon Carewe9258272019-02-28 16:57:21 -080025
Kenzie Davissonbe074aa2022-10-07 11:12:54 -070026 # Get packages
Kenzie Davisson8b3d9262023-09-06 15:13:01 -070027 devtools_tool pub-get
Kenzie Davissonbe074aa2022-10-07 11:12:54 -070028
Kenzie Davisson6e3c71f2023-11-08 17:53:47 -080029 # Analyze the code
30 devtools_tool analyze
31
Kenzie Davisson9b8875d2022-11-10 08:22:50 -080032elif [ "$BOT" = "build_ddc" ]; then
Devon Carew7d17ead2019-01-30 15:05:19 -080033
David Shuckerow549b2252019-10-29 15:10:03 -070034 # TODO(https://github.com/flutter/flutter/issues/43538): Remove workaround.
Danny Tuppeny2f1bf152021-01-07 19:11:05 +000035 flutter build web --pwa-strategy=none --no-tree-shake-icons
David Shuckerow549b2252019-10-29 15:10:03 -070036
Kenzie Davisson9b8875d2022-11-10 08:22:50 -080037elif [ "$BOT" = "build_dart2js" ]; then
38
Kenzie Davisson118524b2023-01-06 09:13:00 -080039 flutter build web --release --no-tree-shake-icons
Kenzie Davisson9b8875d2022-11-10 08:22:50 -080040
41elif [[ "$BOT" == "test_ddc" || "$BOT" == "test_dart2js" ]]; then
42 if [ "$BOT" == "test_dart2js" ]; then
43 USE_WEBDEV_RELEASE=true
44 else
45 USE_WEBDEV_RELEASE=false
46 fi
47 echo "USE_WEBDEV_RELEASE = $USE_WEBDEV_RELEASE"
David Shuckerow549b2252019-10-29 15:10:03 -070048
Daniel Chevalier93889a92022-11-14 09:11:15 -050049 FILES="test/"
50 if [ "$ONLY_GOLDEN" = "true" ]; then
51 # Set the test files to only those containing golden test
52 FILES=$(grep -rl "matchesDevToolsGolden\|matchesGoldenFile" test | grep "_test.dart$" | tr '\n' ' ')
53 fi
54
Kenzie Davisson257faef2022-05-03 12:27:48 -070055 # TODO(https://github.com/flutter/devtools/issues/1987): once this issue is fixed,
56 # we may need to explicitly exclude running integration_tests here (this is what we
57 # used to do when integration tests were enabled).
David Shuckerow901d9412020-01-13 11:10:40 -080058 if [ "$PLATFORM" = "vm" ]; then
Daniel Chevalier93889a92022-11-14 09:11:15 -050059 WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test $FILES
David Shuckerow901d9412020-01-13 11:10:40 -080060 elif [ "$PLATFORM" = "chrome" ]; then
Daniel Chevalier93889a92022-11-14 09:11:15 -050061 WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --platform chrome $FILES
Danny Tuppeny5f898742020-05-14 17:18:37 +010062 else
David Shuckerow901d9412020-01-13 11:10:40 -080063 echo "unknown test platform"
64 exit 1
65 fi
David Shuckerowf6217bf2019-10-10 09:35:54 -070066
Kenzie Davisson66aa94c2022-12-22 19:08:39 -080067# TODO(https://github.com/flutter/devtools/issues/1987): consider running integration tests
68# for a DDC build of DevTools
69# elif [ "$BOT" = "integration_ddc" ]; then
Jacob Richmancaaf6ba2021-07-12 09:49:23 -070070
Kenzie Davisson7232dac2023-06-30 12:22:44 -070071# TODO(https://github.com/flutter/devtools/issues/1987): rewrite legacy integration tests.
Kenzie Davisson98388952023-09-21 10:18:51 -070072elif [ "$BOT" = "integration_dart2js" ]; then
73 if [ "$DEVTOOLS_PACKAGE" = "devtools_app" ]; then
74 flutter pub get
David Shuckerowf6217bf2019-10-10 09:35:54 -070075
Kenzie Davisson98388952023-09-21 10:18:51 -070076 # TODO(https://github.com/flutter/flutter/issues/118470): remove this warning.
77 echo "Preparing to run integration tests.\nWarning: if you see the exception \
78 'Web Driver Command WebDriverCommandType.screenshot failed while waiting for driver side', \
79 this is a known issue and likely means that the golden image check failed (see \
80 https://github.com/flutter/flutter/issues/118470). Run the test locally to see if new \
81 images under a 'failures/' directory are created as a result of the test run:\n\
82 $ dart run integration_test/run_tests.dart --headless"
David Shuckerowf6217bf2019-10-10 09:35:54 -070083
Kenzie Davisson98388952023-09-21 10:18:51 -070084 if [ "$DEVICE" = "flutter" ]; then
85 dart run integration_test/run_tests.dart --headless --shard="$SHARD"
86 elif [ "$DEVICE" = "flutter-web" ]; then
87 dart run integration_test/run_tests.dart --test-app-device=chrome --headless --shard="$SHARD"
88 elif [ "$DEVICE" = "dart-cli" ]; then
89 dart run integration_test/run_tests.dart --test-app-device=cli --headless --shard="$SHARD"
Danny Tuppenyb6d384f2023-10-24 18:14:53 +010090 fi
Kenzie Davisson98388952023-09-21 10:18:51 -070091 elif [ "$DEVTOOLS_PACKAGE" = "devtools_extensions" ]; then
92 pushd $DEVTOOLS_DIR/packages/devtools_extensions
93 dart run integration_test/run_tests.dart --headless
94 popd
Kenzie Davisson7232dac2023-06-30 12:22:44 -070095 fi
Devon Carew9226b8e2019-01-02 15:16:15 -080096fi
Jacob Richman7eaf1562019-01-30 08:02:30 -080097
98popd