1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Replaces Travis CI with GitHub Actions (#625)

This commit is contained in:
Andrew Brogdon
2020-12-16 17:24:05 -08:00
committed by GitHub
parent 4a30a67a63
commit 83adbb883d
7 changed files with 76 additions and 195 deletions

View File

@@ -2,38 +2,15 @@
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
}
readonly LOCAL_SDK_PATH=$(getFlutterPath)
if [ -z "${LOCAL_SDK_PATH}" ]
then
echo "Failed to find the Flutter SDK!"
exit 1
fi
echo "Flutter SDK found at ${LOCAL_SDK_PATH}"
echo "Fetching dependencies and building 'flutter_module'."
pushd add_to_app/flutter_module
"${LOCAL_SDK_PATH}/bin/flutter" packages get
"${LOCAL_SDK_PATH}/bin/flutter" build aar
flutter packages get
flutter build aar
popd
echo "Fetching dependencies for 'flutter_module_using_plugin'."
pushd add_to_app/flutter_module_using_plugin
"${LOCAL_SDK_PATH}/bin/flutter" packages get
flutter packages get
popd
declare -ar ANDROID_PROJECT_NAMES=(
@@ -59,6 +36,7 @@ done
if [ ! -f "svc-keyfile.json" ]
then
echo "Keyfile for Firebase Test Lab not found. Skipping integration tests."
echo "-- Success --"
exit 0
fi
@@ -80,8 +58,8 @@ popd
echo "== Run e2e test for testing_app =="
pushd "testing_app"
readonly APP_DIR=$(pwd)
"${LOCAL_SDK_PATH}/bin/flutter" packages get
"${LOCAL_SDK_PATH}/bin/flutter" build apk
flutter packages get
flutter build apk
pushd "android"
./gradlew app:assembleAndroidTest
./gradlew app:assembleRelease -Ptarget=${APP_DIR}/test/perf_test_e2e.dart

View File

@@ -2,29 +2,6 @@
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
}
readonly LOCAL_SDK_PATH=$(getFlutterPath)
if [ -z "${LOCAL_SDK_PATH}" ]
then
echo "Failed to find the Flutter SDK!"
exit 1
fi
echo "Flutter SDK found at ${LOCAL_SDK_PATH}"
declare -ar PROJECT_NAMES=(
"add_to_app/flutter_module" \
"add_to_app/flutter_module_using_plugin" \
@@ -52,22 +29,22 @@ do
pushd "${PROJECT_NAME}"
# Grab packages.
"${LOCAL_SDK_PATH}/bin/flutter" pub get
flutter pub get
# Run the analyzer to find any static analysis issues.
"${LOCAL_SDK_PATH}/bin/flutter" analyze
flutter analyze
# Reformat the web plugin registrant, if necessary.
if [ -f "lib/generated_plugin_registrant.dart" ]
then
"${LOCAL_SDK_PATH}/bin/flutter" format "lib/generated_plugin_registrant.dart"
flutter format "lib/generated_plugin_registrant.dart"
fi
# Run the formatter on all the dart files to make sure everything's linted.
"${LOCAL_SDK_PATH}/bin/flutter" format -n --set-exit-if-changed .
flutter format -n --set-exit-if-changed .
# Run the actual tests.
"${LOCAL_SDK_PATH}/bin/flutter" test
flutter test
popd
done

View File

@@ -2,41 +2,18 @@
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
}
readonly LOCAL_SDK_PATH=$(getFlutterPath)
if [ -z "${LOCAL_SDK_PATH}" ]
then
echo "Failed to find the Flutter SDK!"
exit 1
fi
echo "Flutter SDK found at ${LOCAL_SDK_PATH}"
echo "Pre-caching ios artifacts, such as the Flutter.framework"
"${LOCAL_SDK_PATH}/bin/flutter" precache --no-web --no-linux --no-windows --no-fuchsia --no-android --no-macos
flutter precache --no-web --no-linux --no-windows --no-fuchsia --no-android --no-macos
echo "Fetching dependencies and building 'flutter_module'."
pushd add_to_app/flutter_module
"${LOCAL_SDK_PATH}/bin/flutter" packages get
"${LOCAL_SDK_PATH}/bin/flutter" build ios-framework --xcframework --output="$(pwd)/../ios_using_prebuilt_module/Flutter"
flutter packages get
flutter build ios-framework --xcframework --output="$(pwd)/../ios_using_prebuilt_module/Flutter"
popd
echo "Fetching dependencies for 'flutter_module_using_plugin'."
pushd add_to_app/flutter_module_using_plugin
"${LOCAL_SDK_PATH}/bin/flutter" packages get
flutter packages get
popd