Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update example #1352

Merged
merged 2 commits into from
Jul 16, 2021
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
89 changes: 28 additions & 61 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,14 @@ jobs:
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "analyzer_and_format; linux; Dart 2.12.0; PKG: example; `dart analyze --fatal-warnings .`"
name: "analyzer_and_format; linux; Dart 2.12.0; PKG: frontend_server_client; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/[email protected]
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.12.0;packages:example;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0;packages:example
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
with:
sdk: "2.12.0"
- id: checkout
uses: actions/[email protected]
- id: example_pub_upgrade
name: example; dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: example
run: dart pub upgrade
- name: "example; dart analyze --fatal-warnings ."
if: "always() && steps.example_pub_upgrade.conclusion == 'success'"
working-directory: example
run: dart analyze --fatal-warnings .
job_003:
name: "analyzer_and_format; linux; Dart 2.12.0; PKG: frontend_server_client; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos --fatal-warnings .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/[email protected]
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.12.0;packages:frontend_server_client;commands:format-analyze_0"
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.12.0;packages:frontend_server_client;commands:format-analyze"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0;packages:frontend_server_client
os:ubuntu-latest;pub-cache-hosted;dart:2.12.0
Expand All @@ -93,19 +65,19 @@ jobs:
if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'"
working-directory: frontend_server_client
run: "dart format --output=none --set-exit-if-changed ."
- name: "frontend_server_client; dart analyze --fatal-infos --fatal-warnings ."
- name: "frontend_server_client; dart analyze --fatal-infos ."
if: "always() && steps.frontend_server_client_pub_upgrade.conclusion == 'success'"
working-directory: frontend_server_client
run: dart analyze --fatal-infos --fatal-warnings .
job_004:
name: "analyzer_and_format; linux; Dart dev; PKG: dwds; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos --fatal-warnings .`, `dart test test/build/ensure_version_test.dart`"
run: dart analyze --fatal-infos .
job_003:
name: "analyzer_and_format; linux; Dart dev; PKG: dwds; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`, `dart test test/build/ensure_version_test.dart`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/[email protected]
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:dwds;commands:format-analyze_0-test_0"
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:dwds;commands:format-analyze-test_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:dwds
os:ubuntu-latest;pub-cache-hosted;dart:dev
Expand All @@ -125,23 +97,23 @@ jobs:
if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'"
working-directory: dwds
run: "dart format --output=none --set-exit-if-changed ."
- name: "dwds; dart analyze --fatal-infos --fatal-warnings ."
- name: "dwds; dart analyze --fatal-infos ."
if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'"
working-directory: dwds
run: dart analyze --fatal-infos --fatal-warnings .
run: dart analyze --fatal-infos .
- name: dwds; dart test test/build/ensure_version_test.dart
if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'"
working-directory: dwds
run: dart test test/build/ensure_version_test.dart
job_005:
name: "analyzer_and_format; linux; Dart dev; PKGS: example, fixtures/_webdevSmoke, frontend_server_common; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos --fatal-warnings .`"
job_004:
name: "analyzer_and_format; linux; Dart dev; PKGS: example, fixtures/_webdevSmoke, frontend_server_common; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/[email protected]
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:example-fixtures/_webdevSmoke-frontend_server_common;commands:format-analyze_0"
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:example-fixtures/_webdevSmoke-frontend_server_common;commands:format-analyze"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:example-fixtures/_webdevSmoke-frontend_server_common
os:ubuntu-latest;pub-cache-hosted;dart:dev
Expand All @@ -161,10 +133,10 @@ jobs:
if: "always() && steps.example_pub_upgrade.conclusion == 'success'"
working-directory: example
run: "dart format --output=none --set-exit-if-changed ."
- name: "example; dart analyze --fatal-infos --fatal-warnings ."
- name: "example; dart analyze --fatal-infos ."
if: "always() && steps.example_pub_upgrade.conclusion == 'success'"
working-directory: example
run: dart analyze --fatal-infos --fatal-warnings .
run: dart analyze --fatal-infos .
- id: fixtures__webdevSmoke_pub_upgrade
name: fixtures/_webdevSmoke; dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
Expand All @@ -174,10 +146,10 @@ jobs:
if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'"
working-directory: fixtures/_webdevSmoke
run: "dart format --output=none --set-exit-if-changed ."
- name: "fixtures/_webdevSmoke; dart analyze --fatal-infos --fatal-warnings ."
- name: "fixtures/_webdevSmoke; dart analyze --fatal-infos ."
if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'"
working-directory: fixtures/_webdevSmoke
run: dart analyze --fatal-infos --fatal-warnings .
run: dart analyze --fatal-infos .
- id: frontend_server_common_pub_upgrade
name: frontend_server_common; dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
Expand All @@ -187,19 +159,19 @@ jobs:
if: "always() && steps.frontend_server_common_pub_upgrade.conclusion == 'success'"
working-directory: frontend_server_common
run: "dart format --output=none --set-exit-if-changed ."
- name: "frontend_server_common; dart analyze --fatal-infos --fatal-warnings ."
- name: "frontend_server_common; dart analyze --fatal-infos ."
if: "always() && steps.frontend_server_common_pub_upgrade.conclusion == 'success'"
working-directory: frontend_server_common
run: dart analyze --fatal-infos --fatal-warnings .
job_006:
name: "analyzer_and_format; linux; Dart dev; PKG: webdev; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos --fatal-warnings .`, `dart test test/build/ensure_build_test.dart`"
run: dart analyze --fatal-infos .
job_005:
name: "analyzer_and_format; linux; Dart dev; PKG: webdev; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`, `dart test test/build/ensure_build_test.dart`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/[email protected]
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:webdev;commands:format-analyze_0-test_2"
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:webdev;commands:format-analyze-test_2"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:webdev
os:ubuntu-latest;pub-cache-hosted;dart:dev
Expand All @@ -219,15 +191,15 @@ jobs:
if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'"
working-directory: webdev
run: "dart format --output=none --set-exit-if-changed ."
- name: "webdev; dart analyze --fatal-infos --fatal-warnings ."
- name: "webdev; dart analyze --fatal-infos ."
if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'"
working-directory: webdev
run: dart analyze --fatal-infos --fatal-warnings .
run: dart analyze --fatal-infos .
- name: webdev; dart test test/build/ensure_build_test.dart
if: "always() && steps.webdev_pub_upgrade.conclusion == 'success'"
working-directory: webdev
run: dart test test/build/ensure_build_test.dart
job_007:
job_006:
name: "unit_test; linux; Dart dev; PKG: dwds; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -265,8 +237,7 @@ jobs:
- job_003
- job_004
- job_005
- job_006
job_008:
job_007:
name: "unit_test; linux; Dart dev; PKG: webdev; `Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &`, `dart test -j 1`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -304,8 +275,7 @@ jobs:
- job_003
- job_004
- job_005
- job_006
job_009:
job_008:
name: "unit_test; windows; Dart dev; PKG: dwds; `dart test`"
runs-on: windows-latest
steps:
Expand All @@ -329,8 +299,7 @@ jobs:
- job_003
- job_004
- job_005
- job_006
job_010:
job_009:
name: "unit_test; windows; Dart dev; PKG: webdev; `dart test -j 1`"
runs-on: windows-latest
steps:
Expand All @@ -354,8 +323,7 @@ jobs:
- job_003
- job_004
- job_005
- job_006
job_011:
job_010:
name: Notify failure
runs-on: ubuntu-latest
if: "(github.event_name == 'push' || github.event_name == 'schedule') && failure()"
Expand All @@ -376,4 +344,3 @@ jobs:
- job_007
- job_008
- job_009
- job_010
2 changes: 1 addition & 1 deletion dwds/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ stages:
- analyzer_and_format:
- group:
- format
- analyze: --fatal-infos --fatal-warnings .
- analyze: --fatal-infos .
- test: test/build/ensure_version_test.dart
dart: dev
- unit_test:
Expand Down
5 changes: 1 addition & 4 deletions example/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ stages:
- analyzer_and_format:
- group:
- format
- analyze: --fatal-infos --fatal-warnings .
- analyze: --fatal-infos .
dart: dev
- group:
- analyze: --fatal-warnings .
dart: [2.12.0]

cache:
directories:
Expand Down
11 changes: 7 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: webdev_example_app
description: A web app example for webdev CLI.

publish_to: none

environment:
sdk: ">=2.10.0 <3.0.0"
sdk: ">=2.13.0 <3.0.0"

dev_dependencies:
build_runner: '>=1.6.2 <2.0.0'
build_web_compilers: ^2.12.0
webdev: ^2.0.0
build_runner: ^2.0.0
build_web_compilers: ^3.0.0
webdev:
path: ../webdev
2 changes: 1 addition & 1 deletion example/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
print('Hello World');
return ServiceExtensionResponse.result(json.encode({'success': true}));
});
document.body.append(SpanElement()..text = 'Hello World!!');
document.body!.append(SpanElement()..text = 'Hello World!!');

var count = 0;
Timer.periodic(const Duration(seconds: 1), (_) {
Expand Down
18 changes: 9 additions & 9 deletions example/web/scopes_main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'dart:collection';
final libraryPublicFinal = MyTestClass();

final _libraryPrivateFinal = 1;
Object libraryNull;
Object? libraryNull;
var libraryPublic = <String>['library', 'public', 'variable'];
var notAList = NotReallyAList();

Expand All @@ -28,7 +28,7 @@ void main() async {
var local = 'local in main';
var intLocalInMain = 42;
var testClass = MyTestClass();
Object localThatsNull;
Object? localThatsNull;
identityMap['a'] = 1;
identityMap['b'] = 2;
map['a'] = [1, 2, 3];
Expand Down Expand Up @@ -81,7 +81,7 @@ abstract class MyAbstractClass {
class MyTestClass<T> extends MyAbstractClass {
final String message;

String notFinal;
String? notFinal;

MyTestClass({this.message = 'world'}) {
myselfField = this;
Expand All @@ -104,7 +104,7 @@ class MyTestClass<T> extends MyAbstractClass {
//ignore: avoid_returning_this
MyTestClass get myselfGetter => this;

MyTestClass myselfField;
late final MyTestClass myselfField;

var count = 0;

Expand All @@ -129,24 +129,24 @@ class MyTestClass<T> extends MyAbstractClass {

Function closure = someFunction;

String Function() tornOff;
late final String Function() tornOff;
}

Function someFunction() => null;
Function? someFunction() => null;

// ignore: unused_element
int _libraryPrivateFunction(int a, int b) => a + b;

class NotReallyAList extends ListBase {
final List _internal;
class NotReallyAList extends ListBase<Object> {
final List<Object> _internal;

NotReallyAList() : _internal = [];

@override
Object operator [](x) => _internal[x];

@override
operator []=(x, y) => _internal[x] = y;
operator []=(int x, Object y) => _internal[x] = y;

@override
int get length => _internal.length;
Expand Down
2 changes: 1 addition & 1 deletion fixtures/_webdevSmoke/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ stages:
- analyzer_and_format:
- group:
- format
- analyze: --fatal-infos --fatal-warnings .
- analyze: --fatal-infos .
dart: dev

cache:
Expand Down
4 changes: 2 additions & 2 deletions frontend_server_client/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ stages:
- analyzer_and_format:
- group:
- format
- analyze: --fatal-infos --fatal-warnings .
dart: [2.12.0]
- analyze: --fatal-infos .
dart: [2.12.0]
4 changes: 2 additions & 2 deletions frontend_server_common/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ stages:
- analyzer_and_format:
- group:
- format
- analyze: --fatal-infos --fatal-warnings .
dart: dev
- analyze: --fatal-infos .
dart: dev
10 changes: 3 additions & 7 deletions tool/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,9 @@ for PKG in ${PKGS}; do
echo
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
case ${TASK} in
analyze_0)
echo 'dart analyze --fatal-infos --fatal-warnings .'
dart analyze --fatal-infos --fatal-warnings . || EXIT_CODE=$?
;;
analyze_1)
echo 'dart analyze --fatal-warnings .'
dart analyze --fatal-warnings . || EXIT_CODE=$?
analyze)
echo 'dart analyze --fatal-infos .'
dart analyze --fatal-infos . || EXIT_CODE=$?
;;
command)
echo 'Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &'
Expand Down
2 changes: 1 addition & 1 deletion webdev/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stages:
- analyzer_and_format:
- group:
- format
- analyze: --fatal-infos --fatal-warnings .
- analyze: --fatal-infos .
- test: test/build/ensure_build_test.dart
dart: dev
- unit_test:
Expand Down