Skip to content

Commit b5dac9e

Browse files
authored
feat: Add Github Actions (#77)
* 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
1 parent a74f8f3 commit b5dac9e

File tree

5 files changed

+65
-4
lines changed

5 files changed

+65
-4
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Code Quality
2+
3+
on: [push]
4+
5+
jobs:
6+
format-and-fix:
7+
if: ${{ !github.event.pull_request.draft }}
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
13+
- name: Setup flutter
14+
uses: subosito/flutter-action@v2
15+
with:
16+
channel: stable
17+
18+
- name: Get packages
19+
run: flutter pub get
20+
21+
- name: Check format errors
22+
run: flutter format --set-exit-if-changed .
23+
24+
- name: Check lint errors
25+
run: flutter analyze .
26+
27+
- name: Run tests
28+
run: flutter test
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Check PR title
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
11+
jobs:
12+
main:
13+
name: Validate PR title
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: deepakputhraya/action-pr-title@master
17+
with:
18+
max_length: 100
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
- uses: amannn/action-semantic-pull-request@v4
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

example/lib/main.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:badges/badges.dart';
2-
import 'package:flutter/cupertino.dart';
32
import 'package:flutter/material.dart';
43

54
void main() => runApp(MyApp());
@@ -142,13 +141,13 @@ class _HomeScreenState extends State<HomeScreen> {
142141
shape: BadgeShape.circle,
143142
position: BadgePosition.center(),
144143
borderRadius: BorderRadius.circular(100),
145-
child: Icon(Icons.settings),
146144
badgeContent: Container(
147145
height: 5,
148146
width: 5,
149147
decoration:
150148
BoxDecoration(shape: BoxShape.circle, color: Colors.white),
151149
),
150+
child: Icon(Icons.settings),
152151
),
153152
),
154153
],

example/test/widget_test.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
void main() {}
1+
import 'package:flutter_test/flutter_test.dart';
2+
3+
void main() {
4+
test('Mock test', () {
5+
expect(1, 1);
6+
});
7+
}

test/badges_test.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
void main() {}
1+
import 'package:flutter_test/flutter_test.dart';
2+
3+
void main() {
4+
test('Mock test', () {
5+
expect(1, 1);
6+
});
7+
}

0 commit comments

Comments
 (0)