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

Run floor Flutter tests #76

Merged
merged 11 commits into from
Mar 3, 2019
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
61 changes: 54 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,84 @@
# Created with package:mono_repo v1.2.1
language: dart

before_install:
- chmod +x tool/travis.sh

jobs:
include:
- stage: analyze
name: "SDK: stable - DIR: floor_annotation - TASKS: dartfmt -n --set-exit-if-changed ."
language: dart
name: "floor_annotation - dartfmt"
script: ./tool/travis.sh dartfmt
env: PKG="floor_annotation"
dart: stable

- stage: analyze
name: "SDK: stable - DIR: floor_annotation - TASKS: dartanalyzer --fatal-infos --fatal-warnings ."
language: dart
name: "floor_annotation - dartanalyzer"
script: ./tool/travis.sh dartanalyzer
env: PKG="floor_annotation"
dart: stable

- stage: analyze
name: "SDK: stable - DIR: floor_generator - TASKS: dartfmt -n --set-exit-if-changed ."
language: dart
name: "floor_generator - dartfmt"
script: ./tool/travis.sh dartfmt
env: PKG="floor_generator"
dart: stable

- stage: analyze
name: "SDK: stable - DIR: floor_generator - TASKS: dartanalyzer --fatal-infos --fatal-warnings ."
language: dart
name: "floor_generator - dartanalyzer"
script: ./tool/travis.sh dartanalyzer
env: PKG="floor_generator"
dart: stable

- stage: analyze
language: generic
name: "floor - flutter analyze"
env: PKG="floor"
os: linux
before_script:
- sudo apt-get install -y --no-install-recommends lib32stdc++6 libstdc++6 > /dev/null
# install pre-compiled flutter
- FLUTTER_CHANNEL=stable
- FLUTTER_VERSION=1.2.1-${FLUTTER_CHANNEL}
- wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/${FLUTTER_CHANNEL}/linux/flutter_linux_v${FLUTTER_VERSION}.tar.xz && tar xf flutter.tar.xz > /dev/null && rm flutter.tar.xz
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH
- flutter doctor -v
script:
- ./tool/travis.sh flutter_analyze
cache:
directories:
- $HOME/.pub-cache

- stage: unit_test
name: "SDK: stable - DIR: floor_generator - TASKS: pub run test"
language: dart
name: "floor_generator - pub run test"
script: ./tool/travis.sh test
env: PKG="floor_generator"
dart: stable

- stage: unit_test
language: generic
name: "floor - flutter test"
env: PKG="floor"
os: linux
before_script:
- sudo apt-get install -y --no-install-recommends lib32stdc++6 libstdc++6 > /dev/null
# install pre-compiled flutter
- FLUTTER_CHANNEL=stable
- FLUTTER_VERSION=1.2.1-${FLUTTER_CHANNEL}
- wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/${FLUTTER_CHANNEL}/linux/flutter_linux_v${FLUTTER_VERSION}.tar.xz && tar xf flutter.tar.xz > /dev/null && rm flutter.tar.xz
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH
- flutter doctor -v
script:
- ./tool/travis.sh flutter_test
cache:
directories:
- $HOME/.pub-cache

stages:
- analyze
- unit_test
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Thus not supporting automatic relationship mapping is intentional.

This package is still in an early phase and the API will likely change.

[![Build Status](https://travis-ci.org/vitusortner/floor.svg?branch=develop)](https://travis-ci.org/vitusortner/floor)

### Table of contents

1. [How to use this library](#how-to-use-this-library)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ class QueryAdapterWriter {
builder..fields.add(queryAdapterSingleton);
builder..methods.add(getQueryAdapter);
}

}
1 change: 0 additions & 1 deletion floor_generator/lib/writer/delete_method_body_writer.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:code_builder/code_builder.dart';
import 'package:floor_generator/model/column.dart';
import 'package:floor_generator/model/delete_method.dart';
import 'package:floor_generator/writer/writer.dart';
import 'package:source_gen/source_gen.dart';
Expand Down
2 changes: 0 additions & 2 deletions floor_generator/lib/writer/query_method_writer.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:code_builder/code_builder.dart';
import 'package:floor_generator/misc/annotation_expression.dart';
import 'package:floor_generator/misc/type_utils.dart';
Expand Down
15 changes: 14 additions & 1 deletion tool/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,41 @@ if [ "$#" == "0" ]; then
fi

pushd $PKG
pub upgrade || exit $?

EXIT_CODE=0

while (( "$#" )); do
TASK=$1
case $TASK in
dartanalyzer) echo
pub upgrade || exit $?
echo -e '\033[1mTASK: dartanalyzer\033[22m'
echo -e 'dartanalyzer --fatal-infos --fatal-warnings .'
dartanalyzer --fatal-infos --fatal-warnings . || EXIT_CODE=$?
;;
dartfmt) echo
pub upgrade || exit $?
echo -e '\033[1mTASK: dartfmt\033[22m'
echo -e 'dartfmt -n --set-exit-if-changed .'
dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
;;
test) echo
pub upgrade || exit $?
echo -e '\033[1mTASK: test\033[22m'
echo -e 'pub run test'
pub run test || EXIT_CODE=$?
;;
flutter_analyze) echo
echo -e '\033[1mTASK: flutter analyze\033[22m'
echo -e 'flutter analyze'
flutter analyze || EXIT_CODE=$?
;;
flutter_test) echo
flutter packages get || exit $?
echo -e '\033[1mTASK: flutter test\033[22m'
echo -e 'flutter test'
flutter test || EXIT_CODE=$?
;;
*) echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
EXIT_CODE=1
;;
Expand Down