From 186d02d9d502de378fc57940415fa16af637532c Mon Sep 17 00:00:00 2001 From: Felipe Benevides Date: Tue, 23 Aug 2022 16:15:25 +0200 Subject: [PATCH] CI process (#68) Implement automated CI process --- .github/workflows/ci.yml | 64 ++++++++++++++++++++++++++ analysis_options.yaml | 16 +++++++ lib/pusher_channels_flutter_web.dart | 2 - test/pusher_channels_flutter_test.dart | 1 - 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6620ef3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +on: + pull_request: + branches: [ master ] + +jobs: + analyze: + runs-on: ubuntu-latest + name: 'analyze' + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.0.5' + - run: | + flutter pub get + flutter analyze + + build-android: + runs-on: ubuntu-latest + needs: analyze + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '11' + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.0.5' + - name: build apk + run: | + cd example + flutter pub get + flutter build apk + flutter build appbundle + + build-ios: + runs-on: macos-latest + needs: analyze + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + architecture: x64 + - name: build ios + run: | + cd example + flutter pub get + flutter build ios --release --no-codesign + + build-web: + runs-on: ubuntu-latest + needs: analyze + steps: + - uses: actions/checkout@v3 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: build web + run: | + cd example + flutter pub get + flutter build web diff --git a/analysis_options.yaml b/analysis_options.yaml index a5744c1..612626c 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,3 +2,19 @@ include: package:flutter_lints/flutter.yaml # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options + +analyzer: + exclude: [lib/pusher-js, example/**] + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. diff --git a/lib/pusher_channels_flutter_web.dart b/lib/pusher_channels_flutter_web.dart index 0cf77cc..35cbaf4 100644 --- a/lib/pusher_channels_flutter_web.dart +++ b/lib/pusher_channels_flutter_web.dart @@ -2,7 +2,6 @@ library pusher_channels_flutter; import 'dart:async'; -import 'dart:convert'; import 'package:js/js.dart'; import 'package:js/js_util.dart' as js_util; // In order to *not* need this ignore, consider extracting the 'web' version @@ -128,7 +127,6 @@ class PusherChannelsFlutterWeb { final Map data = msg['data'] ?? {}; String? userId = data['user_id']; final Map? userInfo = data['user_info']; - print('onMessage: ${jsonEncode(msg)}'); if (event == 'pusher_internal:subscription_error') { methodChannel!.invokeMethod( diff --git a/test/pusher_channels_flutter_test.dart b/test/pusher_channels_flutter_test.dart index 6557575..b3eab1a 100644 --- a/test/pusher_channels_flutter_test.dart +++ b/test/pusher_channels_flutter_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:pusher_channels_flutter/pusher_channels_flutter.dart'; void main() { const MethodChannel channel = MethodChannel('pusher_channels_flutter');