Skip to content

Commit

Permalink
Speed up ci (rrousselGit#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrousselGit authored Oct 30, 2022
1 parent 3ddbb5c commit 937d8ca
Show file tree
Hide file tree
Showing 62 changed files with 16,541 additions and 407 deletions.
65 changes: 48 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Build
on:
pull_request:
paths-ignore:
- '**.md'
- "**.md"
push:
branches:
- master
paths-ignore:
- '**.md'
- "**.md"
schedule:
# runs the CI everyday at 10AM
- cron: "0 10 * * *"
Expand All @@ -17,40 +17,71 @@ jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ${{ matrix.package_path }}

strategy:
matrix:
channel:
- stable
package_path:
- examples/counter
# TODO(rrousselGit) run CI on marvel once test
# - examples/marvel
- examples/pub
- examples/random_number
- examples/stackoverflow
- examples/todos
- packages/riverpod
- packages/riverpod/example
- packages/flutter_riverpod
- packages/flutter_riverpod/example
- packages/hooks_riverpod
- packages/hooks_riverpod/example
- packages/riverpod_annotation
# TODO(rrousselGit) update riverpod_cli test setup to be supported by the CI
# - packages/riverpod_cli
- packages/riverpod_generator
# TODO(rrousselGit) update riverpod_graph test setup to be supported by the CI
# - packages/riverpod_graph
- packages/riverpod_lint
# TODO(rousselGit) blocked by https://github.com/invertase/dart_custom_lint/issues/16
# - packages/riverpod_lint_flutter_test
- website

steps:
- uses: actions/checkout@v2

- uses: subosito/flutter-action@v2
- uses: actions/[email protected]
- uses: subosito/[email protected]
with:
channel: ${{ matrix.channel }}

- name: Add pub cache bin to PATH
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH

- name: Add pub cache to PATH
run: echo "PUB_CACHE="$HOME/.pub-cache"" >> $GITHUB_ENV

- run: dart pub global activate melos

- name: Install dependencies
run: melos bootstrap --ignore "codemod_riverpod_*,riverpod_cli"
run: flutter pub get

- name: Check format
run: melos exec --ignore="website_snippets" -- "flutter format --set-exit-if-changed ."

- name: Generate
run: melos exec --depends-on="build_runner" -- "dart run build_runner build --delete-conflicting-outputs"
run: flutter format --set-exit-if-changed .
if: matrix.package_path != 'website'

- name: Analyze
run: melos exec --ignore="codemod_riverpod_test*,riverpod_lint_flutter_test" -- "flutter analyze"
run: flutter analyze

- name: Run tests
run: melos run test
run: |
if test -d "test"; then
if grep -q flutter "pubspec.yaml"; then
flutter test --coverage
else
dart test
fi
fi
- name: Upload coverage to codecov
run: curl -s https://codecov.io/bash | bash
run: |
if test -d "test"; then
curl -s https://codecov.io/bash | bash
fi
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
pubspec.lock

# Ignoring generated files, as they pollute pull requests and can create merge conflicts
*.g.dart
*.freezed.dart
!packages/*/lib/**/*.freezed.dart

# Ignoring native folders of the example as they can be re-generated easily using:
# flutter create --platforms=android,ios,web,windows,macos .
**/example/android/
Expand Down
44 changes: 0 additions & 44 deletions examples/counter/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions examples/counter/lib/main.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
part of 'main.dart';

String getFoo() => 'Hello world 42';
172 changes: 172 additions & 0 deletions examples/marvel/lib/src/configuration.freezed.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target

part of 'configuration.dart';

// **************************************************************************
// FreezedGenerator
// **************************************************************************

T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');

Configuration _$ConfigurationFromJson(Map<String, dynamic> json) {
return _Configuration.fromJson(json);
}

/// @nodoc
mixin _$Configuration {
String get publicKey => throw _privateConstructorUsedError;
String get privateKey => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ConfigurationCopyWith<Configuration> get copyWith =>
throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $ConfigurationCopyWith<$Res> {
factory $ConfigurationCopyWith(
Configuration value, $Res Function(Configuration) then) =
_$ConfigurationCopyWithImpl<$Res, Configuration>;
@useResult
$Res call({String publicKey, String privateKey});
}

/// @nodoc
class _$ConfigurationCopyWithImpl<$Res, $Val extends Configuration>
implements $ConfigurationCopyWith<$Res> {
_$ConfigurationCopyWithImpl(this._value, this._then);

// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;

@pragma('vm:prefer-inline')
@override
$Res call({
Object? publicKey = null,
Object? privateKey = null,
}) {
return _then(_value.copyWith(
publicKey: null == publicKey
? _value.publicKey
: publicKey // ignore: cast_nullable_to_non_nullable
as String,
privateKey: null == privateKey
? _value.privateKey
: privateKey // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}

/// @nodoc
abstract class _$$_ConfigurationCopyWith<$Res>
implements $ConfigurationCopyWith<$Res> {
factory _$$_ConfigurationCopyWith(
_$_Configuration value, $Res Function(_$_Configuration) then) =
__$$_ConfigurationCopyWithImpl<$Res>;
@override
@useResult
$Res call({String publicKey, String privateKey});
}

/// @nodoc
class __$$_ConfigurationCopyWithImpl<$Res>
extends _$ConfigurationCopyWithImpl<$Res, _$_Configuration>
implements _$$_ConfigurationCopyWith<$Res> {
__$$_ConfigurationCopyWithImpl(
_$_Configuration _value, $Res Function(_$_Configuration) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
@override
$Res call({
Object? publicKey = null,
Object? privateKey = null,
}) {
return _then(_$_Configuration(
publicKey: null == publicKey
? _value.publicKey
: publicKey // ignore: cast_nullable_to_non_nullable
as String,
privateKey: null == privateKey
? _value.privateKey
: privateKey // ignore: cast_nullable_to_non_nullable
as String,
));
}
}

/// @nodoc
@JsonSerializable(fieldRename: FieldRename.snake)
class _$_Configuration implements _Configuration {
_$_Configuration({required this.publicKey, required this.privateKey});

factory _$_Configuration.fromJson(Map<String, dynamic> json) =>
_$$_ConfigurationFromJson(json);

@override
final String publicKey;
@override
final String privateKey;

@override
String toString() {
return 'Configuration(publicKey: $publicKey, privateKey: $privateKey)';
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_Configuration &&
(identical(other.publicKey, publicKey) ||
other.publicKey == publicKey) &&
(identical(other.privateKey, privateKey) ||
other.privateKey == privateKey));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, publicKey, privateKey);

@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_ConfigurationCopyWith<_$_Configuration> get copyWith =>
__$$_ConfigurationCopyWithImpl<_$_Configuration>(this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$_ConfigurationToJson(
this,
);
}
}

abstract class _Configuration implements Configuration {
factory _Configuration(
{required final String publicKey,
required final String privateKey}) = _$_Configuration;

factory _Configuration.fromJson(Map<String, dynamic> json) =
_$_Configuration.fromJson;

@override
String get publicKey;
@override
String get privateKey;
@override
@JsonKey(ignore: true)
_$$_ConfigurationCopyWith<_$_Configuration> get copyWith =>
throw _privateConstructorUsedError;
}
19 changes: 19 additions & 0 deletions examples/marvel/lib/src/configuration.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 937d8ca

Please sign in to comment.