mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Adds iOS builds for add-to-app to Travis setup (#244)
This commit is contained in:
51
.travis.yml
51
.travis.yml
@@ -1,40 +1,58 @@
|
|||||||
os: linux
|
|
||||||
dist: trusty
|
|
||||||
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- libstdc++6
|
|
||||||
- fonts-noto
|
|
||||||
|
|
||||||
git:
|
git:
|
||||||
depth: 3
|
depth: 3
|
||||||
|
|
||||||
android:
|
|
||||||
components:
|
|
||||||
- build-tools-28.0.3
|
|
||||||
- android-28
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
|
- name: "iOS tests, stable channel"
|
||||||
|
os: osx
|
||||||
|
osx_image: xcode11.2
|
||||||
|
language: objective-c
|
||||||
|
script: ./tool/travis_ios_script.sh
|
||||||
|
env: FLUTTER_VERSION=stable
|
||||||
|
|
||||||
- name: "Android tests, stable channel"
|
- name: "Android tests, stable channel"
|
||||||
|
os: linux
|
||||||
|
dist: trusty
|
||||||
language: android
|
language: android
|
||||||
|
android:
|
||||||
|
components:
|
||||||
|
- build-tools-28.0.3
|
||||||
|
- android-28
|
||||||
script: ./tool/travis_android_script.sh
|
script: ./tool/travis_android_script.sh
|
||||||
env: FLUTTER_VERSION=stable
|
env: FLUTTER_VERSION=stable
|
||||||
|
|
||||||
- name: "Flutter tests, stable channel"
|
- name: "Flutter tests, stable channel"
|
||||||
|
os: linux
|
||||||
|
dist: trusty
|
||||||
language: ruby
|
language: ruby
|
||||||
script: ./tool/travis_flutter_script.sh
|
script: ./tool/travis_flutter_script.sh
|
||||||
env: FLUTTER_VERSION=stable
|
env: FLUTTER_VERSION=stable
|
||||||
|
|
||||||
|
- name: "iOS tests, beta channel"
|
||||||
|
os: osx
|
||||||
|
osx_image: xcode11.2
|
||||||
|
language: objective-c
|
||||||
|
script: ./tool/travis_ios_script.sh
|
||||||
|
env: FLUTTER_VERSION=beta
|
||||||
|
|
||||||
- name: "Android tests, beta channel"
|
- name: "Android tests, beta channel"
|
||||||
|
os: linux
|
||||||
|
dist: trusty
|
||||||
language: android
|
language: android
|
||||||
|
android:
|
||||||
|
components:
|
||||||
|
- build-tools-28.0.3
|
||||||
|
- android-28
|
||||||
script: ./tool/travis_android_script.sh
|
script: ./tool/travis_android_script.sh
|
||||||
env: FLUTTER_VERSION=beta
|
env: FLUTTER_VERSION=beta
|
||||||
|
|
||||||
- name: "Flutter tests, beta channel"
|
- name: "Flutter tests, beta channel"
|
||||||
|
os: linux
|
||||||
|
dist: trusty
|
||||||
language: ruby
|
language: ruby
|
||||||
script: ./tool/travis_flutter_script.sh
|
script: ./tool/travis_flutter_script.sh
|
||||||
env: FLUTTER_VERSION=beta
|
env: FLUTTER_VERSION=beta
|
||||||
|
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- env: FLUTTER_VERSION=beta
|
- env: FLUTTER_VERSION=beta
|
||||||
|
|
||||||
@@ -44,6 +62,7 @@ before_script:
|
|||||||
- chmod +x tool/travis_*_script.sh
|
- chmod +x tool/travis_*_script.sh
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
|
cocoapods: true
|
||||||
directories:
|
directories:
|
||||||
- $HOME/shared/.pub-cache
|
- $HOME/shared/.pub-cache
|
||||||
|
|
||||||
|
|||||||
@@ -15,28 +15,28 @@ function getFlutterPath() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
localSdkPath=$(getFlutterPath)
|
readonly LOCAL_SDK_PATH=$(getFlutterPath)
|
||||||
|
|
||||||
if [ -z "$localSdkPath" ]
|
if [ -z "${LOCAL_SDK_PATH}" ]
|
||||||
then
|
then
|
||||||
echo "Failed to find the Flutter SDK!."
|
echo "Failed to find the Flutter SDK!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Flutter SDK found at ${localSdkPath}"
|
echo "Flutter SDK found at ${LOCAL_SDK_PATH}"
|
||||||
|
|
||||||
echo "Fetching dependencies and building 'flutter_module'."
|
echo "Fetching dependencies and building 'flutter_module'."
|
||||||
pushd add_to_app/flutter_module
|
pushd add_to_app/flutter_module
|
||||||
"${localSdkPath}/bin/flutter" packages get
|
"${LOCAL_SDK_PATH}/bin/flutter" packages get
|
||||||
"${localSdkPath}/bin/flutter" build aar
|
"${LOCAL_SDK_PATH}/bin/flutter" build aar
|
||||||
popd
|
popd
|
||||||
|
|
||||||
echo "Fetching dependencies for 'flutter_module_using_plugin'."
|
echo "Fetching dependencies for 'flutter_module_using_plugin'."
|
||||||
pushd add_to_app/flutter_module_using_plugin
|
pushd add_to_app/flutter_module_using_plugin
|
||||||
"${localSdkPath}/bin/flutter" packages get
|
"${LOCAL_SDK_PATH}/bin/flutter" packages get
|
||||||
popd
|
popd
|
||||||
|
|
||||||
declare -a ANDROID_PROJECT_NAMES=(
|
declare -ar ANDROID_PROJECT_NAMES=(
|
||||||
"add_to_app/android_fullscreen" \
|
"add_to_app/android_fullscreen" \
|
||||||
"add_to_app/android_using_plugin" \
|
"add_to_app/android_using_plugin" \
|
||||||
"add_to_app/android_using_prebuilt_module" \
|
"add_to_app/android_using_prebuilt_module" \
|
||||||
@@ -44,7 +44,7 @@ declare -a ANDROID_PROJECT_NAMES=(
|
|||||||
|
|
||||||
for PROJECT_NAME in "${ANDROID_PROJECT_NAMES[@]}"
|
for PROJECT_NAME in "${ANDROID_PROJECT_NAMES[@]}"
|
||||||
do
|
do
|
||||||
echo "== Testing '${PROJECT_NAME}' on Flutter's $FLUTTER_VERSION channel =="
|
echo "== Testing '${PROJECT_NAME}' on Flutter's ${FLUTTER_VERSION} channel =="
|
||||||
pushd "${PROJECT_NAME}"
|
pushd "${PROJECT_NAME}"
|
||||||
|
|
||||||
./gradlew --stacktrace assembleDebug
|
./gradlew --stacktrace assembleDebug
|
||||||
|
|||||||
@@ -15,17 +15,17 @@ function getFlutterPath() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
localSdkPath=$(getFlutterPath)
|
readonly LOCAL_SDK_PATH=$(getFlutterPath)
|
||||||
|
|
||||||
if [ -z "$localSdkPath" ]
|
if [ -z "${LOCAL_SDK_PATH}" ]
|
||||||
then
|
then
|
||||||
echo "Failed to find the Flutter SDK!."
|
echo "Failed to find the Flutter SDK!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Flutter SDK found at ${localSdkPath}"
|
echo "Flutter SDK found at ${LOCAL_SDK_PATH}"
|
||||||
|
|
||||||
declare -a PROJECT_NAMES=(
|
declare -ar PROJECT_NAMES=(
|
||||||
"add_to_app/flutter_module" \
|
"add_to_app/flutter_module" \
|
||||||
"add_to_app/flutter_module_using_plugin" \
|
"add_to_app/flutter_module_using_plugin" \
|
||||||
"animations" \
|
"animations" \
|
||||||
@@ -43,17 +43,17 @@ declare -a PROJECT_NAMES=(
|
|||||||
|
|
||||||
for PROJECT_NAME in "${PROJECT_NAMES[@]}"
|
for PROJECT_NAME in "${PROJECT_NAMES[@]}"
|
||||||
do
|
do
|
||||||
echo "== Testing '${PROJECT_NAME}' on Flutter's $FLUTTER_VERSION channel =="
|
echo "== Testing '${PROJECT_NAME}' on Flutter's ${FLUTTER_VERSION} channel =="
|
||||||
pushd "${PROJECT_NAME}"
|
pushd "${PROJECT_NAME}"
|
||||||
|
|
||||||
# Run the analyzer to find any static analysis issues.
|
# Run the analyzer to find any static analysis issues.
|
||||||
"${localSdkPath}/bin/flutter" analyze
|
"${LOCAL_SDK_PATH}/bin/flutter" analyze
|
||||||
|
|
||||||
# Run the formatter on all the dart files to make sure everything's linted.
|
# Run the formatter on all the dart files to make sure everything's linted.
|
||||||
"${localSdkPath}/bin/flutter" format -n --set-exit-if-changed .
|
"${LOCAL_SDK_PATH}/bin/flutter" format -n --set-exit-if-changed .
|
||||||
|
|
||||||
# Run the actual tests.
|
# Run the actual tests.
|
||||||
"${localSdkPath}/bin/flutter" test
|
"${LOCAL_SDK_PATH}/bin/flutter" test
|
||||||
|
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
@@ -62,7 +62,7 @@ done
|
|||||||
# gallery have been generated using the latest gallery code.
|
# gallery have been generated using the latest gallery code.
|
||||||
echo "Run code segments check for 'gallery/gallery'."
|
echo "Run code segments check for 'gallery/gallery'."
|
||||||
pushd gallery/gallery
|
pushd gallery/gallery
|
||||||
"${localSdkPath}/bin/flutter" pub run grinder verify-code-segments
|
"${LOCAL_SDK_PATH}/bin/flutter" pub run grinder verify-code-segments
|
||||||
popd
|
popd
|
||||||
|
|
||||||
echo "-- Success --"
|
echo "-- Success --"
|
||||||
|
|||||||
94
tool/travis_ios_script.sh
Executable file
94
tool/travis_ios_script.sh
Executable file
@@ -0,0 +1,94 @@
|
|||||||
|
#!/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
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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 --output=../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
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
|
echo "== Testing 'add_to_app/ios_fullscreen' on Flutter's $FLUTTER_VERSION channel =="
|
||||||
|
pushd "add_to_app/ios_fullscreen"
|
||||||
|
|
||||||
|
pod install
|
||||||
|
|
||||||
|
xcodebuild -workspace "IOSFullScreen.xcworkspace" \
|
||||||
|
-scheme "IOSFullScreen" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO \
|
||||||
|
CODE_SIGN_IDENTITY=- EXPANDED_CODE_SIGN_IDENTITY=- \
|
||||||
|
COMPILER_INDEX_STORE_ENABLE=NO CONFIGURATION=Debug | xcpretty
|
||||||
|
|
||||||
|
xcodebuild -workspace "IOSFullScreen.xcworkspace" \
|
||||||
|
-scheme "IOSFullScreen" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO \
|
||||||
|
CODE_SIGN_IDENTITY=- EXPANDED_CODE_SIGN_IDENTITY=- \
|
||||||
|
COMPILER_INDEX_STORE_ENABLE=NO CONFIGURATION=Release \
|
||||||
|
-destination generic/platform=iOS | xcpretty
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo "== Testing 'add_to_app/ios_using_plugin' on Flutter's $FLUTTER_VERSION channel =="
|
||||||
|
pushd "add_to_app/ios_using_plugin"
|
||||||
|
|
||||||
|
pod install
|
||||||
|
|
||||||
|
xcodebuild -workspace "IOSUsingPlugin.xcworkspace" \
|
||||||
|
-scheme "IOSUsingPlugin" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO \
|
||||||
|
CODE_SIGN_IDENTITY=- EXPANDED_CODE_SIGN_IDENTITY=- \
|
||||||
|
COMPILER_INDEX_STORE_ENABLE=NO CONFIGURATION=Debug | xcpretty
|
||||||
|
|
||||||
|
xcodebuild -workspace "IOSUsingPlugin.xcworkspace" \
|
||||||
|
-scheme "IOSUsingPlugin" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO \
|
||||||
|
CODE_SIGN_IDENTITY=- EXPANDED_CODE_SIGN_IDENTITY=- \
|
||||||
|
COMPILER_INDEX_STORE_ENABLE=NO CONFIGURATION=Release \
|
||||||
|
-destination generic/platform=iOS | xcpretty
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo "== Testing 'add_to_app/ios_using_prebuilt_module' on Flutter's $FLUTTER_VERSION channel =="
|
||||||
|
pushd "add_to_app/ios_using_prebuilt_module"
|
||||||
|
|
||||||
|
xcodebuild CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO \
|
||||||
|
CODE_SIGN_IDENTITY=- EXPANDED_CODE_SIGN_IDENTITY=- \
|
||||||
|
COMPILER_INDEX_STORE_ENABLE=NO CONFIGURATION=Debug | xcpretty
|
||||||
|
|
||||||
|
xcodebuild CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO \
|
||||||
|
CODE_SIGN_IDENTITY=- EXPANDED_CODE_SIGN_IDENTITY=- \
|
||||||
|
COMPILER_INDEX_STORE_ENABLE=NO CONFIGURATION=Release \
|
||||||
|
-destination generic/platform=iOS | xcpretty
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
|
echo "-- Success --"
|
||||||
Reference in New Issue
Block a user