Shard Travis job into three pieces (#8232)
This commit is contained in:
parent
a55a745c73
commit
a44d3b7f7f
@ -8,8 +8,11 @@ addons:
|
|||||||
- libstdc++6
|
- libstdc++6
|
||||||
- fonts-droid
|
- fonts-droid
|
||||||
install:
|
install:
|
||||||
- gem install coveralls-lcov
|
- ./dev/bots/travis_install.sh
|
||||||
- npm install -g firebase-tools@">=3.0.4 <3.1.0"
|
env:
|
||||||
|
- SHARD=analyze
|
||||||
|
- SHARD=tests
|
||||||
|
- SHARD=docs
|
||||||
before_script:
|
before_script:
|
||||||
- ./dev/bots/travis_setup.sh
|
- ./dev/bots/travis_setup.sh
|
||||||
script:
|
script:
|
||||||
|
@ -13,86 +13,92 @@ String flutterTestArgs = Platform.environment['FLUTTER_TEST_ARGS'];
|
|||||||
/// script using FLUTTER_TEST_ARGS=--local-engine=host_debug_unopt to
|
/// script using FLUTTER_TEST_ARGS=--local-engine=host_debug_unopt to
|
||||||
/// use your own build of the engine.
|
/// use your own build of the engine.
|
||||||
Future<Null> main() async {
|
Future<Null> main() async {
|
||||||
// Analyze all the Dart code in the repo.
|
if (Platform.environment['SHARD'] == 'docs') {
|
||||||
await _runFlutterAnalyze(flutterRoot,
|
print('\x1B[32mDONE: test.dart does nothing in the docs shard.\x1B[0m');
|
||||||
|
} else if (Platform.environment['SHARD'] == 'analyze') {
|
||||||
|
// Analyze all the Dart code in the repo.
|
||||||
|
await _runFlutterAnalyze(flutterRoot,
|
||||||
options: <String>['--flutter-repo'],
|
options: <String>['--flutter-repo'],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Verify that the tests actually return failure on failure and success on success.
|
await _runCmd(dart, <String>[p.join(flutterRoot, 'dev', 'tools', 'mega_gallery.dart')],
|
||||||
String automatedTests = p.join(flutterRoot, 'dev', 'automated_tests');
|
workingDirectory: flutterRoot,
|
||||||
await _runFlutterTest(automatedTests,
|
);
|
||||||
|
await _runFlutterAnalyze(p.join(flutterRoot, 'dev', 'benchmarks', 'mega_gallery'),
|
||||||
|
options: <String>['--watch', '--benchmark'],
|
||||||
|
);
|
||||||
|
|
||||||
|
print('\x1B[32mDONE: Analysis successful.\x1B[0m');
|
||||||
|
} else {
|
||||||
|
// Verify that the tests actually return failure on failure and success on success.
|
||||||
|
String automatedTests = p.join(flutterRoot, 'dev', 'automated_tests');
|
||||||
|
await _runFlutterTest(automatedTests,
|
||||||
script: p.join('test_smoke_test', 'fail_test.dart'),
|
script: p.join('test_smoke_test', 'fail_test.dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
);
|
);
|
||||||
await _runFlutterTest(automatedTests,
|
await _runFlutterTest(automatedTests,
|
||||||
script: p.join('test_smoke_test', 'pass_test.dart'),
|
script: p.join('test_smoke_test', 'pass_test.dart'),
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
);
|
);
|
||||||
await _runFlutterTest(automatedTests,
|
await _runFlutterTest(automatedTests,
|
||||||
script: p.join('test_smoke_test', 'crash1_test.dart'),
|
script: p.join('test_smoke_test', 'crash1_test.dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
);
|
);
|
||||||
await _runFlutterTest(automatedTests,
|
await _runFlutterTest(automatedTests,
|
||||||
script: p.join('test_smoke_test', 'crash2_test.dart'),
|
script: p.join('test_smoke_test', 'crash2_test.dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
);
|
);
|
||||||
await _runFlutterTest(automatedTests,
|
await _runFlutterTest(automatedTests,
|
||||||
script: p.join('test_smoke_test', 'syntax_error_test.broken_dart'),
|
script: p.join('test_smoke_test', 'syntax_error_test.broken_dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
);
|
);
|
||||||
await _runFlutterTest(automatedTests,
|
await _runFlutterTest(automatedTests,
|
||||||
script: p.join('test_smoke_test', 'missing_import_test.broken_dart'),
|
script: p.join('test_smoke_test', 'missing_import_test.broken_dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
);
|
);
|
||||||
await _runCmd(flutter, <String>['drive', '--use-existing-app', '-t', p.join('test_driver', 'failure.dart')],
|
await _runCmd(flutter, <String>['drive', '--use-existing-app', '-t', p.join('test_driver', 'failure.dart')],
|
||||||
workingDirectory: p.join(flutterRoot, 'packages', 'flutter_driver'),
|
workingDirectory: p.join(flutterRoot, 'packages', 'flutter_driver'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
List<String> coverageFlags = <String>[];
|
List<String> coverageFlags = <String>[];
|
||||||
if (Platform.environment['TRAVIS'] != null && Platform.environment['TRAVIS_PULL_REQUEST'] == 'false')
|
if (Platform.environment['TRAVIS'] != null && Platform.environment['TRAVIS_PULL_REQUEST'] == 'false')
|
||||||
coverageFlags.add('--coverage');
|
coverageFlags.add('--coverage');
|
||||||
|
|
||||||
// Run tests.
|
// Run tests.
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'packages', 'flutter'),
|
await _runFlutterTest(p.join(flutterRoot, 'packages', 'flutter'),
|
||||||
options: coverageFlags,
|
options: coverageFlags,
|
||||||
);
|
);
|
||||||
await _runAllDartTests(p.join(flutterRoot, 'packages', 'flutter_driver'));
|
await _runAllDartTests(p.join(flutterRoot, 'packages', 'flutter_driver'));
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'packages', 'flutter_test'));
|
await _runFlutterTest(p.join(flutterRoot, 'packages', 'flutter_test'));
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'packages', 'flutter_markdown'));
|
await _runFlutterTest(p.join(flutterRoot, 'packages', 'flutter_markdown'));
|
||||||
await _runAllDartTests(p.join(flutterRoot, 'packages', 'flutter_tools'),
|
await _runAllDartTests(p.join(flutterRoot, 'packages', 'flutter_tools'),
|
||||||
environment: <String, String>{ 'FLUTTER_ROOT': flutterRoot },
|
environment: <String, String>{ 'FLUTTER_ROOT': flutterRoot },
|
||||||
);
|
);
|
||||||
|
|
||||||
await _runAllDartTests(p.join(flutterRoot, 'dev', 'devicelab'));
|
await _runAllDartTests(p.join(flutterRoot, 'dev', 'devicelab'));
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'dev', 'manual_tests'));
|
await _runFlutterTest(p.join(flutterRoot, 'dev', 'manual_tests'));
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'examples', 'hello_world'));
|
await _runFlutterTest(p.join(flutterRoot, 'examples', 'hello_world'));
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'examples', 'layers'));
|
await _runFlutterTest(p.join(flutterRoot, 'examples', 'layers'));
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'examples', 'stocks'));
|
await _runFlutterTest(p.join(flutterRoot, 'examples', 'stocks'));
|
||||||
await _runFlutterTest(p.join(flutterRoot, 'examples', 'flutter_gallery'));
|
await _runFlutterTest(p.join(flutterRoot, 'examples', 'flutter_gallery'));
|
||||||
|
|
||||||
await _runCmd(dart, <String>[p.join(flutterRoot, 'dev', 'tools', 'mega_gallery.dart')],
|
print('\x1B[32mDONE: All tests successful.\x1B[0m');
|
||||||
workingDirectory: flutterRoot,
|
}
|
||||||
);
|
|
||||||
await _runFlutterAnalyze(p.join(flutterRoot, 'dev', 'benchmarks', 'mega_gallery'),
|
|
||||||
options: <String>['--watch', '--benchmark'],
|
|
||||||
);
|
|
||||||
|
|
||||||
print('\x1B[32mDONE: All tests successful.\x1B[0m');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> _runCmd(String executable, List<String> arguments, {
|
Future<Null> _runCmd(String executable, List<String> arguments, {
|
||||||
String workingDirectory,
|
String workingDirectory,
|
||||||
Map<String, String> environment,
|
Map<String, String> environment,
|
||||||
bool expectFailure: false,
|
bool expectFailure: false,
|
||||||
bool printOutput: true,
|
bool printOutput: true,
|
||||||
bool skip: false,
|
bool skip: false,
|
||||||
}) async {
|
}) async {
|
||||||
String cmd = '${p.relative(executable)} ${arguments.join(' ')}';
|
String cmd = '${p.relative(executable)} ${arguments.join(' ')}';
|
||||||
String relativeWorkingDir = p.relative(workingDirectory);
|
String relativeWorkingDir = p.relative(workingDirectory);
|
||||||
@ -103,8 +109,8 @@ Future<Null> _runCmd(String executable, List<String> arguments, {
|
|||||||
_printProgress('RUNNING', relativeWorkingDir, cmd);
|
_printProgress('RUNNING', relativeWorkingDir, cmd);
|
||||||
|
|
||||||
Process process = await Process.start(executable, arguments,
|
Process process = await Process.start(executable, arguments,
|
||||||
workingDirectory: workingDirectory,
|
workingDirectory: workingDirectory,
|
||||||
environment: environment,
|
environment: environment,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (printOutput) {
|
if (printOutput) {
|
||||||
@ -115,9 +121,9 @@ Future<Null> _runCmd(String executable, List<String> arguments, {
|
|||||||
int exitCode = await process.exitCode;
|
int exitCode = await process.exitCode;
|
||||||
if ((exitCode == 0) == expectFailure) {
|
if ((exitCode == 0) == expectFailure) {
|
||||||
print(
|
print(
|
||||||
'\x1B[31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1B[0m\n'
|
'\x1B[31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1B[0m\n'
|
||||||
'\x1B[1mERROR:\x1B[31m Last command exited with $exitCode (expected: ${expectFailure ? 'non-zero' : 'zero'}).\x1B[0m\n'
|
'\x1B[1mERROR:\x1B[31m Last command exited with $exitCode (expected: ${expectFailure ? 'non-zero' : 'zero'}).\x1B[0m\n'
|
||||||
'\x1B[31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1B[0m'
|
'\x1B[31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1B[0m'
|
||||||
);
|
);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -136,28 +142,28 @@ Future<Null> _runFlutterTest(String workingDirectory, {
|
|||||||
if (script != null)
|
if (script != null)
|
||||||
args.add(script);
|
args.add(script);
|
||||||
return _runCmd(flutter, args,
|
return _runCmd(flutter, args,
|
||||||
workingDirectory: workingDirectory,
|
workingDirectory: workingDirectory,
|
||||||
expectFailure: expectFailure,
|
expectFailure: expectFailure,
|
||||||
printOutput: printOutput,
|
printOutput: printOutput,
|
||||||
skip: skip || Platform.isWindows, // TODO(goderbauer): run on Windows when sky_shell is available
|
skip: skip || Platform.isWindows, // TODO(goderbauer): run on Windows when sky_shell is available
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> _runAllDartTests(String workingDirectory, {
|
Future<Null> _runAllDartTests(String workingDirectory, {
|
||||||
Map<String, String> environment,
|
Map<String, String> environment,
|
||||||
}) {
|
}) {
|
||||||
List<String> args = <String>['--checked', p.join('test', 'all.dart')];
|
List<String> args = <String>['--checked', p.join('test', 'all.dart')];
|
||||||
return _runCmd(dart, args,
|
return _runCmd(dart, args,
|
||||||
workingDirectory: workingDirectory,
|
workingDirectory: workingDirectory,
|
||||||
environment: environment,
|
environment: environment,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> _runFlutterAnalyze(String workingDirectory, {
|
Future<Null> _runFlutterAnalyze(String workingDirectory, {
|
||||||
List<String> options: const <String>[]
|
List<String> options: const <String>[]
|
||||||
}) {
|
}) {
|
||||||
return _runCmd(flutter, <String>['analyze']..addAll(options),
|
return _runCmd(flutter, <String>['analyze']..addAll(options),
|
||||||
workingDirectory: workingDirectory,
|
workingDirectory: workingDirectory,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
dev/bots/travis_install.sh
Executable file
7
dev/bots/travis_install.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
if [ -n "$TRAVIS" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||||
|
- gem install coveralls-lcov
|
||||||
|
- npm install -g firebase-tools@">=3.0.4 <3.1.0"
|
||||||
|
fi
|
@ -17,5 +17,7 @@ if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ] && [
|
|||||||
(cd packages/flutter && coveralls-lcov coverage/lcov.info)
|
(cd packages/flutter && coveralls-lcov coverage/lcov.info)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# generate the API docs, upload them
|
if [ "$SHARD" = "docs" ]; then
|
||||||
./dev/bots/docs.sh
|
# generate the API docs, upload them
|
||||||
|
./dev/bots/docs.sh
|
||||||
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user