Skip to content

Commit

Permalink
Merge pull request Almoullim#212 from BWMuller/github-action-cleanup
Browse files Browse the repository at this point in the history
Split publish and lint+test github actions
  • Loading branch information
MoralCode authored May 29, 2024
2 parents be8a29b + 816a412 commit f1ef284
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 65 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint + Test

on:
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened, labeled, unlabeled]

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable

- name: Install Flutter
uses: subosito/flutter-action@v2

- name: Install packages
run: flutter pub get

- name: Linter
run: flutter analyze

- name: Test example package
run: |
cd example
flutter test
3 changes: 0 additions & 3 deletions .github/workflows/dart.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Publish

on:
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened, labeled, unlabeled]
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]

Expand Down
70 changes: 47 additions & 23 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.12.0"
version: "0.13.0"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -44,10 +44,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -74,38 +74,62 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
matcher:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.12.0"
path:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -123,18 +147,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
Expand All @@ -155,10 +179,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.7.0"
vector_math:
dependency: transitive
description:
Expand All @@ -167,14 +191,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
vm_service:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "14.2.1"
sdks:
dart: ">=3.1.0 <4.0.0"
flutter: ">=3.0.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
4 changes: 1 addition & 3 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import 'package:flutter_test/flutter_test.dart';

import '../lib/main.dart';



void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
Expand All @@ -21,7 +19,7 @@ void main() {
expect(
find.byWidgetPredicate(
(Widget widget) =>
widget is Text && widget.data!.startsWith('Running on:'),
widget is Text && widget.data!.startsWith('IsServiceRunning:'),
),
findsOneWidget,
);
Expand Down
36 changes: 17 additions & 19 deletions lib/background_location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BackgroundLocation {
MethodChannel('com.almoullim.background_location/methods');

/// Stop receiving location updates
static stopLocationService() async {
static Future<dynamic> stopLocationService() async {
return await _channel.invokeMethod('stop_location_service');
}

Expand All @@ -24,44 +24,42 @@ class BackgroundLocation {
}

/// Start receiving location updated
static startLocationService({double distanceFilter = 0.0, bool forceAndroidLocationManager = false}) async {
static Future<dynamic> startLocationService({double distanceFilter = 0.0, bool forceAndroidLocationManager = false}) async {
return await _channel.invokeMethod('start_location_service',
<String, dynamic>{'distance_filter': distanceFilter, 'force_location_manager': forceAndroidLocationManager});
}

static setAndroidNotification(
static Future<dynamic> setAndroidNotification(
{String? title, String? message, String? icon}) async {
if (Platform.isAndroid) {
return await _channel.invokeMethod('set_android_notification',
<String, dynamic>{'title': title, 'message': message, 'icon': icon});
} else {
//return Promise.resolve();
}
}

static setAndroidConfiguration(int interval) async {
static Future<dynamic> setAndroidConfiguration(int interval) async {
if (Platform.isAndroid) {
return await _channel.invokeMethod('set_configuration', <String, dynamic>{
'interval': interval.toString(),
});
} else {
//return Promise.resolve();
}
}

/// Get the current location once.
Future<Location> getCurrentLocation() async {
var completer = Completer<Location>();

var _location = Location();
await getLocationUpdates((location) {
_location.latitude = location.latitude;
_location.longitude = location.longitude;
_location.accuracy = location.accuracy;
_location.altitude = location.altitude;
_location.bearing = location.bearing;
_location.speed = location.speed;
_location.time = location.time;
getLocationUpdates((location) {
var _location = Location(
latitude: location.latitude,
longitude: location.longitude,
accuracy: location.accuracy,
altitude: location.altitude,
bearing: location.bearing,
speed: location.speed,
time: location.time,
isMock: location.isMock,
);
completer.complete(_location);
});

Expand All @@ -72,7 +70,7 @@ class BackgroundLocation {

/// Register a function to recive location updates as long as the location
/// service has started
static getLocationUpdates(Function(Location) location) {
static void getLocationUpdates(Function(Location) location) {
// add a handler on the channel to recive updates from the native classes
_channel.setMethodCallHandler((MethodCall methodCall) async {
if (methodCall.method == 'location') {
Expand Down Expand Up @@ -115,7 +113,7 @@ class Location {
@required this.time,
@required this.isMock});

toMap() {
Map<String, dynamic> toMap() {
var obj = {
'latitude': latitude,
'longitude': longitude,
Expand Down
17 changes: 0 additions & 17 deletions test/background_location_test.dart

This file was deleted.

0 comments on commit f1ef284

Please sign in to comment.