| Devon Carew | 1ae663b | 2018-08-06 17:39:02 -0700 | [diff] [blame] | 1 | #!/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 Tuppeny | 4f5adf8 | 2019-06-24 16:57:04 +0100 | [diff] [blame] | 8 | set -ex |
| Devon Carew | 1ae663b | 2018-08-06 17:39:02 -0700 | [diff] [blame] | 9 | |
| Kenzie Davisson | e5d14fa | 2023-11-15 13:28:59 -0800 | [diff] [blame] | 10 | source ./tool/ci/setup.sh |
| Polina Cherkasova | a5250b6 | 2022-04-19 14:52:07 -0700 | [diff] [blame] | 11 | |
| Devon Carew | 69f2531 | 2020-09-07 18:52:05 -0700 | [diff] [blame] | 12 | # Change the CI to the packages/devtools_app directory. |
| Kenzie Davisson | 9838895 | 2023-09-21 10:18:51 -0700 | [diff] [blame] | 13 | pushd $DEVTOOLS_DIR/packages/devtools_app |
| Devon Carew | 69f2531 | 2020-09-07 18:52:05 -0700 | [diff] [blame] | 14 | echo `pwd` |
| 15 | |
| Kenzie Davisson | 6e3c71f | 2023-11-08 17:53:47 -0800 | [diff] [blame] | 16 | if [ "$BOT" = "main" ]; then |
| Kenzie Schmoll | d72e269 | 2018-12-27 13:22:35 -0800 | [diff] [blame] | 17 | |
| Kenzie (Schmoll) Davisson | 01a5970 | 2022-02-04 08:29:53 -0800 | [diff] [blame] | 18 | # 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 Carew | bd54955 | 2019-01-31 14:57:41 -0800 | [diff] [blame] | 22 | |
| Devon Carew | e925827 | 2019-02-28 16:57:21 -0800 | [diff] [blame] | 23 | # Make sure the app versions are in sync. |
| Kenzie Davisson | a6de07d | 2023-09-05 16:01:07 -0700 | [diff] [blame] | 24 | devtools_tool repo-check |
| Devon Carew | e925827 | 2019-02-28 16:57:21 -0800 | [diff] [blame] | 25 | |
| Kenzie Davisson | be074aa | 2022-10-07 11:12:54 -0700 | [diff] [blame] | 26 | # Get packages |
| Kenzie Davisson | 8b3d926 | 2023-09-06 15:13:01 -0700 | [diff] [blame] | 27 | devtools_tool pub-get |
| Kenzie Davisson | be074aa | 2022-10-07 11:12:54 -0700 | [diff] [blame] | 28 | |
| Kenzie Davisson | 6e3c71f | 2023-11-08 17:53:47 -0800 | [diff] [blame] | 29 | # Analyze the code |
| 30 | devtools_tool analyze |
| 31 | |
| Kenzie Davisson | 9b8875d | 2022-11-10 08:22:50 -0800 | [diff] [blame] | 32 | elif [ "$BOT" = "build_ddc" ]; then |
| Devon Carew | 7d17ead | 2019-01-30 15:05:19 -0800 | [diff] [blame] | 33 | |
| David Shuckerow | 549b225 | 2019-10-29 15:10:03 -0700 | [diff] [blame] | 34 | # TODO(https://github.com/flutter/flutter/issues/43538): Remove workaround. |
| Danny Tuppeny | 2f1bf15 | 2021-01-07 19:11:05 +0000 | [diff] [blame] | 35 | flutter build web --pwa-strategy=none --no-tree-shake-icons |
| David Shuckerow | 549b225 | 2019-10-29 15:10:03 -0700 | [diff] [blame] | 36 | |
| Kenzie Davisson | 9b8875d | 2022-11-10 08:22:50 -0800 | [diff] [blame] | 37 | elif [ "$BOT" = "build_dart2js" ]; then |
| 38 | |
| Kenzie Davisson | 118524b | 2023-01-06 09:13:00 -0800 | [diff] [blame] | 39 | flutter build web --release --no-tree-shake-icons |
| Kenzie Davisson | 9b8875d | 2022-11-10 08:22:50 -0800 | [diff] [blame] | 40 | |
| 41 | elif [[ "$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 Shuckerow | 549b225 | 2019-10-29 15:10:03 -0700 | [diff] [blame] | 48 | |
| Daniel Chevalier | 93889a9 | 2022-11-14 09:11:15 -0500 | [diff] [blame] | 49 | 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 Davisson | 257faef | 2022-05-03 12:27:48 -0700 | [diff] [blame] | 55 | # 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 Shuckerow | 901d941 | 2020-01-13 11:10:40 -0800 | [diff] [blame] | 58 | if [ "$PLATFORM" = "vm" ]; then |
| Daniel Chevalier | 93889a9 | 2022-11-14 09:11:15 -0500 | [diff] [blame] | 59 | WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test $FILES |
| David Shuckerow | 901d941 | 2020-01-13 11:10:40 -0800 | [diff] [blame] | 60 | elif [ "$PLATFORM" = "chrome" ]; then |
| Daniel Chevalier | 93889a9 | 2022-11-14 09:11:15 -0500 | [diff] [blame] | 61 | WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --platform chrome $FILES |
| Danny Tuppeny | 5f89874 | 2020-05-14 17:18:37 +0100 | [diff] [blame] | 62 | else |
| David Shuckerow | 901d941 | 2020-01-13 11:10:40 -0800 | [diff] [blame] | 63 | echo "unknown test platform" |
| 64 | exit 1 |
| 65 | fi |
| David Shuckerow | f6217bf | 2019-10-10 09:35:54 -0700 | [diff] [blame] | 66 | |
| Kenzie Davisson | 66aa94c | 2022-12-22 19:08:39 -0800 | [diff] [blame] | 67 | # 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 Richman | caaf6ba | 2021-07-12 09:49:23 -0700 | [diff] [blame] | 70 | |
| Kenzie Davisson | 7232dac | 2023-06-30 12:22:44 -0700 | [diff] [blame] | 71 | # TODO(https://github.com/flutter/devtools/issues/1987): rewrite legacy integration tests. |
| Kenzie Davisson | 9838895 | 2023-09-21 10:18:51 -0700 | [diff] [blame] | 72 | elif [ "$BOT" = "integration_dart2js" ]; then |
| 73 | if [ "$DEVTOOLS_PACKAGE" = "devtools_app" ]; then |
| 74 | flutter pub get |
| David Shuckerow | f6217bf | 2019-10-10 09:35:54 -0700 | [diff] [blame] | 75 | |
| Kenzie Davisson | 9838895 | 2023-09-21 10:18:51 -0700 | [diff] [blame] | 76 | # 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 Shuckerow | f6217bf | 2019-10-10 09:35:54 -0700 | [diff] [blame] | 83 | |
| Kenzie Davisson | 9838895 | 2023-09-21 10:18:51 -0700 | [diff] [blame] | 84 | 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 Tuppeny | b6d384f | 2023-10-24 18:14:53 +0100 | [diff] [blame] | 90 | fi |
| Kenzie Davisson | 9838895 | 2023-09-21 10:18:51 -0700 | [diff] [blame] | 91 | 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 Davisson | 7232dac | 2023-06-30 12:22:44 -0700 | [diff] [blame] | 95 | fi |
| Devon Carew | 9226b8e | 2019-01-02 15:16:15 -0800 | [diff] [blame] | 96 | fi |
| Jacob Richman | 7eaf156 | 2019-01-30 08:02:30 -0800 | [diff] [blame] | 97 | |
| 98 | popd |