Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Cirrus, turn off Travis #3

Merged
merged 4 commits into from
Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
task:
container:
image: cirrusci/flutter:latest
cpu: 4
memory: 8G
upgrade_script:
- flutter channel master
- flutter upgrade
- git fetch origin master
activate_script: pub global activate flutter_plugin_tools
matrix:
- name: publishable
script: ./script/check_publish.sh
- name: test+format
install_script:
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated clang-format-5.0
format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0
test_script: ./script/incremental_build.sh test
- name: analyze
script: ./script/incremental_build.sh analyze
- name: build-apks+java-test
env:
matrix:
BUILD_SHARDING: "--shardIndex 0 --shardCount 2"
BUILD_SHARDING: "--shardIndex 1 --shardCount 2"
script:
- ./script/incremental_build.sh build-examples --apk
- ./script/incremental_build.sh java-test # must come after apk build

task:
name: build-ipas
osx_instance:
image: high-sierra-xcode-9.4
env:
PATH: $PATH:/usr/local/bin
matrix:
BUILD_SHARDING: "--shardIndex 0 --shardCount 2"
BUILD_SHARDING: "--shardIndex 1 --shardCount 2"
setup_script:
- brew update
- brew install libimobiledevice
- brew install ideviceinstaller
- brew install ios-deploy
- pod repo update
- git clone https://github.com/flutter/flutter.git
- git fetch origin master
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
- flutter doctor
- pub global activate flutter_plugin_tools
build_script:
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
- ./script/incremental_build.sh build-examples --ipa
112 changes: 0 additions & 112 deletions .travis.yml

This file was deleted.

10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Contributing to Flutter
=======================

[![Build Status](https://travis-ci.org/flutter/packages.svg)](https://travis-ci.org/flutter/packages)
[![Build Status](https://api.cirrus-ci.com/github/flutter/packages.svg)](https://cirrus-ci.com/github/flutter/packages)

_See also: [Flutter's code of conduct](https://flutter.io/design-principles/#code-of-conduct)_

Expand Down Expand Up @@ -37,7 +37,7 @@ example's directory, run `flutter packages get` to make sure its dependencies ha
downloaded, and use `flutter run`. Make sure you have a device connected over
USB and debugging enabled on that device. For example:

* `cd packages/palette_generator/example/image_colors`
* `cd packages/palette_generator/example`
* `flutter packages get`
* `flutter run`

Expand All @@ -64,6 +64,12 @@ pub global run flutter_plugin_tools format --plugins package_name
pub global run flutter_plugin_tools analyze --plugins package_name
pub global run flutter_plugin_tools test --plugins package_name
```
* Check that the package can be published (but don't publish it until it has landed!):

```
cd packages/package_name; pub publish --dry-run
```

* `git commit -a -m "<your informative commit message>"`
* `git push origin <name_of_your_branch>`

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Flutter Packages

[![Build Status](https://travis-ci.org/flutter/packages.svg?branch=master)](https://travis-ci.org/flutter/packages)
[![Build Status](https://api.cirrus-ci.com/github/flutter/packages.svg)](https://cirrus-ci.com/github/flutter/packages)
[![Build Status](https://api.cirrus-ci.com/github/flutter/packages.svg)](https://cirrus-ci.com/github/flutter/packages/master)

This repo is a companion repo to the main [flutter repo](
https://github.com/flutter/flutter). It contains the source code for Flutter's
Expand Down
2 changes: 1 addition & 1 deletion packages/palette_generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import 'package:palette_generator/palette_generator.dart';
```

Then use the `PaletteGenerator` Dart class in your code. To see how this is done,
check out the [image_colors example app](example/image_colors/README.md).
check out the [image_colors example app](example/README.md).
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,3 @@ class PaletteSwatch extends StatelessWidget {
return swatch;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
flutter:
sdk: flutter
palette_generator:
path: ../..
path: ..
cupertino_icons: ^0.1.2

dev_dependencies:
Expand Down
11 changes: 4 additions & 7 deletions packages/palette_generator/palette_generator.iml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/android/app/src/main/java/io/flutter/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/build" />
<excludeFolder url="file://$MODULE_DIR$/example/image_test/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/image_test/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/image_test/build" />
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/android/app/src/main/java/io/flutter/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
2 changes: 1 addition & 1 deletion packages/palette_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
path: ^1.6.1

dev_dependencies:
mockito: ^2.2.3
mockito: ^3.0.0
flutter_test:
sdk: flutter

Expand Down
38 changes: 23 additions & 15 deletions packages/palette_generator/test/palette_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void main() async {
testImages[name] = await loadImage('$name.png');
}

testWidgets('Initialize the image cache', (WidgetTester tester) {
testWidgets('Initialize the image cache', (WidgetTester tester) async {
// We need to have a testWidgets test in order to initialize the image
// cache for the other tests, but they timeout if they too are testWidgets
// tests.
Expand Down Expand Up @@ -104,8 +104,10 @@ void main() async {
final ImageProvider imageProvider = testImages['dominant'];
Rect region = new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0);
const Size size = const Size(100.0, 100.0);
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(imageProvider,
region: region, size: size);
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
imageProvider,
region: region,
size: size);
expect(palette.paletteColors.length, equals(3));
expect(palette.dominantColor.color,
within<Color>(distance: 8, from: const Color(0xff0000ff)));
Expand Down Expand Up @@ -167,14 +169,15 @@ void main() async {

test('PaletteGenerator limits max colors', () async {
final ImageProvider imageProvider = testImages['landscape'];
PaletteGenerator palette =
await PaletteGenerator.fromImageProvider(imageProvider, maximumColorCount: 32);
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
imageProvider,
maximumColorCount: 32);
expect(palette.paletteColors.length, equals(31));
palette =
await PaletteGenerator.fromImageProvider(imageProvider, maximumColorCount: 1);
palette = await PaletteGenerator.fromImageProvider(imageProvider,
maximumColorCount: 1);
expect(palette.paletteColors.length, equals(1));
palette =
await PaletteGenerator.fromImageProvider(imageProvider, maximumColorCount: 15);
palette = await PaletteGenerator.fromImageProvider(imageProvider,
maximumColorCount: 15);
expect(palette.paletteColors.length, equals(15));
});

Expand All @@ -184,8 +187,9 @@ void main() async {
List<PaletteFilter> filters = <PaletteFilter>[
avoidRedBlackWhitePaletteFilter
];
PaletteGenerator palette =
await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
imageProvider,
filters: filters);
final List<PaletteColor> expectedSwatches = <PaletteColor>[
new PaletteColor(const Color(0xff3f630c), 10137),
new PaletteColor(const Color(0xff3c4b2a), 4773),
Expand Down Expand Up @@ -213,7 +217,8 @@ void main() async {

// A non-default filter works (and the default filter isn't applied too).
filters = <PaletteFilter>[onlyBluePaletteFilter];
palette = await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
palette = await PaletteGenerator.fromImageProvider(imageProvider,
filters: filters);
final List<PaletteColor> blueSwatches = <PaletteColor>[
new PaletteColor(const Color(0xff4c5c75), 1515),
new PaletteColor(const Color(0xff7483a1), 1505),
Expand Down Expand Up @@ -242,7 +247,8 @@ void main() async {

// More than one filter is the intersection of the two filters.
filters = <PaletteFilter>[onlyBluePaletteFilter, onlyCyanPaletteFilter];
palette = await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
palette = await PaletteGenerator.fromImageProvider(imageProvider,
filters: filters);
final List<PaletteColor> blueGreenSwatches = <PaletteColor>[
new PaletteColor(const Color(0xffc8e8f8), 87),
new PaletteColor(const Color(0xff5c6c74), 73),
Expand Down Expand Up @@ -271,7 +277,8 @@ void main() async {

// Mutually exclusive filters return an empty palette.
filters = <PaletteFilter>[onlyBluePaletteFilter, onlyGreenPaletteFilter];
palette = await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
palette = await PaletteGenerator.fromImageProvider(imageProvider,
filters: filters);
expect(palette.paletteColors, isEmpty);
expect(palette.dominantColor, isNull);
expect(palette.colors, isEmpty);
Expand All @@ -281,7 +288,8 @@ void main() async {
final ImageProvider imageProvider = testImages['landscape'];
// Passing an empty set of targets works the same as passing a null targets
// list.
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(imageProvider,
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
imageProvider,
targets: <PaletteTarget>[]);
expect(palette.selectedSwatches, isNotEmpty);
expect(palette.vibrantColor, isNotNull);
Expand Down
39 changes: 39 additions & 0 deletions script/check_publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -e

# This script checks to make sure that each of the plugins *could* be published.
# It doesn't actually publish anything.

# So that users can run this script from anywhere and it will work as expected.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
REPO_DIR="$(dirname "$SCRIPT_DIR")"

source "$SCRIPT_DIR/common.sh"

function check_publish() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to update any documentation (such as contributing.md) to point to the existence of such a script? or is it forced by Cirrus?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not forced by Cirrus. I'll add a line in CONTRIBUTING.md

local failures=()
for package_name in "$@"; do
local dir="$REPO_DIR/packages/$package_name"
echo "Checking that $package_name can be published."
if (cd "$dir" && pub publish --dry-run > /dev/null); then
echo "Package $package_name is able to be published."
else
error "Unable to publish $package_name"
failures=("${failures[@]}" "$package_name")
fi
done
if [[ "${#failures[@]}" != 0 ]]; then
error "FAIL: The following ${#failures[@]} package(s) failed the publishing check:"
for failure in "${failures[@]}"; do
error "$failure"
done
fi
return "${#failures[@]}"
}

# Sets CHANGED_PACKAGE_LIST
check_changed_packages

if [[ "${#CHANGED_PACKAGE_LIST[@]}" != 0 ]]; then
check_publish "${CHANGED_PACKAGE_LIST[@]}"
fi
Loading