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:
60
.github/workflows/main.yml
vendored
Normal file
60
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
name: Flutter CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # Every day at midnight
|
||||
|
||||
jobs:
|
||||
flutter-tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- flutter_version: dev
|
||||
allow_failure: true
|
||||
- flutter_version: beta
|
||||
allow_failure: true
|
||||
- flutter_version: stable
|
||||
allow_failure: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '12.x'
|
||||
- uses: subosito/flutter-action@v1
|
||||
with:
|
||||
channel: ${{ matrix.flutter_version }}
|
||||
- run: ./tool/flutter_ci_script.sh
|
||||
continue-on-error: ${{ matrix.allow_failure }}
|
||||
android-build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '12.x'
|
||||
- uses: subosito/flutter-action@v1
|
||||
with:
|
||||
channel: stable
|
||||
- run: ./tool/android_ci_script.sh
|
||||
ios-build:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '12.x'
|
||||
- uses: subosito/flutter-action@v1
|
||||
with:
|
||||
channel: stable
|
||||
- run: ./tool/ios_ci_script.sh
|
||||
112
.travis.yml
112
.travis.yml
@@ -1,112 +0,0 @@
|
||||
git:
|
||||
depth: 3
|
||||
|
||||
jobs:
|
||||
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
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: android
|
||||
android:
|
||||
components:
|
||||
- build-tools-28.0.3
|
||||
- android-28
|
||||
- build-tools-29.0.2
|
||||
- android-29
|
||||
script: "./tool/travis_android_script.sh"
|
||||
env: FLUTTER_VERSION=stable
|
||||
|
||||
- name: Flutter tests, stable channel
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: ruby
|
||||
script: "./tool/travis_flutter_script.sh"
|
||||
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
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: android
|
||||
android:
|
||||
components:
|
||||
- build-tools-28.0.3
|
||||
- android-28
|
||||
- build-tools-29.0.2
|
||||
- android-29
|
||||
script: "./tool/travis_android_script.sh"
|
||||
env: FLUTTER_VERSION=beta
|
||||
|
||||
- name: Flutter tests, beta channel
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: ruby
|
||||
script: "./tool/travis_flutter_script.sh"
|
||||
env: FLUTTER_VERSION=beta
|
||||
|
||||
- name: Visual samples index tests
|
||||
os: linux
|
||||
dist: trusty
|
||||
env: FLUTTER_VERSION=stable
|
||||
script:
|
||||
- cd web/samples_index
|
||||
- ../../flutter/bin/dart pub get
|
||||
- ../../flutter/bin/dart test
|
||||
|
||||
allow_failures:
|
||||
- env: FLUTTER_VERSION=beta
|
||||
|
||||
env:
|
||||
global:
|
||||
# Disabling this makes it easier to install our own copy of gcloud
|
||||
- CLOUDSDK_CORE_DISABLE_PROMPTS=1
|
||||
|
||||
before_script:
|
||||
- git clone https://github.com/flutter/flutter.git -b $FLUTTER_VERSION
|
||||
- "./flutter/bin/flutter doctor"
|
||||
- chmod +x tool/travis_*_script.sh
|
||||
|
||||
cache:
|
||||
cocoapods: true
|
||||
directories:
|
||||
- "$HOME/shared/.pub-cache"
|
||||
- "$HOME/google-cloud-sdk"
|
||||
|
||||
notifications:
|
||||
email: brogdon+github@gmail.com
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- beta
|
||||
- testing_sample
|
||||
|
||||
before_install:
|
||||
# Decrypt credentials for Firebase Test Lab service account. This key will only
|
||||
# decrypt properly when run from within the flutter/samples repo (not a PR from
|
||||
# a fork, for example), so failure is expected in some cases. The Android test
|
||||
# script is the only one that uses this value, and will account for a lack of
|
||||
# credentials.
|
||||
- openssl aes-256-cbc -K $encrypted_ccb0f43ba178_key -iv $encrypted_ccb0f43ba178_iv
|
||||
-in svc-keyfile.json.enc -out svc-keyfile.json -d || rm svc-keyfile.json || true
|
||||
- ls -la
|
||||
# Install our own copy of gcloud. This is necessary because the default copy is
|
||||
# so old it doesn't offer a firebase component.
|
||||
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf "$HOME/google-cloud-sdk";
|
||||
curl https://sdk.cloud.google.com | bash > /dev/null; fi
|
||||
- source $HOME/google-cloud-sdk/path.bash.inc
|
||||
- gcloud components update
|
||||
- gcloud version
|
||||
@@ -5,6 +5,7 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
ndkVersion "21.3.6528147"
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
applicationId "dev.flutter.example.androidfullscreen"
|
||||
|
||||
Binary file not shown.
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user