diff --git a/.travis.yml b/.travis.yml index 5571c0129..b360a72d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -# Created with package:mono_repo v2.2.0 +# Created with package:mono_repo v2.3.0 language: dart # Custom configuration @@ -6,13 +6,7 @@ sudo: required addons: chrome: stable before_install: - - "export CHROMEDRIVER_BINARY=/usr/bin/google-chrome" - - "export CHROMEDRIVER_ARGS=--no-sandbox" - - "/usr/bin/google-chrome --version" - - "export CHROME_LATEST_VERSION=$(/usr/bin/google-chrome --version | cut -d' ' -f3 | cut -d'.' -f1)" - - "export CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_LATEST_VERSION)" - - "wget https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip" - - unzip chromedriver_linux64.zip + - tool/travis_setup.sh - "export PATH=$PATH:$PWD" after_failure: - tool/report_failure.sh @@ -24,31 +18,49 @@ jobs: - stage: analyzer_and_format name: "SDK: 2.5.0; PKGS: dwds, example, webdev; TASKS: `dartanalyzer --fatal-warnings .`" dart: "2.5.0" + os: linux env: PKGS="dwds example webdev" script: ./tool/travis.sh dartanalyzer_1 - stage: analyzer_and_format name: "SDK: dev; PKGS: dwds, example, webdev; TASKS: [`dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-infos --fatal-warnings .`]" dart: dev + os: linux env: PKGS="dwds example webdev" script: ./tool/travis.sh dartfmt dartanalyzer_0 - stage: unit_test name: "SDK: 2.5.0; PKG: dwds; TASKS: `pub run test`" dart: "2.5.0" + os: linux env: PKGS="dwds" script: ./tool/travis.sh test_0 - stage: unit_test name: "SDK: stable; PKG: dwds; TASKS: `pub run test`" dart: stable + os: linux + env: PKGS="dwds" + script: ./tool/travis.sh test_0 + - stage: unit_test + name: "SDK: stable; PKG: dwds; TASKS: `pub run test`" + dart: stable + os: windows env: PKGS="dwds" script: ./tool/travis.sh test_0 - stage: unit_test name: "SDK: 2.5.0; PKG: webdev; TASKS: `pub run test -j 1`" dart: "2.5.0" + os: linux + env: PKGS="webdev" + script: ./tool/travis.sh test_1 + - stage: unit_test + name: "SDK: stable; PKG: webdev; TASKS: `pub run test -j 1`" + dart: stable + os: linux env: PKGS="webdev" script: ./tool/travis.sh test_1 - stage: unit_test name: "SDK: stable; PKG: webdev; TASKS: `pub run test -j 1`" dart: stable + os: windows env: PKGS="webdev" script: ./tool/travis.sh test_1 diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 6735a500b..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -branches: - only: - - master - -version: '1.0.{build}' - -install: - - ps: wget https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip - - cmd: echo "Unzipping dart-sdk..." - - cmd: 7z x dart-sdk.zip -o"C:\tools" -y > nul - - set PATH=%PATH%;%APPDATA%\Pub\Cache\bin - - cd webdev - - C:\tools\dart-sdk\bin\pub.bat get && exit 0 - -build: off - -test_script: - - C:\tools\dart-sdk\bin\pub.bat run test -j 1 - -cache: - - C:\Users\appveyor\AppData\Roaming\Pub\Cache diff --git a/dwds/chromedriver.exe b/dwds/chromedriver.exe new file mode 100644 index 000000000..ae807724b Binary files /dev/null and b/dwds/chromedriver.exe differ diff --git a/dwds/mono_pkg.yaml b/dwds/mono_pkg.yaml index 15671a17d..e622cd5b0 100644 --- a/dwds/mono_pkg.yaml +++ b/dwds/mono_pkg.yaml @@ -14,3 +14,6 @@ stages: dart: [2.5.0] - unit_test: - test: + - test: + os: windows + dart: stable diff --git a/dwds/test/chrome_proxy_service_test.dart b/dwds/test/chrome_proxy_service_test.dart index fafff52f4..2c0f8e2ec 100644 --- a/dwds/test/chrome_proxy_service_test.dart +++ b/dwds/test/chrome_proxy_service_test.dart @@ -107,6 +107,8 @@ void main() { await service.removeBreakpoint(isolate.id, bp.id); expect(isolate.breakpoints, isEmpty); }); + }, onPlatform: { + 'windows': const Skip('https://github.com/dart-lang/webdev/issues/711'), }); group('callServiceExtension', () { @@ -374,6 +376,8 @@ void main() { expect(scriptRef.uri, endsWith('.dart')); expect(script.tokenPosTable, isNotEmpty); } + }, onPlatform: { + 'windows': const Skip('https://github.com/dart-lang/webdev/issues/711'), }); }); @@ -391,6 +395,8 @@ void main() { scripts.scripts.map((s) => s.uri), contains(endsWith('part.dart'))); expect(scripts.scripts.map((s) => s.uri), contains('package:intl/src/intl/date_format_helpers.dart')); + }, onPlatform: { + 'windows': const Skip('https://github.com/dart-lang/webdev/issues/711'), }); test('clearVMTimeline', () { @@ -466,6 +472,8 @@ void main() { expect(first.code.kind, 'Dart'); expect(first.code.name, ''); }); + }, onPlatform: { + 'windows': const Skip('https://github.com/dart-lang/webdev/issues/711'), }); group('getStack', () { @@ -537,6 +545,8 @@ void main() { // Resume the isolate to not impact other tests. await service.resume(isolateId); }); + }, onPlatform: { + 'windows': const Skip('https://github.com/dart-lang/webdev/issues/711'), }); test('getVM', () async { diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 13b1e8e4d..aa43b3b7d 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -2,6 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'dart:io'; import 'package:path/path.dart' as p; diff --git a/dwds/test/dart_uri_test.dart b/dwds/test/dart_uri_test.dart index bb4c710e2..fa9f86bd1 100644 --- a/dwds/test/dart_uri_test.dart +++ b/dwds/test/dart_uri_test.dart @@ -2,6 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'package:dwds/src/utilities/dart_uri.dart'; import 'package:test/test.dart'; diff --git a/dwds/test/debug_extension_test.dart b/dwds/test/debug_extension_test.dart index cafff403d..78f56744d 100644 --- a/dwds/test/debug_extension_test.dart +++ b/dwds/test/debug_extension_test.dart @@ -5,6 +5,9 @@ // When run locally this test may require a manifest key. This makes it easy to // just skip it. @Tags(['extension']) +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'package:test/test.dart'; import 'fixtures/context.dart'; diff --git a/dwds/test/debug_service_test.dart b/dwds/test/debug_service_test.dart index 0fb321727..44c408f07 100644 --- a/dwds/test/debug_service_test.dart +++ b/dwds/test/debug_service_test.dart @@ -2,6 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'dart:io'; import 'package:test/test.dart'; diff --git a/dwds/test/devtools_test.dart b/dwds/test/devtools_test.dart index d7273754b..15de53149 100644 --- a/dwds/test/devtools_test.dart +++ b/dwds/test/devtools_test.dart @@ -3,6 +3,10 @@ // BSD-style license that can be found in the LICENSE file. @Timeout(Duration(minutes: 5)) +@TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'package:test/test.dart'; import 'package:webdriver/io.dart'; diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 52797a291..7f3e1c0a7 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; +import 'dart:convert'; import 'dart:io'; import 'package:build_daemon/client.dart'; @@ -20,6 +21,9 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'server.dart'; import 'utilities.dart'; +final _batExt = Platform.isWindows ? '.bat' : ''; +final _exeExt = Platform.isWindows ? '.exe' : ''; + class TestContext { String appUrl; WipConnection tabConnection; @@ -70,16 +74,24 @@ class TestContext { enableDebugExtension ??= false; autoRun ??= true; enableDebugging ??= true; - port = await findUnusedPort(); + var chromeDriverPort = await findUnusedPort(); + var chromeDriverUrlBase = 'wd/hub'; try { - chromeDriver = await Process.start( - 'chromedriver', ['--port=4444', '--url-base=wd/hub']); + chromeDriver = await Process.start('chromedriver$_exeExt', + ['--port=$chromeDriverPort', '--url-base=$chromeDriverUrlBase']); + // On windows this takes a while to boot up, wait for the first line + // of stdout as a signal that it is ready. + await chromeDriver.stdout + .transform(utf8.decoder) + .transform(const LineSplitter()) + .first; } catch (e) { throw StateError( 'Could not start ChromeDriver. Is it installed?\nError: $e'); } - await Process.run('pub', ['get'], workingDirectory: workingDirectory); + await Process.run('pub$_batExt', ['upgrade'], + workingDirectory: workingDirectory); daemonClient = await connectClient( workingDirectory, [], (log) => printOnFailure(log.toString())); @@ -109,10 +121,14 @@ class TestContext { ] } }); - webDriver = - await createDriver(spec: WebDriverSpec.JsonWire, desired: capabilities); + webDriver = await createDriver( + spec: WebDriverSpec.JsonWire, + desired: capabilities, + uri: Uri.parse( + 'http://127.0.0.1:$chromeDriverPort/$chromeDriverUrlBase/')); var connection = ChromeConnection('localhost', debugPort); + port = await findUnusedPort(); testServer = await TestServer.start( port, daemonPort(workingDirectory), @@ -146,12 +162,12 @@ class TestContext { } Future tearDown() async { + await webDriver?.quit(); + chromeDriver?.kill(); DartUri.currentDirectory = p.current; _entryFile.writeAsStringSync(_entryContents); await daemonClient?.close(); await testServer?.stop(); - await webDriver?.quit(); - chromeDriver.kill(); } Future changeInput() async { diff --git a/dwds/test/refresh_test.dart b/dwds/test/refresh_test.dart index 4a62b74ef..b0fed48e6 100644 --- a/dwds/test/refresh_test.dart +++ b/dwds/test/refresh_test.dart @@ -4,9 +4,12 @@ /// Tests that require a fresh context to run, and can interfere with other /// tests. +@TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) library refresh_test; -@TestOn('vm') import 'dart:async'; import 'package:dwds/src/connections/debug_connection.dart'; diff --git a/dwds/test/reload_test.dart b/dwds/test/reload_test.dart index bb02aee0b..073a778db 100644 --- a/dwds/test/reload_test.dart +++ b/dwds/test/reload_test.dart @@ -2,7 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('vm') @Timeout(Duration(minutes: 5)) +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'package:dwds/dwds.dart'; import 'package:test/test.dart'; diff --git a/dwds/test/variable_scope_test.dart b/dwds/test/variable_scope_test.dart index eed267096..72d11da2b 100644 --- a/dwds/test/variable_scope_test.dart +++ b/dwds/test/variable_scope_test.dart @@ -2,8 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:dwds/src/connections/debug_connection.dart'; @TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) +import 'package:dwds/src/connections/debug_connection.dart'; import 'package:dwds/src/services/chrome_proxy_service.dart'; import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart'; diff --git a/mono_repo.yaml b/mono_repo.yaml index d9f0c7400..d6059cce1 100644 --- a/mono_repo.yaml +++ b/mono_repo.yaml @@ -4,14 +4,8 @@ travis: addons: chrome: stable before_install: - - "export CHROMEDRIVER_BINARY=/usr/bin/google-chrome" - - "export CHROMEDRIVER_ARGS=--no-sandbox" - - "/usr/bin/google-chrome --version" - - "export CHROME_LATEST_VERSION=$(/usr/bin/google-chrome --version | cut -d' ' -f3 | cut -d'.' -f1)" - - "export CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_LATEST_VERSION)" - - "wget https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip" - - "unzip chromedriver_linux64.zip" - - "export PATH=$PATH:$PWD" + - tool/travis_setup.sh + - export PATH=$PATH:$PWD after_failure: - tool/report_failure.sh services: diff --git a/tool/travis.sh b/tool/travis.sh index e2c0aaee9..c6bcc8d67 100755 --- a/tool/travis.sh +++ b/tool/travis.sh @@ -1,5 +1,28 @@ #!/bin/bash -# Created with package:mono_repo v2.2.0 +# Created with package:mono_repo v2.3.0 + +# Support built in commands on windows out of the box. +function pub { + if [[ $TRAVIS_OS_NAME == "windows" ]]; then + command pub.bat "$@" + else + command pub "$@" + fi +} +function dartfmt { + if [[ $TRAVIS_OS_NAME == "windows" ]]; then + command dartfmt.bat "$@" + else + command dartfmt "$@" + fi +} +function dartanalyzer { + if [[ $TRAVIS_OS_NAME == "windows" ]]; then + command dartanalyzer.bat "$@" + else + command dartanalyzer "$@" + fi +} if [[ -z ${PKGS} ]]; then echo -e '\033[31mPKGS environment variable must be set!\033[0m' diff --git a/tool/travis_setup.sh b/tool/travis_setup.sh new file mode 100755 index 000000000..6c758248c --- /dev/null +++ b/tool/travis_setup.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +if [[ $TRAVIS_OS_NAME == "windows" ]]; then + echo Installing Google Chrome Stable... + # Install Chrome via Chocolatey while `addons: chrome` doesn't seem to work on Windows yet + # https://travis-ci.community/t/installing-google-chrome-stable-but-i-cant-find-it-anywhere/2118 + choco install googlechrome --acceptlicense --yes --no-progress --ignore-checksums + + PROGRAMFILES_X86="$(cmd //c 'echo %ProgramFILES(x86)%')" + CHROME_PATH="Google\Chrome\Application\chrome.exe" + if [ -f "$PROGRAMFILES\\$CHROME_PATH" ]; then + echo "Found chrome at $PROGRAMFILES\\$CHROME_PATH" + export CHROMEDRIVER_BINARY="$PROGRAMFILES\\$CHROME_PATH" + elif [ -f "$PROGRAMFILES_X86\\$CHROME_PATH" ]; then + echo "Found chrome at $PROGRAMFILES_X86\\$CHROME_PATH" + export CHROMEDRIVER_BINARY="$PROGRAMFILES_X86\\$CHROME_PATH" + elif [ -f "$LOCALAPPDATA\\$CHROME_PATH" ]; then + echo "Found chrome at $LOCALAPPDATA\\$CHROME_PATH" + export CHROMEDRIVER_BINARY="$LOCALAPPDATA\\$CHROME_PATH" + else + echo "Unable to find chrome!" + exit 1 + fi + export CHROMEDRIVER_OS=win32 +else + export CHROMEDRIVER_BINARY=/usr/bin/google-chrome + export CHROMEDRIVER_OS=linux64 +fi + +# Temporary hack - the commented line below hangs on windows +export CHROME_LATEST_VERSION=77 +# export CHROME_LATEST_VERSION=$("$CHROMEDRIVER_BINARY" --version | cut -d' ' -f3 | cut -d'.' -f1) +export CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_LATEST_VERSION) +wget https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_$CHROMEDRIVER_OS.zip +unzip "chromedriver_${CHROMEDRIVER_OS}.zip" + +export CHROMEDRIVER_ARGS=--no-sandbox + +if [[ $TRAVIS_OS_NAME == "windows" ]]; then + export PATH=$PATH:$APPDATA/Roaming/Pub/Cache/bin +else + export PATH=$PATH:~/.pub-cache/bin +fi diff --git a/webdev/mono_pkg.yaml b/webdev/mono_pkg.yaml index 382c1bc32..5dfe2aa03 100644 --- a/webdev/mono_pkg.yaml +++ b/webdev/mono_pkg.yaml @@ -14,3 +14,6 @@ stages: dart: [2.5.0] - unit_test: - test: -j 1 + - test: -j 1 + os: windows + dart: stable diff --git a/webdev/test/build/ensure_build_test.dart b/webdev/test/build/ensure_build_test.dart index 77d818bb0..9c844c9dd 100644 --- a/webdev/test/build/ensure_build_test.dart +++ b/webdev/test/build/ensure_build_test.dart @@ -2,6 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'package:build_verify/build_verify.dart'; import 'package:test/test.dart'; diff --git a/webdev/test/readme_test.dart b/webdev/test/readme_test.dart index e8f241c33..0f57f0f96 100644 --- a/webdev/test/readme_test.dart +++ b/webdev/test/readme_test.dart @@ -2,6 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +@TestOn('vm') +@OnPlatform({ + 'windows': Skip('https://github.com/dart-lang/webdev/issues/711'), +}) import 'dart:async'; import 'dart:convert'; import 'dart:io';