Skip to content

Commit

Permalink
feat: Add Github Actions (#77)
Browse files Browse the repository at this point in the history
* feat: Add conventional-pr-title.yml

* feat: Github Action for formatting, lint and tests

* refactor: remove unused import

* fix: dummy test to make Github Actions workflow work

* fix: dummy test for GitHub Actions workflow to finish
  • Loading branch information
yadaniyil authored Nov 17, 2022
1 parent a74f8f3 commit b5dac9e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/code-quality-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Code Quality

on: [push]

jobs:
format-and-fix:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup flutter
uses: subosito/flutter-action@v2
with:
channel: stable

- name: Get packages
run: flutter pub get

- name: Check format errors
run: flutter format --set-exit-if-changed .

- name: Check lint errors
run: flutter analyze .

- name: Run tests
run: flutter test
22 changes: 22 additions & 0 deletions .github/workflows/conventional-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check PR title

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: deepakputhraya/action-pr-title@master
with:
max_length: 100
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:badges/badges.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());
Expand Down Expand Up @@ -142,13 +141,13 @@ class _HomeScreenState extends State<HomeScreen> {
shape: BadgeShape.circle,
position: BadgePosition.center(),
borderRadius: BorderRadius.circular(100),
child: Icon(Icons.settings),
badgeContent: Container(
height: 5,
width: 5,
decoration:
BoxDecoration(shape: BoxShape.circle, color: Colors.white),
),
child: Icon(Icons.settings),
),
),
],
Expand Down
8 changes: 7 additions & 1 deletion example/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
void main() {}
import 'package:flutter_test/flutter_test.dart';

void main() {
test('Mock test', () {
expect(1, 1);
});
}
8 changes: 7 additions & 1 deletion test/badges_test.dart
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
void main() {}
import 'package:flutter_test/flutter_test.dart';

void main() {
test('Mock test', () {
expect(1, 1);
});
}

0 comments on commit b5dac9e

Please sign in to comment.