Skip to content

Commit

Permalink
Release/v0.0.1 dev.3 (#3)
Browse files Browse the repository at this point in the history
* style: Added very_good_analysis for hooks

* style: Added exception for template analysis

* build: Added very_good_analysis dependency

* style: Fixed analysis issues

* ci: Added GitHub workflow
  • Loading branch information
yardexx authored Nov 5, 2022
1 parent e3b9efc commit a2f20c4
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 5 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/brick_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Very Good Workflow

on:
pull_request:
paths:
- "lib/**"
- "test/**"
- "pubspec.yaml"
push:
branches:
- main
paths:
- "hooks/**"
- "hooks/test/**"
- "pubspec.yaml"

jobs:
semantic-pull-request:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1

build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1

ci:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./hooks

steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Install Dependencies
run: dart pub get

- name: Format
run: dart format --set-exit-if-changed .

- name: Analyze
run: dart analyze --fatal-infos --fatal-warnings .

- name: Run Tests
run: |
dart pub global activate coverage 1.3.0
dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --report-on=lib
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Don't analyze templates
analyzer:
exclude: [__brick__]
1 change: 1 addition & 0 deletions hooks/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:very_good_analysis/analysis_options.3.0.1.yaml
6 changes: 3 additions & 3 deletions hooks/post_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:mason/mason.dart';
const String androidBuild = 'build.gradle';
const String flutterBuild = 'lib';

void run(HookContext context) async {
Future<void> run(HookContext context) async {
final logger = context.logger;

await _runPubAdd(logger);
Expand Down Expand Up @@ -42,6 +42,6 @@ Future<void> _runDartFix(Logger logger) async {
final progress = logger.progress('Running dart fix --apply');
final result = await Process.run('dart', ['fix', '--apply']);
return result.exitCode == 0
? progress.complete('Fix applied')
: progress.fail('Fix couldn\'t be applied');
? progress.complete('Fix applied.')
: progress.fail("Fix couldn't be applied");
}
4 changes: 2 additions & 2 deletions hooks/pre_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:mason/mason.dart';
const defaultAppPackage = 'com.example.app';

void run(HookContext context) {
final isAndroid = context.vars['android'];
final isIOS = context.vars['ios'];
final isAndroid = context.vars['android'] as bool;
final isIOS = context.vars['ios'] as bool;

if (isAndroid) parseAndroidData(context);

Expand Down
3 changes: 3 additions & 0 deletions hooks/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ environment:

dependencies:
mason: ^0.1.0-dev

dev_dependencies:
very_good_analysis: ^3.1.0

0 comments on commit a2f20c4

Please sign in to comment.