Skip to content

Commit

Permalink
Revert "build: use melos (#755)"
Browse files Browse the repository at this point in the history
This reverts commit 2229f70.
  • Loading branch information
hoc081098 authored May 11, 2024
1 parent 2229f70 commit 623297b
Show file tree
Hide file tree
Showing 357 changed files with 374 additions and 2,034 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/flutter-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./examples/flutter/github_search
working-directory: ./example/flutter/github_search
steps:
- uses: actions/checkout@v4

Expand All @@ -26,12 +26,6 @@ jobs:
with:
channel: 'stable'

- name: Install melos
run: dart pub global activate melos

- name: Melos Boostrap
run: melos bootstrap

- name: Print Dart SDK version
run: dart --version

Expand Down
39 changes: 29 additions & 10 deletions .github/workflows/rxdart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Dart CI
on:
push:
branches: [ master ]
paths-ignore: [ '**.md', 'examples/**' ]
paths-ignore: [ '**.md', 'example/**' ]
pull_request:
branches: [ master ]
paths-ignore: [ '**.md', 'examples/**' ]
paths-ignore: [ '**.md', 'example/**' ]
schedule:
# Runs at 00:00 UTC on the 1, 8, 15, 22 and 29th of every month.
- cron: '0 0 */7 * *'
workflow_dispatch:

jobs:
analyze-and-test:
runs-on: ubuntu-latest
Expand All @@ -28,27 +28,46 @@ jobs:
with:
sdk: ${{ matrix.sdk }}

- name: Install melos
run: dart pub global activate melos

- name: Print Dart version
run: dart --version

- name: Install dependencies
run: melos run pub-get-no-private
run: dart pub get

- name: Analyze
if: ${{ matrix.sdk == 'stable' }}
run: melos run analyze-no-private
run: dart analyze --fatal-infos --fatal-warnings

- name: Format code
if: ${{ matrix.sdk == 'stable' }}
run: melos run format-no-private
run: dart format . --set-exit-if-changed

- name: Active coverage
run: dart pub global activate coverage

- name: Run tests
run: melos run test-rxdart
run: dart pub run test test/rxdart_test.dart --chain-stack-traces

- name: Start Observatory
run: dart
--disable-service-auth-codes
--enable-vm-service=8111
--pause-isolates-on-exit
--enable-asserts
test/rxdart_test.dart &

- name: Collect coverage
run: nohup dart pub global run coverage:collect_coverage
--port=8111
--out=coverage.json
--wait-paused
--resume-isolates

- name: Format coverage
run: dart pub global run coverage:format_coverage
--lcov
--in=coverage.json
--out=lcov.info
--report-on=lib

- uses: codecov/[email protected]
24 changes: 2 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.dart_tool/
.pub/
build/
packages
*.packages
.idea/
web/experimental
Expand All @@ -16,26 +17,5 @@ doc
*.js.map

# Include when developing application packages.
pubspec.lock
coverage*
lcov.info

# https://melos.invertase.dev/~melos-latest/getting-started#configure-the-workspace
pubspec_overrides.yaml

# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
File renamed without changes.
File renamed without changes.
260 changes: 254 additions & 6 deletions README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ analyzer:
language:
strict-casts: true
strict-raw-types: true
exclude:
- 'example/**'

linter:
rules:
Expand Down
5 changes: 5 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
targets:
$default:
builders:
build_web_compilers|entrypoint:
generate_for: ['example/web/**']
4 changes: 4 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:lints/recommended.yaml
analyzer:
exclude:
- 'flutter/**'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

class EmptyWidget extends StatelessWidget {
const EmptyWidget({super.key});
const EmptyWidget({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void main() => runApp(SearchApp(api: GithubApi()));
class SearchApp extends StatelessWidget {
final GithubApi api;

const SearchApp({super.key, required this.api});
const SearchApp({Key? key, required this.api}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

class SearchErrorWidget extends StatelessWidget {
const SearchErrorWidget({super.key});
const SearchErrorWidget({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

class SearchIntro extends StatelessWidget {
const SearchIntro({super.key});
const SearchIntro({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

class LoadingWidget extends StatelessWidget {
const LoadingWidget({super.key});
const LoadingWidget({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'github_api.dart';
class SearchResultWidget extends StatelessWidget {
final List<SearchResultItem> items;

const SearchResultWidget({super.key, required this.items});
const SearchResultWidget({Key? key, required this.items}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -15,7 +15,6 @@ class SearchResultWidget extends StatelessWidget {
final item = items[index];

return InkWell(
key: ValueKey(item.url),
onTap: () => showItem(context, item),
child: Container(
alignment: FractionalOffset.center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:flutter/foundation.dart';

import 'github_api.dart';

// The State represents the data the View requires. The View consumes a Stream
Expand All @@ -11,8 +9,7 @@ import 'github_api.dart';
//
// The State Stream responds to input from the View by accepting a
// Stream<String>. We call this Stream the onTextChanged "intent".
@immutable
sealed class SearchState {}
class SearchState {}

class SearchLoading extends SearchState {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'search_state.dart';
class SearchScreen extends StatefulWidget {
final GithubApi api;

const SearchScreen({super.key, required this.api});
const SearchScreen({Key? key, required this.api}) : super(key: key);

@override
SearchScreenState createState() {
Expand Down Expand Up @@ -76,10 +76,6 @@ class SearchScreenState extends State<SearchScreen> {
Widget _buildSearchBar() {
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Theme.of(context).cardColor,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expand Down Expand Up @@ -111,21 +107,26 @@ class SearchScreenState extends State<SearchScreen> {
),
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Theme.of(context).cardColor,
),
);
}

Widget _buildChild(SearchState state) {
switch (state) {
case SearchNoTerm():
return const SearchIntro();
case SearchEmpty():
return const EmptyWidget();
case SearchLoading():
return const LoadingWidget();
case SearchError():
return const SearchErrorWidget();
case SearchPopulated():
return SearchResultWidget(items: state.result.items);
if (state is SearchNoTerm) {
return const SearchIntro();
} else if (state is SearchEmpty) {
return const EmptyWidget();
} else if (state is SearchLoading) {
return const LoadingWidget();
} else if (state is SearchError) {
return const SearchErrorWidget();
} else if (state is SearchPopulated) {
return SearchResultWidget(items: state.result.items);
}

throw Exception('${state.runtimeType} is not supported');
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ publish_to: 'none'
description: Flutter Github Search RxDart Example.

environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0 <4.0.0"
sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
rxdart:
path: ../../../packages/rxdart
path: ../../../
http: ^0.13.3
flutter_spinkit: ^5.1.0

dev_dependencies:
flutter_lints: ^4.0.0
flutter_lints: ^1.0.4
test: ^1.17.10
mockito: ^5.4.4
build_runner: ^2.4.9
mockito: ^5.0.15
build_runner: ^2.1.2
flutter_test:
sdk: flutter

Expand Down
30 changes: 30 additions & 0 deletions example/flutter/github_search/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:github_search/main.dart';

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions examples/fibonacci/analysis_options.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions examples/fibonacci/pubspec.lock

This file was deleted.

12 changes: 0 additions & 12 deletions examples/fibonacci/pubspec.yaml

This file was deleted.

Loading

0 comments on commit 623297b

Please sign in to comment.