Skip to content

Commit

Permalink
build: use melos (#755)
Browse files Browse the repository at this point in the history
* move rxdart source to packages/rxdart dir

* setup melos

* setup melos

* setup melos

* done example

* example => xamples

* ignore

* update melos.yaml

* update melos.yaml

* update melos.yaml

* update melos.yaml

* fix CI

* fix CI

* fix CI

* fix sample

* fix ci

* readme

* readme

* dart 3 sealed class to github_search example

* fix tests

* fix tests
  • Loading branch information
hoc081098 authored May 11, 2024
1 parent 7a7a375 commit 2229f70
Show file tree
Hide file tree
Showing 357 changed files with 2,034 additions and 374 deletions.
8 changes: 7 additions & 1 deletion .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: ./example/flutter/github_search
working-directory: ./examples/flutter/github_search
steps:
- uses: actions/checkout@v4

Expand All @@ -26,6 +26,12 @@ 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: 10 additions & 29 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', 'example/**' ]
paths-ignore: [ '**.md', 'examples/**' ]
pull_request:
branches: [ master ]
paths-ignore: [ '**.md', 'example/**' ]
paths-ignore: [ '**.md', 'examples/**' ]
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,46 +28,27 @@ 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: dart pub get
run: melos run pub-get-no-private

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

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

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

- name: Run tests
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
run: melos run test-rxdart

- uses: codecov/[email protected]
24 changes: 22 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
.dart_tool/
.pub/
build/
packages
*.packages
.idea/
web/experimental
Expand All @@ -17,5 +16,26 @@ 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/
260 changes: 6 additions & 254 deletions README.md

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions build.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions example/analysis_options.yaml

This file was deleted.

30 changes: 0 additions & 30 deletions example/flutter/github_search/test/widget_test.dart

This file was deleted.

File renamed without changes.
13 changes: 13 additions & 0 deletions examples/fibonacci/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include: package:lints/recommended.yaml

analyzer:
language:
strict-casts: true
strict-raw-types: true

linter:
rules:
- always_declare_return_types # https://github.com/dart-lang/lints#migrating-from-packagepedantic
- prefer_single_quotes # https://github.com/dart-lang/lints#migrating-from-packagepedantic
- unawaited_futures # https://github.com/dart-lang/lints#migrating-from-packagepedantic
- unsafe_html # https://github.com/dart-lang/lints#migrating-from-packagepedantic
File renamed without changes.
20 changes: 20 additions & 0 deletions examples/fibonacci/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
lints:
dependency: "direct dev"
description:
name: lints
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
rxdart:
dependency: "direct main"
description:
path: "../../packages/rxdart"
relative: true
source: path
version: "0.28.0-dev.2"
sdks:
dart: ">=3.1.0 <4.0.0"
12 changes: 12 additions & 0 deletions examples/fibonacci/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: rxdart_fibonacci_example
publish_to: none

environment:
sdk: '>=3.0.0 <4.0.0'

dependencies:
rxdart:
path: ../../packages/rxdart

dev_dependencies:
lints: ^4.0.0
42 changes: 42 additions & 0 deletions examples/flutter/github_search/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
*.mocks.dart

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json
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({Key? key}) : super(key: key);
const EmptyWidget({super.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({Key? key, required this.api}) : super(key: key);
const SearchApp({super.key, required this.api});

@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({Key? key}) : super(key: key);
const SearchErrorWidget({super.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({Key? key}) : super(key: key);
const SearchIntro({super.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({Key? key}) : super(key: key);
const LoadingWidget({super.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({Key? key, required this.items}) : super(key: key);
const SearchResultWidget({super.key, required this.items});

@override
Widget build(BuildContext context) {
Expand All @@ -15,6 +15,7 @@ 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,3 +1,5 @@
import 'package:flutter/foundation.dart';

import 'github_api.dart';

// The State represents the data the View requires. The View consumes a Stream
Expand All @@ -9,7 +11,8 @@ 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".
class SearchState {}
@immutable
sealed class SearchState {}

class SearchLoading extends SearchState {}

Expand Down
Loading

0 comments on commit 2229f70

Please sign in to comment.