Skip to content

Commit 6853a20

Browse files
authored
[MOB-9398] Add CI Quality Checks (#254)
* Add pana package for score checking * Format config.yml file using YAML formatter * Add lint_flutter job for lint and format checking * Add verify_pub job for score checking and dry-run * Run CI tests on Flutter 2.10.5 * Separate format checking in a new job
1 parent 05fd297 commit 6853a20

File tree

2 files changed

+57
-17
lines changed

2 files changed

+57
-17
lines changed

.circleci/config.yml

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
22
jobs:
3-
android_tests:
3+
android_tests:
44
working_directory: ~/project/example/android
55
macos:
66
xcode: "13.4.1"
@@ -43,7 +43,7 @@ jobs:
4343
name: unzip flutter SDK
4444
command: unzip ~/flutter_sdk.zip -d ~
4545
- run: flutter doctor
46-
- run:
46+
- run:
4747
name: Flutter build
4848
command: cd ..; flutter build apk
4949
- run:
@@ -56,36 +56,34 @@ jobs:
5656
# name: Run UI Tests
5757
# command: ./gradlew app:connectedAndroidTest
5858

59-
flutter_tests:
59+
flutter_tests:
6060
docker:
6161
- image: cirrusci/flutter
6262
steps:
6363
- checkout
6464
- run: sudo gem install bundler:2.1.4
65-
- run: bundle check || sudo bundle install
65+
- run: bundle check || sudo bundle install
6666
- run: bundle exec danger
6767
- run: flutter doctor
6868
- run: flutter packages get
6969
- run: flutter pub run build_runner build --delete-conflicting-outputs
7070
- run: flutter test --coverage
7171
- run: bash <(curl -s https://codecov.io/bash)
72-
- run: dartanalyzer --options analysis_options.yaml --fatal-warnings lib
73-
- run: flutter pub publish --dry-run
7472

75-
flutter_tests_2.2.3:
73+
flutter_tests_2.10.5:
7674
docker:
77-
- image: cirrusci/flutter:2.2.3
75+
- image: cirrusci/flutter:2.10.5
7876
steps:
7977
- checkout
8078
- run: sudo gem install bundler:2.1.4
81-
- run: bundle check || sudo bundle install
79+
- run: bundle check || sudo bundle install
8280
- run: bundle exec danger
8381
- run: flutter doctor
8482
- run: flutter packages get
8583
- run: flutter pub run build_runner build --delete-conflicting-outputs
8684
- run: flutter test --coverage
8785

88-
ios_tests:
86+
ios_tests:
8987
macos:
9088
xcode: "13.4.1"
9189
working_directory: ~/project/example
@@ -115,15 +113,48 @@ jobs:
115113
name: Build and run tests
116114
command: cd ios && xcodebuild -allowProvisioningUpdates -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' test | xcpretty
117115

118-
pub_release:
116+
format_flutter:
117+
docker:
118+
- image: cirrusci/flutter
119+
steps:
120+
- checkout
121+
- run: flutter pub get
122+
- run: flutter pub run build_runner build --delete-conflicting-outputs
123+
- run:
124+
name: Check Format
125+
command: flutter format . --set-exit-if-changed
126+
127+
lint_flutter:
128+
docker:
129+
- image: cirrusci/flutter
130+
steps:
131+
- checkout
132+
- run: flutter pub get
133+
- run: flutter pub run build_runner build --delete-conflicting-outputs
134+
- run:
135+
name: Perform Static Analysis
136+
command: flutter analyze
137+
138+
verify_pub:
139+
docker:
140+
- image: cirrusci/flutter
141+
steps:
142+
- checkout
143+
- run: flutter pub get
144+
- run:
145+
name: Check Package Score
146+
command: flutter pub run pana --no-warning --exit-code-threshold 0
147+
- run: flutter pub publish --dry-run
148+
149+
pub_release:
119150
docker:
120151
- image: cirrusci/flutter
121152
steps:
122153
- checkout
123154
- run: chmod +x ./release.sh
124155
- run: ./release.sh
125156

126-
gh_ibg_release:
157+
gh_ibg_release:
127158
macos:
128159
xcode: "13.4.1"
129160
working_directory: "~"
@@ -134,22 +165,30 @@ jobs:
134165
- run: cd Escape && swift build -c release
135166
- run: cd Escape/.build/release && cp -f Escape /usr/local/bin/escape
136167
- run: cd project && Escape flutter publish
137-
168+
138169
workflows:
139170
version: 2
140171
build-test-and-approval-deploy:
141172
jobs:
142173
- flutter_tests
143-
- flutter_tests_2.2.3
174+
- flutter_tests_2.10.5
144175
- android_tests
145176
- ios_tests
177+
- format_flutter
178+
- lint_flutter:
179+
requires:
180+
- format_flutter
181+
- verify_pub:
182+
requires:
183+
- lint_flutter
146184
- hold_pub_release:
147185
type: approval
148186
requires:
149187
- flutter_tests
150-
- flutter_tests_2.2.3
188+
- flutter_tests_2.10.5
151189
- android_tests
152190
- ios_tests
191+
- verify_pub
153192
filters:
154193
branches:
155194
only: master
@@ -163,9 +202,10 @@ workflows:
163202
type: approval
164203
requires:
165204
- flutter_tests
166-
- flutter_tests_2.2.3
205+
- flutter_tests_2.10.5
167206
- android_tests
168207
- ios_tests
208+
- verify_pub
169209
filters:
170210
branches:
171211
only: master
@@ -175,4 +215,3 @@ workflows:
175215
filters:
176216
branches:
177217
only: master
178-

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dev_dependencies:
1818
sdk: flutter
1919
lint: ^1.0.0
2020
mockito: ^5.0.10
21+
pana: ^0.21.0
2122

2223
flutter:
2324
plugin:

0 commit comments

Comments
 (0)