Let Travis build the gallery and push to TestFlight / Play Store (#14408)

* iOS works

* Works on Android

* Take in commit number in iOS also. Get rid of image upload for Android. It's just a waste of bandwidth

* Tweak to fix on Travis
This commit is contained in:
xster
2018-02-05 12:00:24 -08:00
committed by GitHub
parent 9d302ac46b
commit 5b46e0a4be
9 changed files with 107 additions and 29 deletions

View File

@@ -3,5 +3,6 @@ set -ex
if [ -n "$TRAVIS" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
gem install coveralls-lcov
gem install bundler
npm install -g firebase-tools@">=3.6.1 <3.7.0"
fi

38
dev/bots/travis_script.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
set -ex
export PATH="$PWD/bin:$PWD/bin/cache/dart-sdk/bin:$PATH"
if [ "$SHARD" = "build_and_deploy_gallery" ]; then
echo "Building and deploying Flutter Gallery"
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
echo "Building Flutter Gallery for Android..."
export ANDROID_HOME=`pwd`/android-sdk
(cd examples/flutter_gallery; flutter build apk --release)
echo "Android Flutter Gallery built"
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then # TODO(xster): add back && [ "$TRAVIS_BRANCH" = "dev" ] after testing
echo "Deploying to Play Store..."
(cd examples/flutter_gallery/android; bundle exec fastlane deploy_play_store)
else
echo "Flutter Gallery is only deployed to the Play Store on merged dev branch commits"
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
echo "Building Flutter Gallery for iOS..."
(cd examples/flutter_gallery; flutter build ios --release --no-codesign)
echo "iOS Flutter Gallery built"
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then # TODO(xster): add back && [ "$TRAVIS_BRANCH" = "dev" ] after testing
echo "Re-building with distribution profile and deploying to TestFlight..."
(cd examples/flutter_gallery/ios; bundle exec fastlane build_and_deploy_testflight)
else
echo "Flutter Gallery is only deployed to the TestFlight on merged dev branch commits"
fi
fi
elif [ "$SHARD" = "docs" ]; then
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
# Generate the API docs, upload them
./dev/bots/docs.sh
fi
else
dart ./dev/bots/test.dart
fi

View File

@@ -10,6 +10,34 @@ if [ -n "$TRAVIS" ]; then
echo "Installing Google Cloud SDK..."
curl https://sdk.cloud.google.com | bash > /dev/null
echo "Google Cloud SDK installation completed."
if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$SHARD" = "build_and_deploy_gallery" ]; then
# Background for not using Travis's built-in Android tags
# https://github.com/flutter/plugins/pull/145
# Copied from https://github.com/flutter/plugins/blame/master/.travis.yml
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
mkdir android-sdk
unzip -qq sdk-tools-linux-3859397.zip -d android-sdk
export ANDROID_HOME=`pwd`/android-sdk
export PATH=`pwd`/android-sdk/tools/bin:$PATH
mkdir -p /home/travis/.android # silence sdkmanager warning
echo 'count=0' > /home/travis/.android/repositories.cfg # silence sdkmanager warning
# suppressing output of sdkmanager to keep log under 4MB (travis limit)
echo y | sdkmanager "tools" >/dev/null
echo y | sdkmanager "platform-tools" >/dev/null
echo y | sdkmanager "build-tools;26.0.3" >/dev/null
echo y | sdkmanager "platforms;android-26" >/dev/null
echo y | sdkmanager "extras;android;m2repository" >/dev/null
echo y | sdkmanager "extras;google;m2repository" >/dev/null
echo y | sdkmanager "patcher;v4" >/dev/null
sdkmanager --list
wget http://services.gradle.org/distributions/gradle-4.1-bin.zip
unzip -qq gradle-4.1-bin.zip
export GRADLE_HOME=$PWD/gradle-4.1
export PATH=$GRADLE_HOME/bin:$PATH
gradle -v
./bin/flutter doctor
fi
fi
# disable analytics on the bots and download Flutter dependencies

View File

@@ -1,11 +0,0 @@
#!/bin/bash
set -ex
export PATH="$PWD/bin:$PWD/bin/cache/dart-sdk/bin:$PATH"
if [ "$TRAVIS_OS_NAME" = "linux" ] && \
[ "$SHARD" = "docs" ]; then
# generate the API docs, upload them
./dev/bots/docs.sh
fi