Skip to content

Commit acc5023

Browse files
authored
Merge pull request dart-archive/appengine#152 from dart-lang/updates
add a CI; rev version in prep for publishing
2 parents d361581 + 6c15dd8 commit acc5023

File tree

11 files changed

+127
-51
lines changed

11 files changed

+127
-51
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Dependabot configuration file.
2+
version: 2
3+
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "monthly"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build
2+
3+
on:
4+
schedule:
5+
# “At 00:00 (UTC) on Sunday.”
6+
- cron: '0 0 * * 0'
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
18+
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
19+
20+
- name: Install dependencies
21+
run: dart pub get
22+
23+
# Disabled - this would format ~492 files.
24+
# - name: Verify formatting
25+
# run: dart format --output=none --set-exit-if-changed .
26+
27+
- name: Analyze project source
28+
run: dart analyze --fatal-infos
29+
30+
- name: Run tests
31+
run: dart test

pkgs/appengine/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
## 0.13.3-dev
1+
## 0.13.3
2+
3+
* Populate the pubspec `repository` field.
4+
* Update the readme to add experimental verbiage.
25

36
## 0.13.2
47
* Gracefully handle cases where logging fails.

pkgs/appengine/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Dart support for Google AppEngine
1+
[![Build Status](https://github.com/dart-lang/appengine/workflows/Dart/badge.svg)](https://github.com/dart-lang/appengine/actions)
2+
[![pub package](https://img.shields.io/pub/v/appengine.svg)](https://pub.dev/packages/appengine)
3+
[![package publisher](https://img.shields.io/pub/publisher/appengine.svg)](https://pub.dev/packages/appengine/publisher)
4+
5+
## Dart support for Google AppEngine
26

37
This package provides support for running server applications written in Dart on
48
[Google App Engine](https://cloud.google.com/appengine/) using

pkgs/appengine/analysis_options.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
include: package:pedantic/analysis_options.1.8.0.yaml
2+
3+
analyzer:
4+
errors:
5+
# This is triggered in generated code.
6+
unnecessary_import: ignore

pkgs/appengine/lib/src/server/logging_package_adaptor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void setupAppEngineLogging() {
3737
if (level != null) {
3838
var message = record.message;
3939

40-
if (record.loggerName != null && record.loggerName.isNotEmpty) {
40+
if (record.loggerName.isNotEmpty) {
4141
message = '${record.loggerName}: $message';
4242
}
4343

pkgs/appengine/pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: appengine
2-
version: 0.13.3-dev
3-
description: >-
4-
Support for using Dart as a custom runtime on
5-
Google App Engine Flexible Environment
2+
version: 0.13.3
3+
description: >
4+
Support for using Dart as a custom runtime on Google App Engine Flexible
5+
Environment
66
repository: https://github.com/dart-lang/appengine
77

88
environment:
@@ -20,5 +20,5 @@ dependencies:
2020
stack_trace: ^1.10.0
2121

2222
dev_dependencies:
23-
test: ^1.17.5
2423
pedantic: ^1.11.0
24+
test: ^1.17.5

pkgs/appengine/test/integration/common_e2e.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ const String DEFAULT_KEY_LOCATION =
2424
'gs://dart-archive-internal/keys/dart-gcloud-e2e.json';
2525

2626
bool onBot() {
27+
// Check for GitHub Actions.
28+
if (Platform.environment['CI'] == 'true') {
29+
return true;
30+
}
31+
32+
// Redundent GitHub Actions check.
33+
if (Platform.environment.containsKey('GITHUB_ACTION')) {
34+
return true;
35+
}
36+
37+
// Chromium LUCI check.
2738
final name = Platform.isWindows ? 'USERNAME' : 'USER';
2839
return Platform.environment[name] == 'chrome-bot';
2940
}
@@ -72,9 +83,8 @@ Future<dynamic> withAuthenticator(
7283
project ??= DEFAULT_PROJECT;
7384
serviceKeyLocation ??= DEFAULT_KEY_LOCATION;
7485

75-
final keyJson =
76-
await (_serviceKeyJson(serviceKeyLocation) as FutureOr<String>);
77-
final authenticator = grpc.ServiceAccountAuthenticator(keyJson, scopes);
86+
final keyJson = await (_serviceKeyJson(serviceKeyLocation));
87+
final authenticator = grpc.ServiceAccountAuthenticator(keyJson!, scopes);
7888
return callback(project, authenticator);
7989
}
8090

pkgs/appengine/test/integration/db/metamodel_tests.dart

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,46 @@ runTests(datastore, db.DatastoreDB store, String uniquePostfix) {
5656

5757
expect(namespaces.length, greaterThanOrEqualTo(3));
5858
expect(namespaces, contains(cond((dynamic ns) => ns.name == null)));
59-
expect(namespaces, contains(cond((dynamic ns) => ns.name == 'FooNamespace')));
60-
expect(namespaces, contains(cond((dynamic ns) => ns.name == 'BarNamespace')));
59+
expect(namespaces,
60+
contains(cond((dynamic ns) => ns.name == 'FooNamespace')));
61+
expect(namespaces,
62+
contains(cond((dynamic ns) => ns.name == 'BarNamespace')));
6163

6264
try {
6365
for (final namespace in [null, 'FooNamespace', 'BarNamespace']) {
64-
final partition = store.newPartition(namespace!);
66+
// TODO: Partition.newPartition should be updated to accept null.
67+
final partition = store.newPartition(namespace ?? '');
6568
final kindQuery = store.query<Kind>(partition: partition);
6669
final List<Kind> kinds = await kindQuery.run().cast<Kind>().toList();
6770

6871
expect(kinds.length, greaterThanOrEqualTo(2));
6972
if (namespace == null) {
70-
expect(kinds,
71-
contains(cond((dynamic k) => k.name == 'NullKind$uniquePostfix')));
72-
expect(kinds,
73-
contains(cond((dynamic k) => k.name == 'NullKind2$uniquePostfix')));
73+
expect(
74+
kinds,
75+
contains(
76+
cond((dynamic k) => k.name == 'NullKind$uniquePostfix')));
77+
expect(
78+
kinds,
79+
contains(
80+
cond((dynamic k) => k.name == 'NullKind2$uniquePostfix')));
7481
} else if (namespace == 'FooNamespace') {
75-
expect(kinds,
76-
contains(cond((dynamic k) => k.name == 'FooKind$uniquePostfix')));
77-
expect(kinds,
78-
contains(cond((dynamic k) => k.name == 'FooKind2$uniquePostfix')));
82+
expect(
83+
kinds,
84+
contains(
85+
cond((dynamic k) => k.name == 'FooKind$uniquePostfix')));
86+
expect(
87+
kinds,
88+
contains(
89+
cond((dynamic k) => k.name == 'FooKind2$uniquePostfix')));
7990
} else if (namespace == 'BarNamespace') {
80-
expect(kinds,
81-
contains(cond((dynamic k) => k.name == 'BarKind$uniquePostfix')));
82-
expect(kinds,
83-
contains(cond((dynamic k) => k.name == 'BarKind2$uniquePostfix')));
91+
expect(
92+
kinds,
93+
contains(
94+
cond((dynamic k) => k.name == 'BarKind$uniquePostfix')));
95+
expect(
96+
kinds,
97+
contains(
98+
cond((dynamic k) => k.name == 'BarKind2$uniquePostfix')));
8499
}
85100
}
86101
} finally {

pkgs/appengine/test/integration/grpc_datastore_test.dart

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,44 @@
44

55
import 'dart:io';
66

7-
import 'package:test/test.dart' as test;
8-
9-
import 'package:grpc/grpc.dart' as grpc;
107
import 'package:appengine/src/grpc_api_impl/datastore_impl.dart';
118
import 'package:gcloud/db.dart' as db;
9+
import 'package:grpc/grpc.dart' as grpc;
10+
import 'package:test/test.dart' as test;
1211

13-
import 'common_e2e.dart' show withAuthenticator;
14-
import 'db/db_tests.dart' as db_tests;
15-
import 'db/metamodel_tests.dart' as metamodel_tests;
12+
import 'common_e2e.dart' show onBot, withAuthenticator;
1613
import 'raw_datastore_test_impl.dart' as datastore_tests;
1714

1815
main() async {
1916
final endpoint = 'datastore.googleapis.com';
2017

2118
final String nsPrefix = Platform.operatingSystem;
2219

23-
await withAuthenticator(OAuth2Scopes,
24-
(String project, grpc.HttpBasedAuthenticator authenticator) async {
25-
final clientChannel = grpc.ClientChannel(endpoint);
26-
final datastore = GrpcDatastoreImpl(clientChannel, authenticator, project);
27-
final dbService = db.DatastoreDB(datastore);
28-
29-
// Once all tests are done we'll close the resources.
30-
test.tearDownAll(() async {
31-
await clientChannel.shutdown();
32-
});
33-
34-
// Run low-level datastore tests.
35-
datastore_tests.runTests(
36-
datastore, '${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');
37-
38-
// Run high-level db tests.
39-
/* db_tests.runTests(
20+
test.group('grpc datastore', () {
21+
withAuthenticator(OAuth2Scopes,
22+
(String project, grpc.HttpBasedAuthenticator authenticator) async {
23+
final clientChannel = grpc.ClientChannel(endpoint);
24+
final datastore =
25+
GrpcDatastoreImpl(clientChannel, authenticator, project);
26+
// ignore: unused_local_variable
27+
final dbService = db.DatastoreDB(datastore);
28+
29+
// Once all tests are done we'll close the resources.
30+
test.tearDownAll(() async {
31+
await clientChannel.shutdown();
32+
});
33+
34+
// Run low-level datastore tests.
35+
datastore_tests.runTests(
36+
datastore, '${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');
37+
38+
// Run high-level db tests.
39+
/* db_tests.runTests(
4040
dbService, '${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');
4141
4242
// Run metamodel tests.
4343
metamodel_tests.runTests(datastore, dbService,
4444
'${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');*/
45-
});
45+
});
46+
}, skip: onBot());
4647
}

0 commit comments

Comments
 (0)