Skip to content

Commit 30ee6e4

Browse files
committed
Switch to Cirrus, turn off Travis
1 parent fe7ca46 commit 30ee6e4

File tree

6 files changed

+154
-154
lines changed

6 files changed

+154
-154
lines changed

.cirrus.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
task:
2+
container:
3+
image: cirrusci/flutter:latest
4+
cpu: 4
5+
memory: 8G
6+
upgrade_script:
7+
- flutter channel master
8+
- flutter upgrade
9+
- git fetch origin master
10+
activate_script: pub global activate flutter_plugin_tools
11+
matrix:
12+
- name: publishable
13+
script: ./script/check_publish.sh
14+
- name: test+format
15+
install_script:
16+
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
17+
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
18+
- sudo apt-get update
19+
- sudo apt-get install -y --allow-unauthenticated clang-format-5.0
20+
format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0
21+
test_script: ./script/incremental_build.sh test
22+
- name: analyze
23+
script: ./script/incremental_build.sh analyze
24+
- name: build-apks+java-test
25+
env:
26+
matrix:
27+
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2"
28+
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2"
29+
script:
30+
- ./script/incremental_build.sh build-examples --apk
31+
- ./script/incremental_build.sh java-test # must come after apk build
32+
33+
task:
34+
name: build-ipas
35+
osx_instance:
36+
image: high-sierra-xcode-9.4
37+
env:
38+
PATH: $PATH:/usr/local/bin
39+
matrix:
40+
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2"
41+
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2"
42+
setup_script:
43+
- brew update
44+
- brew install libimobiledevice
45+
- brew install ideviceinstaller
46+
- brew install ios-deploy
47+
- pod repo update
48+
- git clone https://github.com/flutter/flutter.git
49+
- git fetch origin master
50+
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
51+
- flutter doctor
52+
- pub global activate flutter_plugin_tools
53+
build_script:
54+
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
55+
- ./script/incremental_build.sh build-examples --ipa

.travis.yml

Lines changed: 0 additions & 112 deletions
This file was deleted.

script/check_publish.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# This script checks to make sure that each of the plugins *could* be published.
5+
# It doesn't actually publish anything.
6+
7+
# So that users can run this script from anywhere and it will work as expected.
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
9+
REPO_DIR="$(dirname "$SCRIPT_DIR")"
10+
11+
source "$SCRIPT_DIR/common.sh"
12+
13+
function check_publish() {
14+
local failures=()
15+
for package_name in "$@"; do
16+
local dir="$REPO_DIR/packages/$package_name"
17+
echo "Checking that $package_name can be published."
18+
if (cd "$dir" && pub publish --dry-run > /dev/null); then
19+
echo "Package $package_name is able to be published."
20+
else
21+
error "Unable to publish $package_name"
22+
failures=("${failures[@]}" "$package_name")
23+
fi
24+
done
25+
if [[ "${#failures[@]}" != 0 ]]; then
26+
error "FAIL: The following ${#failures[@]} package(s) failed the publishing check:"
27+
for failure in "${failures[@]}"; do
28+
error "$failure"
29+
done
30+
fi
31+
return "${#failures[@]}"
32+
}
33+
34+
# Sets CHANGED_PACKAGE_LIST
35+
check_changed_packages
36+
37+
if [[ "${#CHANGED_PACKAGE_LIST[@]}" != 0 ]]; then
38+
check_publish "${CHANGED_PACKAGE_LIST[@]}"
39+
fi

script/common.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
function error() {
4+
echo "$@" 1>&2
5+
}
6+
7+
function check_changed_packages() {
8+
# Try get a merge base for the branch and calculate affected packages.
9+
# We need this check because some CIs can do a single branch clones with a limited history of commits.
10+
local packages
11+
local branch_base_sha="$(git merge-base --fork-point FETCH_HEAD HEAD || git merge-base FETCH_HEAD HEAD)"
12+
if [[ "$?" == 0 ]]; then
13+
echo "Checking for changed packages from $branch_base_sha"
14+
IFS=$'\n' packages=( $(git diff --name-only "$branch_base_sha" HEAD | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq) )
15+
else
16+
error "Cannot find a merge base for the current branch to run an incremental build..."
17+
error "Please rebase your branch onto the latest master!"
18+
return 1
19+
fi
20+
21+
# Filter out any packages that don't have a pubspec.yaml: they have probably
22+
# been deleted in this PR.
23+
CHANGED_PACKAGES=""
24+
CHANGED_PACKAGE_LIST=()
25+
for package in "${packages[@]}"; do
26+
if [[ -f "$REPO_DIR/packages/$package/pubspec.yaml" ]]; then
27+
CHANGED_PACKAGES="${CHANGED_PACKAGES},$package"
28+
CHANGED_PACKAGE_LIST=("${CHANGED_PACKAGE_LIST[@]}" "$package")
29+
fi
30+
done
31+
32+
if [[ "${#CHANGED_PACKAGE_LIST[@]}" == 0 ]]; then
33+
echo "No changes detected in packages."
34+
else
35+
echo "Detected changes in the following ${#CHANGED_PACKAGE_LIST[@]} package(s):"
36+
for package in "${CHANGED_PACKAGE_LIST[@]}"; do
37+
echo "$package"
38+
done
39+
echo ""
40+
fi
41+
return 0
42+
}

script/incremental_build.sh

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
11
#!/bin/bash
2+
set -e
23

3-
set -ev
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
5+
REPO_DIR="$(dirname "$SCRIPT_DIR")"
46

5-
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
7+
source "$SCRIPT_DIR/common.sh"
68

7-
if [ "${BRANCH_NAME}" = "master" ]; then
9+
# Set some default actions if run without arguments.
10+
ACTIONS=("$@")
11+
if [[ "${#ACTIONS[@]}" == 0 ]]; then
12+
ACTIONS=("test" "analyze" "java-test")
13+
fi
14+
15+
BRANCH_NAME="${BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"}"
16+
if [[ "${BRANCH_NAME}" == "master" ]]; then
817
echo "Running for all packages"
9-
pub global run flutter_plugin_tools "$@"
18+
(cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING)
1019
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
20+
# Sets CHANGED_PACKAGES
21+
check_changed_packages
2722

28-
if [ "${FLUTTER_CHANGED_PACKAGES}" = "" ] || [ $FLUTTER_CHANGED_GLOBAL -gt 0 ]; then
23+
if [[ "$CHANGED_PACKAGES" == "" ]]; then
2924
echo "Running for all packages"
30-
pub global run flutter_plugin_tools "$@"
25+
(cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING)
3126
else
32-
echo "Running only for $FLUTTER_CHANGED_PACKAGES"
33-
pub global run flutter_plugin_tools "$@" --plugins=$FLUTTER_CHANGED_PACKAGES
27+
(cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $PLUGIN_SHARDING)
3428
fi
3529
fi

script/plugin_tools.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)