refactor stream_flutter_workflow.yml

Signed-off-by: Sahil Kumar <xdsahil@gmail.com>
This commit is contained in:
Sahil Kumar
2021-06-17 21:31:06 +05:30
parent 2af7c78bd1
commit 678945f7ef
10 changed files with 141 additions and 565 deletions
@@ -1,13 +0,0 @@
#!/usr/bin/env bash
BRANCH=$1
if [ "$BRANCH" == "dev" ]
then
# TODO Flutter dev branch is currently broken so we're unable to test MacOS.
echo "TODO: Skipping macOS testing due to Flutter dev branch issue. Switching branch to stable."
BRANCH=stable
fi
git clone https://github.com/flutter/flutter.git --depth 1 -b $BRANCH _flutter
echo "::add-path::$GITHUB_WORKSPACE/_flutter/bin"
@@ -1,6 +0,0 @@
#!/bin/bash
flutter pub global activate melos
echo "::add-path::$HOME/.pub-cache/bin"
echo "::add-path::$GITHUB_WORKSPACE/_flutter/.pub-cache/bin"
echo "::add-path::$GITHUB_WORKSPACE/_flutter/bin/cache/dart-sdk/bin"
@@ -3,4 +3,5 @@
# Fast fail the script on failures.
set -e
pub global activate remove_from_coverage
pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r '\.freezed\.dart$'
+86 -51
View File
@@ -17,89 +17,124 @@ jobs:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Git Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: 'Install Tools'
- name: "Install Flutter"
uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: "Install Tools"
run: |
./.github/workflows/scripts/install-tools.sh
flutter pub global activate melos
flutter pub global activate tuneup
- name: 'Bootstrap Workspace'
run: melos bootstrap --verbose
- name: 'Dart Analyze'
- name: "Bootstrap Workspace"
run: melos bootstrap
- name: "Dart Analyze"
run: |
melos exec -c 3 --ignore="*example*" -- \
tuneup check
- name: 'Pub Check'
melos run analyze
- name: "Pub Check"
if: github.ref == 'refs/heads/master'
run: |
melos exec -c 1 --no-private --ignore="*example*" -- \
pub publish --dry-run
melos run lint:pub
format:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: "Git Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: 'Install Tools'
- name: "Install Flutter"
uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: "Install Tools"
run: flutter pub global activate melos
- name: "Bootstrap Workspace"
run: melos bootstrap
- name: "Melos Format"
run: melos run format
- name: "Validate Formatting"
run: |
./.github/workflows/scripts/install-tools.sh
- name: 'Bootstrap Workspace'
run: melos bootstrap --verbose
- name: 'Dart'
run: |
melos exec -c 1 -- \
flutter format .
./.github/workflows/scripts/validate-formatting.sh
test:
runs-on: macos-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: "Git Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: 'Install Tools'
run: |
./.github/workflows/scripts/install-tools.sh
flutter pub global activate coverage
flutter pub global activate remove_from_coverage
- name: 'Bootstrap Workspace'
run: melos bootstrap --verbose
- name: 'Dart Test'
run: |
cd packages/stream_chat
flutter pub run test --coverage coverage/
format_coverage --lcov --in=coverage/ --out=coverage/lcov.info --packages=.packages --report-on=lib
- name: 'Flutter Test'
run: |
melos exec -c 3 --flutter --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
flutter test --coverage
- name: CodeCov
run: |
melos exec -c 3 --fail-fast --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
"\$MELOS_ROOT_PATH/.github/workflows/scripts/coverage.sh"
bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
- uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
- name: "Install Flutter"
uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: "Install Tools"
run: flutter pub global activate melos
- name: "Bootstrap Workspace"
run: melos bootstrap
- name: "Flutter Test"
run: melos run test:all
- name: "Collect Coverage"
run: melos run coverage:ignore-file
- name: "Upload Coverage"
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
files: packages/*/coverage/lcov.info
- name: "Stream Chat Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
with:
path: packages/stream_chat/coverage/lcov.info
min_coverage: 40
- name: "Stream Chat Persistence Coverage Check"
- uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
with:
path: packages/stream_chat_persistence/coverage/lcov.info
min_coverage: 95
- uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
- name: "Stream Chat Flutter Core Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
with:
path: packages/stream_chat_flutter_core/coverage/lcov.info
min_coverage: 90
- uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
- name: "Stream Chat Flutter Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
with:
path: packages/stream_chat_flutter/coverage/lcov.info
min_coverage: 35
# test:
# runs-on: macos-latest
# timeout-minutes: 15
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: 'Install Flutter'
# run: ./.github/workflows/scripts/install-flutter.sh stable
# - name: 'Install Tools'
# run: |
# ./.github/workflows/scripts/install-tools.sh
# flutter pub global activate coverage
# flutter pub global activate remove_from_coverage
# - name: 'Bootstrap Workspace'
# run: melos bootstrap --verbose
# - name: 'Dart Test'
# run: |
# cd packages/stream_chat
# flutter pub run test --coverage coverage/
# format_coverage --lcov --in=coverage/ --out=coverage/lcov.info --packages=.packages --report-on=lib
# - name: 'Flutter Test'
# run: |
# melos exec -c 3 --flutter --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
# flutter test --coverage
# - name: CodeCov
# run: |
# melos exec -c 3 --fail-fast --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
# "\$MELOS_ROOT_PATH/.github/workflows/scripts/coverage.sh"
# bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
+54 -42
View File
@@ -1,4 +1,4 @@
name: stream_chat_dart
name: stream_chat_flutter
versioning:
mode: independent
@@ -7,56 +7,68 @@ packages:
- packages/**
scripts:
lint:all:
run: melos run analyze && melos run format
description: Run all static analysis checks
# - Requires `pub global activate tuneup`.
analyze: >
melos exec -c 1 --fail-fast -- \
pub global run tuneup check
analyze:
run: |
melos exec -c 4 --ignore="*example*" -- \
dart analyze --fatal-infos .
description: |
Run `dart analyze` in all packages.
- Note: you can also rely on your IDEs Dart Analysis / Issues window.
format: pub global run flutter_plugin_tools format
format:
run: flutter format --set-exit-if-changed .
description: |
Run `flutter format --set-exit-if-changed .` in all packages.
lint:pub:
run: |
melos exec -c 4 --no-private --ignore="*example*" -- \
pub publish --dry-run
description: |
Run `pub publish --dry-run` in all packages.
- Note: you can also rely on your IDEs Dart Analysis / Issues window.
build:examples:ios: >
melos exec -c 1 --scope="*example*" --fail-fast -- \
flutter build ios --no-codesign
generate:all:
run: melos run generate:dart && melos run generate:flutter
description: Build all generated files for Dart & Flutter packages in this project.
generate:dart:
run: melos exec -c 1 --depends-on="build_runner" --no-flutter -- "dart run build_runner build --delete-conflicting-outputs"
description: Build all generated files for Dart packages in this project.
build:examples:android: >
melos exec -c 1 --scope="*example*" --fail-fast -- \
flutter build apk
generate:flutter:
run: melos exec -c 1 --depends-on="build_runner" --flutter -- "flutter pub run build_runner build --delete-conflicting-outputs"
description: Build all generated files for Flutter packages in this project.
# Build any plugin example apps that have MacOS support.
# - Requires `flutter config --enable-macos-desktop` enabled.
# - Requires `flutter channel master && flutter upgrade`.
build:examples:macos: >
melos exec -c 1 --scope="*example*" --dir-exists=macos --fail-fast -- \
flutter build macos
test:all:
run: melos run test:dart --no-select && melos run test:flutter --no-select
description: Run all Dart & Flutter tests in this project.
test:dart:
run: melos exec -c 1 --fail-fast -- "flutter test --coverage"
description: Run Dart tests for a specific package in this project.
select-package:
flutter: false
dir-exists: test
test:dart: >
melos exec -c 1 --fail-fast --no-flutter --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
flutter pub run test
test:flutter:
run: melos exec -c 1 --fail-fast -- "flutter test --coverage"
description: Run Flutter tests for a specific package in this project.
select-package:
flutter: true
dir-exists: test
test:flutter: >
melos exec -c 1 --fail-fast --flutter --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
flutter test
test:web: >
melos exec -c 1 --fail-fast --dir-exists=test --scope="*web*" -- \
flutter test --platform=chrome
lint:pub: >
melos exec -c 5 --fail-fast --no-private --ignore="*example*" -- \
pub publish --dry-run
postclean: >
melos exec -- \
rm -rf ./build ./android/.gradle ./ios/.symlinks ./ios/Pods ./android/.idea ./.idea ./.dart-tool/build
dev_dependencies:
pedantic: 1.9.2
coverage:ignore-file:
run: |
melos exec -c 4 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from_coverage.sh"
description: Removes all the ignored files from the coverage report.
select-package:
dir-exists: coverage
environment:
sdk: ">=2.12.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'
flutter: '>=1.22.4 <2.0.0'
-3
View File
@@ -1,3 +0,0 @@
# Configuration for https://pub.dev/packages/peanut
directories:
- example/web
@@ -1,150 +0,0 @@
analyzer:
enable-experiment:
- extension-methods
exclude:
- lib/**/*.g.dart
- example/**
- lib/src/emoji
- lib/**/*.freezed.dart
- test/**
linter:
rules:
# these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
- always_use_package_imports
- avoid_empty_else
- avoid_relative_lib_imports
- avoid_slow_async_io
- avoid_types_as_parameter_names
- cancel_subscriptions
- close_sinks
- control_flow_in_finally
- empty_statements
- hash_and_equals
- invariant_booleans
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- literal_only_boolean_expressions
- no_adjacent_strings_in_list
- no_duplicate_case_values
- no_logic_in_create_state
- prefer_void_to_null
- test_types_in_equals
- throw_in_finally
- unnecessary_statements
- unrelated_type_equality_checks
- omit_local_variable_types
- use_key_in_widget_constructors
- valid_regexps
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_return_types_on_setters
- avoid_returning_null_for_void
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- await_only_futures
- camel_case_extensions
- camel_case_types
- cascade_invocations
- constant_identifier_names
- curly_braces_in_flow_control_structures
- directives_ordering
- empty_catches
- empty_constructor_bodies
- exhaustive_cases
- file_names
- implementation_imports
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- lines_longer_than_80_chars
- missing_whitespace_between_adjacent_strings
- non_constant_identifier_names
- null_closures
- one_member_abstracts
- only_throw_errors
- package_api_docs
- package_prefixed_library_names
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_null_aware_operators
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- provide_deprecation_message
- public_member_api_docs
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
- sort_unnamed_constructors_first
- type_annotate_public_apis
- type_init_formals
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- use_is_even_rather_than_modulo
- use_late_for_private_fields_and_variables
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_to_and_as_if_applicable
- package_names
- sort_pub_dependencies
- cast_nullable_to_non_nullable
- unnecessary_null_checks
- tighten_type_of_initializing_formals
- null_check_on_nullable_type_parameter
@@ -1,150 +0,0 @@
analyzer:
enable-experiment:
- extension-methods
exclude:
- lib/**/*.g.dart
- example/**
- lib/src/emoji
- lib/**/*.freezed.dart
- test/**
linter:
rules:
# these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
- always_use_package_imports
- avoid_empty_else
- avoid_relative_lib_imports
- avoid_slow_async_io
- avoid_types_as_parameter_names
- cancel_subscriptions
- close_sinks
- control_flow_in_finally
- empty_statements
- hash_and_equals
- invariant_booleans
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- literal_only_boolean_expressions
- no_adjacent_strings_in_list
- no_duplicate_case_values
- no_logic_in_create_state
- prefer_void_to_null
- test_types_in_equals
- throw_in_finally
- unnecessary_statements
- unrelated_type_equality_checks
- omit_local_variable_types
- use_key_in_widget_constructors
- valid_regexps
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_return_types_on_setters
- avoid_returning_null_for_void
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- await_only_futures
- camel_case_extensions
- camel_case_types
- cascade_invocations
- constant_identifier_names
- curly_braces_in_flow_control_structures
- directives_ordering
- empty_catches
- empty_constructor_bodies
- exhaustive_cases
- file_names
- implementation_imports
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- lines_longer_than_80_chars
- missing_whitespace_between_adjacent_strings
- non_constant_identifier_names
- null_closures
- one_member_abstracts
- only_throw_errors
- package_api_docs
- package_prefixed_library_names
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_null_aware_operators
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- provide_deprecation_message
- public_member_api_docs
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
- sort_unnamed_constructors_first
- type_annotate_public_apis
- type_init_formals
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- use_is_even_rather_than_modulo
- use_late_for_private_fields_and_variables
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_to_and_as_if_applicable
- package_names
- sort_pub_dependencies
- cast_nullable_to_non_nullable
- unnecessary_null_checks
- tighten_type_of_initializing_formals
- null_check_on_nullable_type_parameter
@@ -1,150 +0,0 @@
analyzer:
enable-experiment:
- extension-methods
exclude:
- lib/**/*.g.dart
- example/**
- lib/src/emoji
- lib/**/*.freezed.dart
- test/**
linter:
rules:
# these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
- always_use_package_imports
- avoid_empty_else
- avoid_relative_lib_imports
- avoid_slow_async_io
- avoid_types_as_parameter_names
- cancel_subscriptions
- close_sinks
- control_flow_in_finally
- empty_statements
- hash_and_equals
- invariant_booleans
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- literal_only_boolean_expressions
- no_adjacent_strings_in_list
- no_duplicate_case_values
- no_logic_in_create_state
- prefer_void_to_null
- test_types_in_equals
- throw_in_finally
- unnecessary_statements
- unrelated_type_equality_checks
- omit_local_variable_types
- use_key_in_widget_constructors
- valid_regexps
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_return_types_on_setters
- avoid_returning_null_for_void
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- await_only_futures
- camel_case_extensions
- camel_case_types
- cascade_invocations
- constant_identifier_names
- curly_braces_in_flow_control_structures
- directives_ordering
- empty_catches
- empty_constructor_bodies
- exhaustive_cases
- file_names
- implementation_imports
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- lines_longer_than_80_chars
- missing_whitespace_between_adjacent_strings
- non_constant_identifier_names
- null_closures
- one_member_abstracts
- only_throw_errors
- package_api_docs
- package_prefixed_library_names
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_null_aware_operators
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- provide_deprecation_message
- public_member_api_docs
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
- sort_unnamed_constructors_first
- type_annotate_public_apis
- type_init_formals
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- use_is_even_rather_than_modulo
- use_late_for_private_fields_and_variables
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_to_and_as_if_applicable
- package_names
- sort_pub_dependencies
- cast_nullable_to_non_nullable
- unnecessary_null_checks
- tighten_type_of_initializing_formals
- null_check_on_nullable_type_parameter