forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move docs and gallery deployment to Cirrus, add Docker image for Linux (
flutter#20097) This adds a Docker image for the linux builds, replacing a lot of the setup code with a Docker build. Added a docker image build step that has the right gcloud credentials in it. Also, this finally moves the gallery deployment and docs publishing steps to Cirrus. They were dependent upon some environment setup that was a lot easier to do in Docker than in a setup bash script.
- Loading branch information
1 parent
75960f3
commit a5c2ddd
Showing
10 changed files
with
367 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# This script is only meant to be run by the Cirrus CI system, not locally. | ||
# It must be run from the root of the Flutter repo. | ||
|
||
# Collects log output in a tmpfile, but only prints it if the command fails. | ||
function log_on_fail() { | ||
local COMMAND="$@" | ||
local TMPDIR="$(mktemp -d)" | ||
local TMPFILE="$TMPDIR/command.log" | ||
local EXIT=0 | ||
if ("$@" > "$TMPFILE" 2>&1); then | ||
echo "'$COMMAND' succeeded." | ||
else | ||
EXIT=$? | ||
cat "$TMPFILE" 1>&2 | ||
echo "FAIL: '$COMMAND' exited with code $EXIT" 1>&2 | ||
fi | ||
rm -rf "$TMPDIR" | ||
return "$EXIT" | ||
} | ||
|
||
function accept_android_licenses() { | ||
yes "y" | flutter doctor --android-licenses | ||
} | ||
|
||
echo "Flutter SDK directory is: $PWD" | ||
|
||
# Run flutter to download dependencies and precompile things, and to disable | ||
# analytics on the bots. | ||
echo "Downloading build dependencies and pre-compiling Flutter snapshot" | ||
log_on_fail ./bin/flutter config --no-analytics | ||
|
||
# Run doctor, to print it to the log for debugging purposes. | ||
./bin/flutter doctor -v | ||
|
||
# Accept licenses. | ||
log_on_fail accept_android_licenses && echo "Android licenses accepted." | ||
|
||
# Run pub get in all the repo packages. | ||
echo "Updating packages for Flutter." | ||
log_on_fail ./bin/flutter update-packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
function script_location() { | ||
local script_location="${BASH_SOURCE[0]}" | ||
# Resolve symlinks | ||
while [[ -h "$script_location" ]]; do | ||
DIR="$(cd -P "$(dirname "$script_location")" >/dev/null && pwd)" | ||
script_location="$(readlink "$script_location")" | ||
[[ "$script_location" != /* ]] && script_location="$DIR/$script_location" | ||
done | ||
echo "$(cd -P "$(dirname "$script_location")" >/dev/null && pwd)" | ||
} | ||
|
||
# So that users can run this script locally from any directory and it will work as | ||
# expected. | ||
SCRIPT_LOCATION="$(script_location)" | ||
FLUTTER_ROOT="$(dirname "$(dirname "$SCRIPT_LOCATION")")" | ||
|
||
export PATH="$FLUTTER_ROOT/bin:$FLUTTER_ROOT/bin/cache/dart-sdk/bin:$PATH" | ||
|
||
set -x | ||
|
||
cd "$FLUTTER_ROOT" | ||
|
||
if [[ "$SHARD" = "deploy_gallery" ]]; then | ||
version="$(<version)" | ||
if [[ "$OS" == "linux" ]]; then | ||
echo "Building Flutter Gallery $version for Android..." | ||
export ANDROID_HOME="$PWD/android-sdk" | ||
( | ||
cd examples/flutter_gallery | ||
flutter build apk --release -t lib/main_publish.dart | ||
) | ||
echo "Android Flutter Gallery built" | ||
if [[ -z "$CIRRUS_PULL_REQUEST" && "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then | ||
echo "Deploying Flutter Gellery $version to Play Store..." | ||
( | ||
cd examples/flutter_gallery/android | ||
bundle install | ||
bundle exec fastlane deploy_play_store | ||
) | ||
else | ||
echo "Not deployed: Flutter Gallery is only deployed to the Play Store on merged and tagged dev branch commits" | ||
fi | ||
elif [[ "$OS" == "macos" ]]; then | ||
echo "Building Flutter Gallery $version for iOS..." | ||
( | ||
cd examples/flutter_gallery | ||
flutter build ios --release --no-codesign -t lib/main_publish.dart | ||
) | ||
echo "iOS Flutter Gallery built" | ||
if [[ -z "$CIRRUS_PULL_REQUEST" ]]; then | ||
if [[ "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then | ||
echo "Archiving with distribution profile and deploying to TestFlight..." | ||
( | ||
cd examples/flutter_gallery/ios | ||
bundle install | ||
bundle exec fastlane build_and_deploy_testflight upload:true | ||
) | ||
else | ||
echo "Archiving with distribution profile..." | ||
( | ||
cd examples/flutter_gallery/ios | ||
bundle install | ||
bundle exec fastlane build_and_deploy_testflight | ||
) | ||
echo "Archive is only deployed to TestFlight on tagged dev branch commits" | ||
fi | ||
else | ||
echo "Not deployed: Flutter Gallery is only deployed to TestFlight on merged and tagged dev branch commits" | ||
fi | ||
fi | ||
else | ||
echo "Doing nothing: not on the 'deploy_gallery' SHARD." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This directory includes scripts and tools for continuous integration builds and tests. |
Oops, something went wrong.