Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup github actions #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: inheritable

on:
push:

# env:
# ACTIONS_RUNNER_DEBUG: true
# FLUTTER_VERSION: "2.2.3"

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout the code
uses: actions/checkout@v2

- name: Install and set Flutter version
uses: subosito/[email protected]
with:
channel: 'stable'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, also the beta channel? with optional run so it doesn't block PRs from merging but still helpful to know when things stop working on beta


- name: install packages
run: flutter pub get

- name: Analyze
run: flutter analyze

- name: prepare test
run: |
./test/coverage_helper.sh

- name: Run tests
run: |
flutter test --coverage

# - name: get coverage and prepare percentage for badge
# run: |
# brew install lcov
# PERCENTAGE=$(lcov --remove coverage/lcov.info 'lib/*/*.freezed.dart' 'lib/*/*.g.dart' 'lib/*/*.part.dart' 'lib/generated/*.dart' 'lib/generated/*.*.dart' -o coverage/lcov.info | egrep '\d+.\d+%' | cut -d' ' -f4)
# echo "COVERAGE=${PERCENTAGE}" >> $GITHUB_ENV

# - name: Create the Badge
# uses: schneegans/[email protected]
# with:
# auth: ${{ secrets.GIST_ACCESS_COVERAGE }}
# gistID: 8a0e501902cba357972bc73b1f911804
Comment on lines +37 to +47
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any alternatives to this? Could we just create a local badge and display that in the readme.

# filename: capp_bauhaus_coverage_badge_last_run.json
# label: coverage-last-run
# message: ${{ env.COVERAGE }}
# color: blue
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing, EOF new line

6 changes: 4 additions & 2 deletions lib/inheritable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ abstract class AspectBatch {
for (var i in inheritables.toList().reversed) {
var l = aspects.length;

// ignore: unused_local_variable
final pending = [];

/// Apply aspects in insertion order
Expand Down Expand Up @@ -1913,11 +1914,13 @@ class _InheritableElement<T> extends InheritedElement {
@override
Inheritable<T> get widget => super.widget as Inheritable<T>;

// ignore: unused_element
int _hashAspect<T>(InheritableAspect<T> aspect) {
if (aspect is EquatableAspect<T>) return aspect._hash();
return aspect.hashCode;
}

// ignore: unused_element
bool _equalsAspect<T>(InheritableAspect<T> a, InheritableAspect<T> b) {
if (a is EquatableAspect<T>) return a._equals(b);

Expand Down Expand Up @@ -1945,8 +1948,7 @@ class _InheritableElement<T> extends InheritedElement {
bool removeKey(Element dependent, Key key) {
final dependencies = getDependencies(dependent);

if (dependencies == null || dependencies.isEmpty || key == null)
return false;
if (dependencies == null || dependencies.isEmpty) return false;

assert(dependencies.containsKey(key));
final removed = dependencies.remove(key) != null;
Expand Down
3 changes: 3 additions & 0 deletions lib/src/_wip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ mixin SetDefaultAspect<A, T> on TransformingAspect<A, T> {
set defaultValue(A value);
}

// ignore: unused_element
abstract class _DefaultAspectValue<A, T> extends InheritableAspect<T>
with
DependableAspect<T>,
ShouldNotifyAspect<A, T>,
TransformingAspect<A, T>,
SetDefaultAspect<A, T>,
DefaultAspectofContext<A, T> {
// ignore: unused_field
final InheritableAspect<T> _delegate;

_DefaultAspectValue(this._delegate)
Expand Down Expand Up @@ -153,6 +155,7 @@ mixin AutoDisposeAspectResourcesElement on Element {
@override
void unmount() {
_aspectsInUse.forEach((a, _) => a.dispose(this));
// ignore: cascade_invocations
_aspectsInUse.clear();

super.unmount();
Expand Down
4 changes: 4 additions & 0 deletions test/coverage_helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# see https://github.com/flutter/flutter/issues/27997#issue-410722816
find lib '!' -path '*generated*/*' '!' -name '*.g.dart' '!' -name '*.part.dart' '!' -name '*.freezed.dart' -name '*.dart' | cut -c4- | awk -v package=$1 '{printf "import '\''package:capp_bauhaus%s%s'\'';\n", package, $1}' >> test/coverage_helper_file.dart

echo "void main(){}" >> test/coverage_helper_file.dart
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing EOF newline