Configuring travis to build Android. (#206)

pull/208/head
Andrew Brogdon 5 years ago committed by GitHub
parent 4a01a6570e
commit 233eb462d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,8 @@
os:
- linux
sudo: false
dist: trusty
language: android
addons:
apt:
sources:
@ -8,23 +10,35 @@ addons:
packages:
- libstdc++6
- fonts-noto
git:
depth: 3
android:
components:
- build-tools-28.0.3
- android-28
env:
- FLUTTER_VERSION=stable
- FLUTTER_VERSION=beta
matrix:
jobs:
allow_failures:
- env: FLUTTER_VERSION=beta
before_script:
- git clone https://github.com/flutter/flutter.git -b $FLUTTER_VERSION
- ./flutter/bin/flutter doctor
- chmod +x travis_script.sh
script:
- ./travis_script.sh
cache:
directories:
- $HOME/shared/.pub-cache
notifications:
email:
brogdon+github@gmail.com

@ -6,7 +6,6 @@ apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "dev.flutter.example.androidfullscreen"
minSdkVersion 19

@ -6,7 +6,6 @@ apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "dev.flutter.example.androidusingplugin"
minSdkVersion 19

@ -6,7 +6,6 @@ apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "dev.flutter.example.androidusingprebuiltmodule"
minSdkVersion 19

@ -23,7 +23,7 @@ void main() {
}
/// A simple model that uses a [MethodChannel] as the source of truth for the
/// state of the counter.
/// state of a counter.
///
/// Rather than storing app state data within the Flutter module itself (where
/// the native portions of the app can't access it), this module passes messages

@ -9,13 +9,28 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_module/main.dart';
import 'package:provider/provider.dart';
class MockCounterModel extends ChangeNotifier implements CounterModel {
int _count = 0;
int get count => _count;
void increment() {
_count++;
notifyListeners();
}
}
void main() {
testWidgets('MiniView smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(
MaterialApp(
home: Contents(),
home: ChangeNotifierProvider<CounterModel>.value(
value: MockCounterModel(),
child: Contents(),
),
),
);

@ -24,7 +24,7 @@ void main() {
}
/// A simple model that uses a [MethodChannel] as the source of truth for the
/// state of the counter.
/// state of a counter.
///
/// Rather than storing app state data within the Flutter module itself (where
/// the native portions of the app can't access it), this module passes messages

@ -9,13 +9,28 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_module_using_plugin/main.dart';
import 'package:provider/provider.dart';
class MockCounterModel extends ChangeNotifier implements CounterModel {
int _count = 0;
int get count => _count;
void increment() {
_count++;
notifyListeners();
}
}
void main() {
testWidgets('MiniView smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(
MaterialApp(
home: Contents(),
home: ChangeNotifierProvider<CounterModel>.value(
value: MockCounterModel(),
child: Contents(),
),
),
);

@ -1,18 +1,31 @@
set -e
# Backs up one directory at a time, looking for one called "flutter".
# Backs up one directory at a time, looking for one called "flutter". Once it
# finds that directory, an absolute path to it is returned.
function getFlutterPath() {
local path=".."
local path=""
local counter=0
while [[ "${counter}" -lt 10 ]]; do
[ -d "${path}/flutter" ] && echo "${path}/flutter" && return 0
[ -d "${path}flutter" ] && echo "$(pwd)/${path}flutter" && return 0
let counter++
path="${path}/.."
path="${path}../"
done
}
declare -a PROJECT_NAMES=(
localSdkPath=$(getFlutterPath)
if [ -z "$localSdkPath" ]
then
echo "Failed to find the Flutter SDK!."
exit 1
fi
echo "Flutter SDK found at ${localSdkPath}"
declare -a PROJECT_NAMES=(
"add_to_app/flutter_module" \
"add_to_app/flutter_module_using_plugin" \
"animations" \
"chrome-os-best-practices" \
"gallery/gallery" \
@ -32,14 +45,6 @@ do
echo "== Testing '${PROJECT_NAME}' on Flutter's $FLUTTER_VERSION channel =="
pushd "${PROJECT_NAME}"
localSdkPath=$(getFlutterPath)
if [ -z "$localSdkPath" ]
then
echo "Failed to find Flutter SDK for '${PROJECT_NAME}'."
exit 1
fi
# Run the analyzer to find any static analysis issues.
"${localSdkPath}/bin/flutter" analyze
@ -52,4 +57,26 @@ do
popd
done
echo "Building the aar files for 'flutter_module'."
pushd add_to_app/flutter_module
"${localSdkPath}/bin/flutter" build aar
popd
declare -a ANDROID_PROJECT_NAMES=(
"add_to_app/android_fullscreen" \
"add_to_app/android_using_plugin" \
"add_to_app/android_using_prebuilt_module" \
)
for PROJECT_NAME in "${ANDROID_PROJECT_NAMES[@]}"
do
echo "== Testing '${PROJECT_NAME}' on Flutter's $FLUTTER_VERSION channel =="
pushd "${PROJECT_NAME}"
./gradlew assembleDebug
./gradlew assembleRelease
popd
done
echo "-- Success --"

Loading…
Cancel
Save