From 698d458dc821a8ea7081f05643eb13784eb6ea88 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 6 Jun 2019 21:10:24 -0700 Subject: [PATCH] Add chrome stable to dockerfile and web shard (#33787) --- .cirrus.yml | 3 +++ dev/bots/test.dart | 41 +++++++++++++++++++++++++++++++++- dev/ci/docker_linux/Dockerfile | 7 +++++- dev/ci/docker_linux/README.md | 4 ++-- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3542241e09..3e42c4c17f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -76,6 +76,9 @@ task: container: cpu: 4 memory: 12G + - name: web_tests-linux + env: + SHARD: web_tests - name: build_tests-linux env: SHARD: build_tests diff --git a/dev/bots/test.dart b/dev/bots/test.dart index dd385822aa..cca6791157 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -22,13 +22,13 @@ final String pub = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', Pla final String pubCache = path.join(flutterRoot, '.pub-cache'); final List flutterTestArgs = []; - final bool useFlutterTestFormatter = Platform.environment['FLUTTER_TEST_FORMATTER'] == 'true'; final bool noUseBuildRunner = Platform.environment['FLUTTER_TEST_NO_BUILD_RUNNER'] == 'true'; const Map _kShards = { 'tests': _runTests, + 'web_tests': _runWebTests, 'tool_tests': _runToolTests, 'build_tests': _runBuildTests, 'coverage': _runCoverage, @@ -340,6 +340,19 @@ Future _runTests() async { print('${bold}DONE: All tests successful.$reset'); } +Future _runWebTests() async { + final List testfiles = []; + final Directory foundation = Directory(path.join(flutterRoot, 'packages', 'flutter', 'test', 'foundation')); + for (FileSystemEntity entity in foundation.listSync(recursive: true)) { + if (entity is File) { + testfiles.add(entity.path); + } + } + await _runFlutterWebTest(path.join(flutterRoot, 'packages', 'flutter'), expectFailure: true, tests: [ + path.join('test', 'foundation'), + ]); +} + Future _runCoverage() async { final File coverageFile = File(path.join(flutterRoot, 'packages', 'flutter', 'coverage', 'lcov.info')); if (!coverageFile.existsSync()) { @@ -592,6 +605,32 @@ class EvalResult { final int exitCode; } +Future _runFlutterWebTest(String workingDirectory, { + bool expectFailure = false, + bool printOutput = true, + bool skip = false, + Duration timeout = _kLongTimeout, + List tests, +}) async { + final List args = ['test', '--platform=chrome']; + if (flutterTestArgs != null && flutterTestArgs.isNotEmpty) + args.addAll(flutterTestArgs); + + args.add('--machine'); + args.addAll(tests); + + await runCommand( + flutter, + args, + workingDirectory: workingDirectory, + expectNonZeroExit: expectFailure, + timeout: timeout, + environment: { + 'FLUTTER_WEB': 'true', + }, + ); +} + Future _runFlutterTest(String workingDirectory, { String script, bool expectFailure = false, diff --git a/dev/ci/docker_linux/Dockerfile b/dev/ci/docker_linux/Dockerfile index 75f7ef6c7f..a9217e5a25 100644 --- a/dev/ci/docker_linux/Dockerfile +++ b/dev/ci/docker_linux/Dockerfile @@ -26,6 +26,10 @@ RUN apt-get install -y --no-install-recommends \ ca-certificates \ gnupg +# Add repo for chrome stable +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - +RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list + # Add nodejs repository to apt sources and install it. ENV NODEJS_INSTALL="/opt/nodejs_install" RUN mkdir -p "${NODEJS_INSTALL}" @@ -43,7 +47,8 @@ RUN apt-get install -y --no-install-recommends \ libstdc++6 \ libglu1-mesa \ build-essential \ - default-jdk-headless + default-jdk-headless \ + google-chrome-stable # Install the Android SDK Dependency. ENV ANDROID_SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" diff --git a/dev/ci/docker_linux/README.md b/dev/ci/docker_linux/README.md index bed3863a6d..a2a00b08e7 100644 --- a/dev/ci/docker_linux/README.md +++ b/dev/ci/docker_linux/README.md @@ -7,7 +7,7 @@ Google internal environment. After setup, * edit `Dockerfile` to change how the container image is built. -* run `./build_docker.sh` to build the container image. -* run `./push_docker.sh` to push the image to google cloud registry. This will +* run `./docker_build.sh` to build the container image. +* run `./docker_push.sh` to push the image to google cloud registry. This will affect our CI tests.