Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3cd3bb0
Enable Android testing of package_info package
collinjackson Aug 28, 2019
0cc6c9d
Put Firebase Test Lab stuff back on CI
collinjackson Aug 28, 2019
5144071
Fix version dependency
collinjackson Aug 28, 2019
51517ac
Support for running instrumentation adapter tests with Flutter driver
collinjackson Sep 9, 2019
34d06fd
Support for running tests with Flutter driver
collinjackson Sep 9, 2019
cc1c6d8
Fix analyzer issues
collinjackson Sep 9, 2019
04adbcd
Reformat
collinjackson Sep 9, 2019
3d94829
Merge branch 'flutter_driver_support' into package_info_enable
collinjackson Sep 9, 2019
6d165da
Update to point to latest instrumentation_adapter
collinjackson Sep 9, 2019
4701e3c
Move test location
collinjackson Sep 9, 2019
8aeae1e
Merge remote-tracking branch 'origin/master' into package_info_enable
collinjackson Sep 9, 2019
2d70a4b
Combine commands
collinjackson Sep 9, 2019
538a21d
Merge remote-tracking branch 'origin/master' into package_info_enable
collinjackson Sep 9, 2019
29bb051
Require 0.1.3 version of instrumentation_adapter to ensure that iOS t…
collinjackson Sep 9, 2019
c7c648b
Redo Dockerfile
collinjackson Sep 9, 2019
c24fbe0
Add test_driver stub pointing to the test
collinjackson Sep 9, 2019
000221d
Bump for release
collinjackson Sep 11, 2019
f0115f0
Merge remote-tracking branch 'origin/master' into package_info_enable
collinjackson Sep 11, 2019
577a4e0
Merge remote-tracking branch 'origin/master' into package_info_enable
collinjackson Sep 16, 2019
7e717ad
Merge remote-tracking branch 'origin/master' into package_info_enable
collinjackson Oct 7, 2019
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
13 changes: 13 additions & 0 deletions .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
FROM cirrusci/flutter:stable

RUN sudo apt-get update && \
sudo apt-get install -y git wget curl unzip python lsb-release sudo apt-transport-https

# Add repo for gcloud sdk and install it
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \
sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
sudo apt-get update && sudo apt-get install -y google-cloud-sdk && \
gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, fewer RUNs could reduce Docker image size.

Copy link
Contributor Author

@collinjackson collinjackson Sep 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, I combined a couple of the run commands.

If we really wanted to be efficient we'd probably be building the Docker image and putting it in the cloud like the flutter/flutter repo does: https://github.com/flutter/flutter/blob/master/.cirrus.yml#L2

Not sure how much of a priority that is though.

RUN yes | sdkmanager \
"platforms;android-27" \
"build-tools;27.0.3" \
Expand Down
7 changes: 6 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ task:
- flutter channel master
- flutter upgrade
- git fetch origin master
activate_script: pub global activate flutter_plugin_tools
activate_script:
- pub global activate flutter_plugin_tools
matrix:
- name: publishable
script: ./script/check_publish.sh
Expand All @@ -30,7 +31,10 @@ task:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2"
MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[ae17cec7f4d708b1e5c2e841c3643006c2ef46f3745e28fd965bc26b224158f408a0c2da40a1beb0addb163fa4c11389]
script:
- echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json
# Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they
# might include non-ASCII characters which makes Gradle crash.
# See: https://github.com/flutter/flutter/issues/24935
Expand All @@ -43,6 +47,7 @@ task:
- export CIRRUS_COMMIT_MESSAGE=""
- ./script/incremental_build.sh build-examples --apk
- ./script/incremental_build.sh java-test # must come after apk build
- ./script/incremental_build.sh firebase-test-lab
- export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt`
- export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt`

Expand Down
4 changes: 4 additions & 0 deletions packages/package_info/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.0+8

* Update instrumentation test to use instrumentation_adapter plugin.

## 0.4.0+7

* Update and migrate iOS example project.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugins.packageinfoexample;

import androidx.test.rule.ActivityTestRule;
import dev.flutter.plugins.instrumentationadapter.FlutterRunner;
import org.junit.Rule;
import org.junit.runner.RunWith;

@RunWith(FlutterRunner.class)
public class MainActivityTest {
@Rule public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:instrumentation_adapter/instrumentation_adapter.dart';
import 'package:package_info/package_info.dart';

void main() {
InstrumentationAdapterFlutterBinding.ensureInitialized();
group('package_info test', () {
testWidgets('test package info result', (_) async {
final PackageInfo info = await PackageInfo.fromPlatform();
// These tests are based on the example app. The tests should be updated if any related info changes.
if (Platform.isAndroid) {
expect(info.appName, 'package_info_example');
expect(info.buildNumber, '1');
expect(info.packageName, 'io.flutter.plugins.packageinfoexample');
expect(info.version, '1.0');
} else if (Platform.isIOS) {
expect(info.appName, 'Package Info Example');
expect(info.buildNumber, '1');
expect(info.packageName, 'io.flutter.plugins.packageInfoExample');
expect(info.version, '1.0');
} else {
throw (UnsupportedError('platform not supported'));
}
});
});
}
1 change: 1 addition & 0 deletions packages/package_info/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
dev_dependencies:
flutter_driver:
sdk: flutter
instrumentation_adapter: "^0.1.3"
test: any

flutter:
Expand Down
30 changes: 2 additions & 28 deletions packages/package_info/example/test_driver/package_info.dart
Original file line number Diff line number Diff line change
@@ -1,31 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:package_info/package_info.dart';
import '../instrumentation_adapter/package_info.dart' as test;

void main() {
final Completer<String> completer = Completer<String>();
enableFlutterDriverExtension(handler: (_) => completer.future);
tearDownAll(() => completer.complete(null));

group('package_info test driver', () {
test('test package info result', () async {
final PackageInfo info = await PackageInfo.fromPlatform();
// These tests are based on the example app. The tests should be updated if any related info changes.
if (Platform.isAndroid) {
expect(info.appName, 'package_info_example');
expect(info.buildNumber, '1');
expect(info.packageName, 'io.flutter.plugins.packageinfoexample');
expect(info.version, '1.0');
} else if (Platform.isIOS) {
expect(info.appName, 'Package Info Example');
expect(info.buildNumber, '1');
expect(info.packageName, 'io.flutter.plugins.packageInfoExample');
expect(info.version, '1.0');
} else {
throw (UnsupportedError('platform not supported'));
}
});
});
test.main();
}
13 changes: 6 additions & 7 deletions packages/package_info/example/test_driver/package_info_test.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'dart:async';

import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';

void main() {
test('package_info', () async {
final FlutterDriver driver = await FlutterDriver.connect();
await driver.requestData(null, timeout: const Duration(minutes: 1));
driver.close();
});
Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
await driver.requestData(null, timeout: const Duration(minutes: 1));
driver.close();
}
2 changes: 1 addition & 1 deletion packages/package_info/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for querying information about the application
package, such as CFBundleVersion on iOS or versionCode on Android.
author: Flutter Team <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/package_info
version: 0.4.0+7
version: 0.4.0+8

flutter:
plugin:
Expand Down