Skip to content

Commit c0c2fec

Browse files
authored
Travis configuration (google#5)
* Travis configuration * Add scripts * Fix build badges
1 parent d5446c7 commit c0c2fec

5 files changed

+125
-42
lines changed

.travis.yml

+52-42
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ matrix:
1414
- libstdc++6
1515
- fonts-droid
1616
before_script:
17-
- git clone https://github.com/flutter/flutter.git --depth 1
17+
- git clone https://github.com/flutter/flutter.git
1818
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
1919
- flutter doctor
2020
- pub global activate flutter_plugin_tools
2121
script:
22-
- ./script/plugin_tools.sh analyze
22+
- ./script/incremental_build.sh analyze
2323
# Job 2) Check format and run tests
2424
- os: linux
2525
env:
@@ -37,17 +37,18 @@ matrix:
3737
- fonts-droid
3838
- clang-format-5.0
3939
before_script:
40-
- git clone https://github.com/flutter/flutter.git --depth 1
40+
- git clone https://github.com/flutter/flutter.git
4141
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
4242
- flutter doctor
4343
- pub global activate flutter_plugin_tools
4444
script:
45-
- ./script/plugin_tools.sh format --travis --clang-format=clang-format-5.0
46-
- ./script/plugin_tools.sh test
47-
# Job 3) Build example APKs
45+
- ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0
46+
- ./script/incremental_build.sh test
47+
# Job 3.1) Build example APKs and run Java tests, shard 1/2
4848
- os: linux
4949
env:
50-
- SHARD=Build-example-APKs
50+
- SHARD="Build example apks 1/2"
51+
- PLUGIN_SHARDING="--shardIndex 0 --shardCount 2"
5152
jdk: oraclejdk8
5253
sudo: false
5354
addons:
@@ -60,50 +61,59 @@ matrix:
6061
- libstdc++6
6162
- fonts-droid
6263
before_script:
63-
- wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
64-
- mkdir android-sdk
65-
- unzip -qq sdk-tools-linux-3859397.zip -d android-sdk
64+
- ./script/before_build_apks.sh
6665
- export ANDROID_HOME=`pwd`/android-sdk
67-
- export PATH=`pwd`/android-sdk/tools/bin:$PATH
68-
- mkdir -p /home/travis/.android # silence sdkmanager warning
69-
- echo 'count=0' > /home/travis/.android/repositories.cfg # silence sdkmanager warning
70-
- echo y | sdkmanager "tools"
71-
- echo y | sdkmanager "platform-tools"
72-
- echo y | sdkmanager "build-tools;25.0.3"
73-
- echo y | sdkmanager "platforms;android-25"
74-
- echo y | sdkmanager "extras;android;m2repository"
75-
- echo y | sdkmanager "extras;google;m2repository"
76-
- echo y | sdkmanager "patcher;v4"
77-
- sdkmanager --list
78-
- wget http://services.gradle.org/distributions/gradle-3.5-bin.zip
79-
- unzip -qq gradle-3.5-bin.zip
80-
- export GRADLE_HOME=$PWD/gradle-3.5
81-
- export PATH=$GRADLE_HOME/bin:$PATH
82-
- gradle -v
83-
- git clone https://github.com/flutter/flutter.git --depth 1
8466
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
85-
- flutter doctor
86-
- pub global activate flutter_plugin_tools
8767
script:
88-
- ./script/plugin_tools.sh build-examples --apk
89-
# Job 4) Build example IPAs
68+
- ./script/incremental_build.sh build-examples --apk
69+
- ./script/incremental_build.sh java-test # must come after apk build
70+
# Job 3.2) Build example APKs and run Java tests, shard 2/2
71+
- os: linux
72+
env:
73+
- SHARD="Build example apks 2/2"
74+
- PLUGIN_SHARDING="--shardIndex 1 --shardCount 2"
75+
jdk: oraclejdk8
76+
sudo: false
77+
addons:
78+
apt:
79+
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
80+
sources:
81+
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
82+
packages:
83+
- lib32stdc++6 # https://github.com/flutter/flutter/issues/6207
84+
- libstdc++6
85+
- fonts-droid
86+
before_script:
87+
- ./script/before_build_apks.sh
88+
- export ANDROID_HOME=`pwd`/android-sdk
89+
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
90+
script:
91+
- ./script/incremental_build.sh build-examples --apk
92+
- ./script/incremental_build.sh java-test # must come after apk build
93+
# Job 4.1) Build example IPAs, shard 1/2
9094
- os: osx
9195
env:
92-
- SHARD=Build-example-IPAs
96+
- SHARD="Build example ipas 1/2"
97+
- PLUGIN_SHARDING="--shardIndex 0 --shardCount 2"
9398
language: generic
94-
osx_image: xcode8.3
99+
osx_image: xcode9.3
95100
before_script:
96-
- pip install six
97-
- brew update
98-
- brew install --HEAD libimobiledevice
99-
- brew install ideviceinstaller
100-
- brew install ios-deploy
101-
- git clone https://github.com/flutter/flutter.git --depth 1
101+
- ./script/before_build_ipas.sh
102+
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
103+
script:
104+
- ./script/incremental_build.sh build-examples --ipa
105+
# Job 4.2) Build example IPAs, shard 2/2
106+
- os: osx
107+
env:
108+
- SHARD="Build example ipas 2/2"
109+
- PLUGIN_SHARDING="--shardIndex 1 --shardCount 2"
110+
language: generic
111+
osx_image: xcode9.3
112+
before_script:
113+
- ./script/before_build_ipas.sh
102114
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
103-
- flutter doctor
104-
- pub global activate flutter_plugin_tools
105115
script:
106-
- ./script/plugin_tools.sh build-examples --ipa
116+
- ./script/incremental_build.sh build-examples --ipa
107117

108118
cache:
109119
directories:

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Flutter plugins
22

33
[![Build Status](https://travis-ci.org/google/flutter.plugins.svg?branch=master)](https://travis-ci.org/google/flutter.plugins)
4+
[![Build Status](https://api.cirrus-ci.com/github/google/flutter.plugins.svg)](https://cirrus-ci.com/github/google/flutter.plugins)
45

56
This repository contains the source code for Flutter plugins that are
67
developed by Google but not by the core Flutter team.

script/before_build_apks.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
3+
mkdir android-sdk
4+
unzip -qq sdk-tools-linux-3859397.zip -d android-sdk
5+
export ANDROID_HOME=`pwd`/android-sdk
6+
export PATH=`pwd`/android-sdk/tools/bin:$PATH
7+
mkdir -p /home/travis/.android # silence sdkmanager warning
8+
echo 'count=0' > /home/travis/.android/repositories.cfg # silence sdkmanager warning
9+
# suppressing output of sdkmanager to keep log under 4MB (travis limit)
10+
echo y | sdkmanager "tools" >/dev/null
11+
echo y | sdkmanager "platform-tools" >/dev/null
12+
echo y | sdkmanager "build-tools;26.0.3" >/dev/null
13+
echo y | sdkmanager "platforms;android-26" >/dev/null
14+
echo y | sdkmanager "extras;android;m2repository" >/dev/null
15+
echo y | sdkmanager "extras;google;m2repository" >/dev/null
16+
echo y | sdkmanager "patcher;v4" >/dev/null
17+
sdkmanager --list
18+
wget http://services.gradle.org/distributions/gradle-4.1-bin.zip
19+
unzip -qq gradle-4.1-bin.zip
20+
export GRADLE_HOME=$PWD/gradle-4.1
21+
export PATH=$GRADLE_HOME/bin:$PATH
22+
gradle -v
23+
git clone https://github.com/flutter/flutter.git
24+
export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
25+
flutter doctor
26+
pub global activate flutter_plugin_tools

script/before_build_ipas.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
brew update
3+
brew install libimobiledevice
4+
brew install ideviceinstaller
5+
brew install ios-deploy
6+
pod repo update
7+
gem update cocoapods
8+
git clone https://github.com/flutter/flutter.git
9+
export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
10+
flutter doctor
11+
pub global activate flutter_plugin_tools

script/incremental_build.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
5+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
6+
7+
if [ "${BRANCH_NAME}" = "master" ]; then
8+
echo "Running for all packages"
9+
pub global run flutter_plugin_tools "$@" $PLUGIN_SHARDING
10+
else
11+
# Make sure there is up-to-date master.
12+
git fetch origin master
13+
14+
FLUTTER_CHANGED_GLOBAL=0
15+
FLUTTER_CHANGED_PACKAGES=""
16+
17+
# Try get a merge base for the branch and calculate affected packages.
18+
# We need this check because some CIs can do a single branch clones with a limited history of commits.
19+
if BRANCH_BASE_SHA=$(git merge-base --fork-point FETCH_HEAD HEAD); then
20+
echo "Checking changes from $BRANCH_BASE_SHA..."
21+
FLUTTER_CHANGED_GLOBAL=`git diff --name-only $BRANCH_BASE_SHA HEAD | grep -v packages | wc -l`
22+
FLUTTER_CHANGED_PACKAGES=`git diff --name-only $BRANCH_BASE_SHA HEAD | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq | paste -s -d, -`
23+
else
24+
echo "Cannot find a merge base for the current branch to run an incremental build..."
25+
echo "Please rebase your branch onto the latest master!"
26+
fi
27+
28+
if [ "${FLUTTER_CHANGED_PACKAGES}" = "" ] || [ $FLUTTER_CHANGED_GLOBAL -gt 0 ]; then
29+
echo "Running for all packages"
30+
pub global run flutter_plugin_tools "$@" $PLUGIN_SHARDING
31+
else
32+
echo "Running only for $FLUTTER_CHANGED_PACKAGES"
33+
pub global run flutter_plugin_tools "$@" --plugins=$FLUTTER_CHANGED_PACKAGES
34+
fi
35+
fi

0 commit comments

Comments
 (0)