Skip to content

Commit

Permalink
feat: Added modern workflow for SurfGear packages (#27)
Browse files Browse the repository at this point in the history
* feat(fvm): added fvm

* fix(fvm): fix gitgnore

* feat(analyze): updated lint rules & fixed some lints

* feat(workflow): updated workflow

* fix(ci): added fvm dependency for step

* fix(workflow): Fix publish workflow

---------

Co-authored-by: Maxim Sysoev <[email protected]>
  • Loading branch information
plasticfiresam and maxim-sysoev authored Jul 21, 2023
1 parent 514dd46 commit 36fd61b
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.7.6",
"flavors": {}
}
33 changes: 29 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,51 @@ on:
pull_request:
branches:
- main
- dev
push:
branches:
- main
- dev
tags-ignore:
- '**'
- "**"

jobs:
get_fvm_version:
outputs:
flutter_version: ${{ steps.fvm_version.outputs.flutterSdkVersion }}
name: "Get Flutter version from FVM"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- id: fvm_version
uses: zoexx/github-action-json-file-properties@release
with:
file_path: ".fvm/fvm_config.json"

analysis:
needs: get_fvm_version
uses: surfstudio/flutter-ci-workflows/.github/workflows/analysis.yml@main
with:
flutter-version: ${{ needs.get_fvm_version.outputs.flutter_version }}

testing:
needs: analysis
needs: [analysis, get_fvm_version]
uses: surfstudio/flutter-ci-workflows/.github/workflows/testing.yml@main
with:
flutter-version: ${{ needs.get_fvm_version.outputs.flutter_version }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build_android_example:
needs: analysis
needs: [analysis, get_fvm_version]
uses: surfstudio/flutter-ci-workflows/.github/workflows/build_android_example.yml@main
with:
flutter-version: ${{ needs.get_fvm_version.outputs.flutter_version }}

build_ios_example:
needs: analysis
needs: [analysis, get_fvm_version]
uses: surfstudio/flutter-ci-workflows/.github/workflows/build_ios_example.yml@main
with:
flutter-version: ${{ needs.get_fvm_version.outputs.flutter_version }}
20 changes: 19 additions & 1 deletion .github/workflows/publish_to_pub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,31 @@ on:
- v*

jobs:
get_fvm_version:
outputs:
flutter_version: ${{ steps.fvm_version.outputs.flutterSdkVersion }}
name: "Get Flutter version from FVM"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- id: fvm_version
uses: zoexx/github-action-json-file-properties@release
with:
file_path: ".fvm/fvm_config.json"

analysis:
needs: get_fvm_version
uses: surfstudio/flutter-ci-workflows/.github/workflows/analysis.yml@main
with:
flutter-version: ${{ needs.get_fvm_version.outputs.flutter_version }}

testing:
needs: analysis
needs: [get_fvm_version, analysis]
uses: surfstudio/flutter-ci-workflows/.github/workflows/testing.yml@main
secrets:
flutter-version: ${{ needs.get_fvm_version.outputs.flutter_version }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

package-publishing:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
.pub-cache/
.pub/
build/
.fvm/flutter_sdk

# Android related
**/android/**/gradle-wrapper.jar
Expand Down
4 changes: 4 additions & 0 deletions example/.fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.7.6",
"flavors": {}
}
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
.pub-cache/
.pub/
build/
.fvm/flutter_sdk

# Android related
**/android/**/gradle-wrapper.jar
Expand Down
2 changes: 2 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// ignore_for_file: library_private_types_in_public_api

import 'dart:async';

import 'package:flutter/material.dart';
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
path: ../

dev_dependencies:
surf_lint_rules: ^1.0.0
surf_lint_rules: ^2.0.0

flutter:
uses-material-design: true
2 changes: 2 additions & 0 deletions lib/src/material_swipe_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// ignore_for_file: library_private_types_in_public_api

import 'dart:async';

import 'package:flutter/material.dart';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
mocktail: ^0.2.0
surf_lint_rules: ^1.5.0
surf_lint_rules: ^2.0.0

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
8 changes: 4 additions & 4 deletions test/swipe_refresh_adaptive_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void main() {
await controller.close();
});

Future<void> _onRefresh() async {
Future<void> onRefresh() async {
await Future<void>.delayed(const Duration(seconds: 3));

controller.sink.add(SwipeRefreshState.hidden);
Expand All @@ -60,7 +60,7 @@ void main() {
final adaptiveSwipeRefresh = makeTestableWidget(
SwipeRefresh.adaptive(
stateStream: stream,
onRefresh: _onRefresh,
onRefresh: onRefresh,
children: listColors
.map(
(e) => Container(
Expand Down Expand Up @@ -88,7 +88,7 @@ void main() {
final adaptiveSwipeRefresh = makeTestableWidget(
SwipeRefresh.adaptive(
stateStream: stream,
onRefresh: _onRefresh,
onRefresh: onRefresh,
children: listColors
.map(
(e) => Container(
Expand Down Expand Up @@ -117,7 +117,7 @@ void main() {
final adaptiveSwipeRefresh = makeTestableWidget(
SwipeRefresh.adaptive(
stateStream: stream,
onRefresh: _onRefresh,
onRefresh: onRefresh,
children: listColors
.map(
(e) => Container(
Expand Down
4 changes: 2 additions & 2 deletions test/swipe_refresh_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void main() {
await controller.close();
});

Future<void> _onRefresh() async {
Future<void> onRefresh() async {
await Future<void>.delayed(const Duration(seconds: 3));

controller.sink.add(SwipeRefreshState.hidden);
Expand All @@ -61,7 +61,7 @@ void main() {
final testWidget = makeTestableWidget(
SwipeRefresh.builder(
stateStream: stream,
onRefresh: _onRefresh,
onRefresh: onRefresh,
itemCount: listColors.length,
itemBuilder: (_, index) => Container(
color: listColors[index],
Expand Down

0 comments on commit 36fd61b

Please sign in to comment.