add publishing bot; rev version (dart-lang/timing#25)
* add publishing bot; rev version
* address analysis lints
diff --git a/pkgs/timing/.github/workflows/publish.yaml b/pkgs/timing/.github/workflows/publish.yaml
new file mode 100644
index 0000000..ef785c7
--- /dev/null
+++ b/pkgs/timing/.github/workflows/publish.yaml
@@ -0,0 +1,14 @@
+# A CI configuration to auto-publish pub packages.
+
+name: Publish
+
+on:
+ pull_request:
+ branches: [ master ]
+ push:
+ tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
+
+jobs:
+ publish:
+ if: ${{ github.repository_owner == 'dart-lang' }}
+ uses: devoncarew/firehose/.github/workflows/publish.yaml@main
diff --git a/pkgs/timing/CHANGELOG.md b/pkgs/timing/CHANGELOG.md
index b3bf18f..f7f3fbd 100644
--- a/pkgs/timing/CHANGELOG.md
+++ b/pkgs/timing/CHANGELOG.md
@@ -1,4 +1,4 @@
-## 1.0.1-dev
+## 1.0.1
- Require Dart `2.14`.
diff --git a/pkgs/timing/README.md b/pkgs/timing/README.md
index d34648d..0b4e87b 100644
--- a/pkgs/timing/README.md
+++ b/pkgs/timing/README.md
@@ -1,7 +1,11 @@
-# [](https://github.com/dart-lang/timing/actions?query=workflow%3A"Dart+CI"+branch%3Amaster)
+[](https://github.com/dart-lang/timing/actions/workflows/test-package.yml)
+[](https://pub.dev/packages/timing)
+[](https://pub.dev/packages/timing/publisher)
Timing is a simple package for tracking performance of both async and sync actions
+## Usage
+
```dart
var tracker = AsyncTimeTracker();
await tracker.track(() async {
@@ -12,11 +16,15 @@
print('${tracker.duration} ${tracker.innerDuration} ${tracker.slices}');
```
-
## Building
Use the following command to re-generate `lib/src/timing.g.dart` file:
```bash
-pub run build_runner build
+dart pub run build_runner build
```
+
+## Publishing automation
+
+For information about our publishing automation and process, see
+https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.
diff --git a/pkgs/timing/analysis_options.yaml b/pkgs/timing/analysis_options.yaml
index 0a90722..d978f81 100644
--- a/pkgs/timing/analysis_options.yaml
+++ b/pkgs/timing/analysis_options.yaml
@@ -1,35 +1 @@
-include: package:lints/recommended.yaml
-
-analyzer:
- language:
- strict-casts: true
-
-linter:
- rules:
- - always_declare_return_types
- - avoid_bool_literals_in_conditional_expressions
- - avoid_classes_with_only_static_members
- - avoid_dynamic_calls
- - avoid_returning_null
- - avoid_returning_this
- - avoid_unused_constructor_parameters
- - cancel_subscriptions
- - cascade_invocations
- - comment_references
- - directives_ordering
- - join_return_with_assignment
- - literal_only_boolean_expressions
- - omit_local_variable_types
- - only_throw_errors
- - package_api_docs
- - prefer_const_constructors
- - prefer_final_locals
- - prefer_interpolation_to_compose_strings
- - prefer_single_quotes
- - test_types_in_equals
- - throw_in_finally
- - unawaited_futures
- - unnecessary_lambdas
- - unnecessary_null_aware_assignments
- - unnecessary_parenthesis
- - unnecessary_statements
+include: package:dart_flutter_team_lints/analysis_options.yaml
diff --git a/pkgs/timing/lib/src/timing.dart b/pkgs/timing/lib/src/timing.dart
index 013f2f7..fae19bd 100644
--- a/pkgs/timing/lib/src/timing.dart
+++ b/pkgs/timing/lib/src/timing.dart
@@ -116,10 +116,10 @@
_stopTime = now();
}
- /// Splits tracker into two slices
+ /// Splits tracker into two slices.
///
- /// Returns new [TimeSlice] started on [startTime] and ended now.
- /// Modifies [startTime] of tracker to current time point
+ /// Returns new [TimeSlice] started on [startTime] and ended now. Modifies
+ /// [startTime] of tracker to current time point
///
/// Don't change state of tracker. Can be called only while [isTracking], and
/// tracker will sill be tracking after call.
@@ -127,9 +127,9 @@
if (!isTracking) {
throw StateError('Can be only called while tracking');
}
- final _now = now();
- final prevSlice = TimeSlice(_startTime!, _now);
- _startTime = _now;
+ final splitPoint = now();
+ final prevSlice = TimeSlice(_startTime!, splitPoint);
+ _startTime = splitPoint;
return prevSlice;
}
@@ -261,7 +261,7 @@
try {
return action();
} finally {
- // Split tracker again and discard slice that was spend in nested tracker
+ // Split tracker again and discard slice from nested tracker
parent.run(zone, timer._split);
// Add tracker back to list of slices and continue tracking
slices.add(timer);
@@ -315,7 +315,8 @@
zoneValues: {_zoneKey: this});
if (result is Future) {
return result
- // Break possible sync processing of future completion, so slice trackers can be finished
+ // Break possible sync processing of future completion, so slice
+ // trackers can be finished
.whenComplete(() => Future.value())
.whenComplete(() => _tracking = false) as T;
} else {
diff --git a/pkgs/timing/pubspec.yaml b/pkgs/timing/pubspec.yaml
index 8c19053..323c28e 100644
--- a/pkgs/timing/pubspec.yaml
+++ b/pkgs/timing/pubspec.yaml
@@ -1,5 +1,5 @@
name: timing
-version: 1.0.1-dev
+version: 1.0.1
description: >-
A simple package for tracking the performance of synchronous and asynchronous
actions.
@@ -13,6 +13,6 @@
dev_dependencies:
build_runner: ^2.0.0
- lints: ^1.0.0
+ dart_flutter_team_lints: ^0.1.0
json_serializable: ^6.0.0
test: ^1.0.0