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

Added Workflow so it tests the code on each push/PR to master #108

Closed
wants to merge 8 commits into from
Closed
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
35 changes: 35 additions & 0 deletions .github/workflows/unit_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will test the Dart code in the repository
# to make sure that the quality of the code is high.
name: Dart
on:
push:
# Run the workflow on the master branch on push
branches: [ "master" ]
pull_request:
# Run the workflow on the master branch on pull requests
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.24.0
# Install dependencies
- name: Install dependencies
run: flutter pub get

# Check for formatting issues
- name: Check formatting
run: dart format --set-exit-if-changed .

# Analyze the project source
- name: Analyze project source
run: flutter analyze --fatal-infos --fatal-warnings

# Run test to ensure that the code is working as expected
- name: Run tests
run: flutter test
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ analyzer:
linter:
rules:
prefer_constructors_over_static_methods: false
sort_pub_dependencies: false
2 changes: 1 addition & 1 deletion lib/src/model/error_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ final class ErrorModel<T extends INetworkModel<T>?> extends IErrorModel<T> {
/// Error model for network response
/// [statusCode] Error status code as http result
/// [description] Error message
const ErrorModel({super.statusCode, super.description, super.model});
const ErrorModel({super.statusCode, super.description, super.model});

/// Null is returned after parsing a model
factory ErrorModel.parseError() {
Expand Down
5 changes: 5 additions & 0 deletions test/unit/model/network_manager_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:flutter_test/flutter_test.dart';

void main() {
setUp(() {});
}
Loading