Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
flutter-version:
# The version of Flutter to use should use the minimum Dart SDK version supported by the package,
# refer to https://docs.flutter.dev/development/tools/sdk/releases.
- "3.24.0"
- "3.32.0"
- "3.x"
test:
# E2E tests for the test command
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spdx_license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: 3.5.0
sdk: 3.8.0

- name: 📦 Install Dependencies
run: dart pub get
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: 3.5.0
sdk: 3.8.0

- name: 📦 Install Dependencies
run: dart pub get
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_optimizer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
build_hooks:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
with:
dart_sdk: 3.5.0
dart_sdk: 3.8.0
working_directory: bricks/test_optimizer/hooks

verify_bundle:
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/very_good_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: subosito/[email protected]
with:
flutter-version: 3.24.0
flutter-version: 3.32.0

- name: Install Dependencies
run: flutter pub get
Expand All @@ -50,21 +50,7 @@ jobs:
exclude: "**/*.gen.dart"

pana:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: subosito/[email protected]

- name: Install Dependencies
run: |
flutter packages get
flutter pub global activate pana

- name: Verify Pub Score
run: |
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
echo "score: $PANA_SCORE"
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
if (( $SCORE < $TOTAL )); then echo "minimum score not met!"; exit 1; fi
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
with:
min_score: 150 # Update minimum score to 160 once we have the CLI up to date.
pana_version: 0.22.21
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.5.1.0.yaml
include: package:very_good_analysis/analysis_options.yaml
analyzer:
exclude:
- "**/version.dart"
Expand Down
6 changes: 4 additions & 2 deletions bin/very_good.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Future<void> main(List<String> args) async {
/// exited already. This is useful to prevent Future chains from proceeding
/// after you've decided to exit.
Future<void> _flushThenExit(int status) {
return Future.wait<void>([stdout.close(), stderr.close()])
.then<void>((_) => exit(status));
return Future.wait<void>([
stdout.close(),
stderr.close(),
]).then<void>((_) => exit(status));
}
2 changes: 1 addition & 1 deletion bricks/test_optimizer/hooks/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml
include: package:very_good_analysis/analysis_options.yaml
linter:
rules:
public_member_api_docs: false
5 changes: 3 additions & 2 deletions bricks/test_optimizer/hooks/lib/pre_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ Future<void> run(HookContext context) async {
final testIdentifierTable = <Map<String, String>>[];
for (final entity
in testDir.listSync(recursive: true).where((entity) => entity.isTest)) {
final relativePath =
path.relative(entity.path, from: testDir.path).replaceAll(r'\', '/');
final relativePath = path
.relative(entity.path, from: testDir.path)
.replaceAll(r'\', '/');
testIdentifierTable.add({
'path': relativePath,
'identifier': identifierGenerator.next(),
Expand Down
4 changes: 2 additions & 2 deletions bricks/test_optimizer/hooks/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: hooks
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.8.0

dependencies:
mason: ^0.1.0
Expand All @@ -13,4 +13,4 @@ dependencies:
dev_dependencies:
mocktail: ^1.0.0
test: ^1.25.0
very_good_analysis: ^7.0.0
very_good_analysis: ^9.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ void main() {
ids.add(id);
}

expect(
ids.where((id) => _dartReservedKeywords.contains(id)),
isEmpty,
);
expect(ids.where((id) => _dartReservedKeywords.contains(id)), isEmpty);
expect(
ids.every((id) {
final idStart = id.codeUnitAt(0);
final isAlphabetic = (idStart >= 65 && idStart <= 90) ||
final isAlphabetic =
(idStart >= 65 && idStart <= 90) ||
(idStart >= 97 && idStart <= 122);
final isUnderscore = idStart == 95;
final isDollarSign = idStart == 36;
Expand Down
5 changes: 4 additions & 1 deletion e2e/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml
include: package:very_good_analysis/analysis_options.yaml
analyzer:
exclude:
- test/commands/test/**
12 changes: 8 additions & 4 deletions e2e/helpers/command_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void Function() _overridePrint(void Function(List<String>) fn) {
return () {
final printLogs = <String>[];
final spec = ZoneSpecification(
print: (_, __, ___, String msg) {
print: (_, _, _, String msg) {
printLogs.add(msg);
},
);
Expand All @@ -32,7 +32,8 @@ void Function() withRunner(
Logger logger,
PubUpdater pubUpdater,
List<String> printLogs,
) runnerFn,
)
runnerFn,
) {
return _overridePrint((printLogs) async {
final logger = _MockLogger();
Expand All @@ -45,8 +46,8 @@ void Function() withRunner(
environment: {'CI': 'true'},
);

when(() => progress.complete(any())).thenAnswer((_) {
final message = _.positionalArguments.elementAt(0) as String?;
when(() => progress.complete(any())).thenAnswer((invocation) {
final message = invocation.positionalArguments.first as String?;
if (message != null) progressLogs.add(message);
});
when(() => logger.progress(any())).thenReturn(progress);
Expand All @@ -56,6 +57,9 @@ void Function() withRunner(
currentVersion: any(named: 'currentVersion'),
),
).thenAnswer((_) => Future.value(true));
when(
() => pubUpdater.getLatestVersion(any()),
).thenAnswer((_) => Future.value('1.0.0'));

await runnerFn(commandRunner, logger, pubUpdater, printLogs);
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0+1
publish_to: none

environment:
sdk: ^3.5.0
sdk: ^3.8.0

dev_dependencies:
mason: ^0.1.0
Expand All @@ -13,6 +13,6 @@ dev_dependencies:
pub_updater: ^0.5.0
test: ^1.25.0
universal_io: ^2.0.4
very_good_analysis: ^7.0.0
very_good_analysis: ^9.0.0
very_good_cli:
path: ../
76 changes: 33 additions & 43 deletions e2e/test/commands/create/dart_cli/dart_cli_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,51 @@ void main() {
final tempDirectory = Directory.systemTemp.createTempSync();
addTearDown(() => tempDirectory.deleteSync(recursive: true));

final result = await commandRunner.run(
[
'create',
'dart_cli',
'my_cli',
'-o',
tempDirectory.path,
],
);
final result = await commandRunner.run([
'create',
'dart_cli',
'my_cli',
'-o',
tempDirectory.path,
]);
expect(result, equals(ExitCode.success.code));

final workingDirectory = path.join(tempDirectory.path, 'my_cli');

// add coverage to collect coverage on dart test
await expectSuccessfulProcessResult(
'dart',
['pub', 'add', 'coverage:1.2.0'],
workingDirectory: workingDirectory,
);
await expectSuccessfulProcessResult('dart', [
'pub',
'add',
'coverage:1.2.0',
], workingDirectory: workingDirectory);

await expectSuccessfulProcessResult(
'dart',
['format'],
workingDirectory: workingDirectory,
);
await expectSuccessfulProcessResult('dart', [
'format',
], workingDirectory: workingDirectory);

final analyzeResult = await expectSuccessfulProcessResult(
'flutter',
['analyze', '.'],
workingDirectory: workingDirectory,
);
final analyzeResult = await expectSuccessfulProcessResult('flutter', [
'analyze',
'.',
], workingDirectory: workingDirectory);
expect(analyzeResult.stdout, contains('No issues found!'));

final testResult = await expectSuccessfulProcessResult(
'dart',
['test', '--coverage=coverage', '--reporter=compact'],
workingDirectory: workingDirectory,
);
final testResult = await expectSuccessfulProcessResult('dart', [
'test',
'--coverage=coverage',
'--reporter=compact',
], workingDirectory: workingDirectory);
expect(testResult.stdout, contains('All tests passed!'));

// collect coverage
await expectSuccessfulProcessResult(
'dart',
[
'pub',
'run',
'coverage:format_coverage',
'--lcov',
'--in=coverage',
'--out=coverage/lcov.info',
'--packages=.dart_tool/package_config.json',
'--report-on=lib',
],
workingDirectory: workingDirectory,
);
await expectSuccessfulProcessResult('dart', [
'run',
'coverage:format_coverage',
'--lcov',
'--in=coverage',
'--out=coverage/lcov.info',
'--packages=.dart_tool/package_config.json',
'--report-on=lib',
], workingDirectory: workingDirectory);

final testCoverageResult = await expectSuccessfulProcessResult(
'genhtml',
Expand Down
71 changes: 34 additions & 37 deletions e2e/test/commands/create/dart_package/dart_pkg_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,52 @@ void main() {
final tempDirectory = Directory.systemTemp.createTempSync();
addTearDown(() => tempDirectory.deleteSync(recursive: true));

final result = await commandRunner.run(
['create', 'dart_package', 'very_good_dart', '-o', tempDirectory.path],
);
final result = await commandRunner.run([
'create',
'dart_package',
'very_good_dart',
'-o',
tempDirectory.path,
]);
expect(result, equals(ExitCode.success.code));

final workingDirectory = path.join(tempDirectory.path, 'very_good_dart');

// add coverage to collect coverage on dart test
await expectSuccessfulProcessResult(
'dart',
['pub', 'add', 'coverage:1.2.0'],
workingDirectory: workingDirectory,
);
await expectSuccessfulProcessResult('dart', [
'pub',
'add',
'coverage:1.2.0',
], workingDirectory: workingDirectory);

await expectSuccessfulProcessResult(
'dart',
['format'],
workingDirectory: workingDirectory,
);
await expectSuccessfulProcessResult('dart', [
'format',
], workingDirectory: workingDirectory);

final analyzeResult = await expectSuccessfulProcessResult(
'flutter',
['analyze', '.'],
workingDirectory: workingDirectory,
);
final analyzeResult = await expectSuccessfulProcessResult('flutter', [
'analyze',
'.',
], workingDirectory: workingDirectory);
expect(analyzeResult.stdout, contains('No issues found!'));

final testResult = await expectSuccessfulProcessResult(
'dart',
['test', '--coverage=coverage', '--reporter=compact'],
workingDirectory: workingDirectory,
);
final testResult = await expectSuccessfulProcessResult('dart', [
'test',
'--coverage=coverage',
'--reporter=compact',
], workingDirectory: workingDirectory);
expect(testResult.stdout, contains('All tests passed!'));

// collect coverage
await expectSuccessfulProcessResult(
'dart',
[
'pub',
'run',
'coverage:format_coverage',
'--lcov',
'--in=coverage',
'--out=coverage/lcov.info',
'--packages=.dart_tool/package_config.json',
'--report-on=lib',
],
workingDirectory: workingDirectory,
);
await expectSuccessfulProcessResult('dart', [
'pub',
'run',
'coverage:format_coverage',
'--lcov',
'--in=coverage',
'--out=coverage/lcov.info',
'--packages=.dart_tool/package_config.json',
'--report-on=lib',
], workingDirectory: workingDirectory);

final testCoverageResult = await expectSuccessfulProcessResult(
'genhtml',
Expand Down
Loading