Skip to content

Commit b70c8e4

Browse files
authored
Create flutter.yml (#7)
* Create flutter.yml * add pedantic * lint
1 parent 378f30b commit b70c8e4

8 files changed

Lines changed: 88 additions & 1 deletion

File tree

.github/workflows/flutter.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- uses: subosito/flutter-action@v1.4.0
17+
with:
18+
channel: 'stable'
19+
20+
- name: Doctor
21+
run: flutter doctor
22+
23+
- name: Install dependencies
24+
run: flutter packages get
25+
26+
- name: Format
27+
run: flutter format lib test example --set-exit-if-changed
28+
29+
- name: Analyze
30+
run: flutter analyze lib test example
31+
32+
- name: Run tests
33+
run: flutter test --coverage --coverage-path=lcov.info
34+
35+
- uses: codecov/codecov-action@v1

example/ios/Flutter/Debug.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Podfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
end
36+
37+
post_install do |installer|
38+
installer.pods_project.targets.each do |target|
39+
flutter_additional_ios_build_settings(target)
40+
end
41+
end

example/lib/data/app_db.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Future<Database> _open() async {
2727
);
2828

2929
final batch = db.batch();
30-
for (int i = 0; i < 10; i++) {
30+
for (var i = 0; i < 10; i++) {
3131
batch.insert(
3232
_tableItems,
3333
Item(

example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class _MyHomePageState extends State<MyHomePage> {
5555
super.dispose();
5656
}
5757

58+
@override
5859
Widget build(BuildContext context) {
5960
return Scaffold(
6061
appBar: AppBar(

example/pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ packages:
144144
url: "https://pub.dartlang.org"
145145
source: hosted
146146
version: "2.0.0"
147+
pedantic:
148+
dependency: "direct main"
149+
description:
150+
name: pedantic
151+
url: "https://pub.dartlang.org"
152+
source: hosted
153+
version: "1.11.0"
147154
platform:
148155
dependency: transitive
149156
description:

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dependencies:
1515
intl: ^0.17.0
1616
sqlbrite:
1717
path: ../
18+
pedantic: ^1.10.0
1819

1920
dev_dependencies:
2021
flutter_test:

0 commit comments

Comments
 (0)