1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

Sharding travis jobs (#239)

This commit is contained in:
Andrew Brogdon
2020-01-13 14:46:04 -08:00
committed by GitHub
parent 45c8798a0f
commit 09cb1e2687
3 changed files with 81 additions and 34 deletions

56
tool/travis_android_script.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
set -e
# 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 counter=0
while [[ "${counter}" -lt 10 ]]; do
[ -d "${path}flutter" ] && echo "$(pwd)/${path}flutter" && return 0
let counter++
path="${path}../"
done
}
localSdkPath=$(getFlutterPath)
if [ -z "$localSdkPath" ]
then
echo "Failed to find the Flutter SDK!."
exit 1
fi
echo "Flutter SDK found at ${localSdkPath}"
echo "Fetching dependencies and building 'flutter_module'."
pushd add_to_app/flutter_module
"${localSdkPath}/bin/flutter" packages get
"${localSdkPath}/bin/flutter" build aar
popd
echo "Fetching dependencies for 'flutter_module_using_plugin'."
pushd add_to_app/flutter_module_using_plugin
"${localSdkPath}/bin/flutter" packages get
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 --stacktrace assembleDebug
./gradlew --stacktrace assembleRelease
popd
done
echo "-- Success --"

69
tool/travis_flutter_script.sh Executable file
View File

@@ -0,0 +1,69 @@
#!/bin/bash
set -e
# 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 counter=0
while [[ "${counter}" -lt 10 ]]; do
[ -d "${path}flutter" ] && echo "$(pwd)/${path}flutter" && return 0
let counter++
path="${path}../"
done
}
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" \
"flutter_maps_firestore" \
"isolate_example" \
"jsonexample" \
"place_tracker" \
"platform_design"
"platform_view_swift" \
"provider_counter" \
"provider_shopper" \
"veggieseasons" \
)
for PROJECT_NAME in "${PROJECT_NAMES[@]}"
do
echo "== Testing '${PROJECT_NAME}' on Flutter's $FLUTTER_VERSION channel =="
pushd "${PROJECT_NAME}"
# Run the analyzer to find any static analysis issues.
"${localSdkPath}/bin/flutter" analyze
# Run the formatter on all the dart files to make sure everything's linted.
"${localSdkPath}/bin/flutter" format -n --set-exit-if-changed .
# Run the actual tests.
"${localSdkPath}/bin/flutter" test
popd
done
# Test that the code segment widgets that get displayed in the Flutter Material
# gallery have been generated using the latest gallery code.
echo "Run code segments check for 'gallery/gallery'."
pushd gallery/gallery
"${localSdkPath}/bin/flutter" pub run grinder verify-code-segments
popd
echo "-- Success --"