Skip to content

Commit e139d7c

Browse files
committed
chore: Add basic melos support
1 parent ff059b7 commit e139d7c

File tree

4 files changed

+77
-7
lines changed

4 files changed

+77
-7
lines changed

.circleci/config.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
version: 2.1
22
orbs:
33
codecov: codecov/codecov@1.0.2
4+
executors:
5+
default-executor:
6+
docker:
7+
- image: cirrusci/flutter:stable
8+
resource_class: large
9+
shell: /bin/bash
410
jobs:
511
build:
6-
docker:
7-
- image: cirrusci/flutter
12+
executor: default-executor
813
steps:
9-
- checkout
10-
- run: flutter --version
11-
- run: flutter test --coverage
12-
- codecov/upload:
13-
file: coverage/lcov.info
14+
- checkout
15+
- run: flutter --version
16+
- run:
17+
name: Set up environment
18+
command: |
19+
echo 'export PATH=$HOME/.pub-cache/bin:$PATH' >> $BASH_ENV
20+
source $BASH_ENV
21+
- run:
22+
name: Setup melos
23+
command: |
24+
flutter pub global activate melos
25+
melos --version
26+
melos bootstrap
27+
- run:
28+
name: Run Test Suite
29+
command: melos run test
30+
- run:
31+
name: Generate Coverage Report
32+
command: melos run gen_coverage
33+
- codecov/upload:
34+
file: coverage_report/lcov.info

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,7 @@ modules.xml
151151
**/flutter_export_environment.sh
152152

153153
/example/ios/Flutter/Flutter.podspec
154+
155+
packages/**/pubspec_overrides.yaml
156+
./pubspec_overrides.yaml
157+
/example/pubspec_overrides.yaml

combine_coverage.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
escapedPath="$(echo `pwd` | sed 's/\//\\\//g')"
4+
5+
if grep flutter pubspec.yaml > /dev/null; then
6+
if [ -d "coverage" ]; then
7+
# combine line coverage info from package tests to a common file
8+
if [ ! -d "$MELOS_ROOT_PATH/coverage_report" ]; then
9+
mkdir "$MELOS_ROOT_PATH/coverage_report"
10+
fi
11+
sed "s/^SF:lib/SF:$escapedPath\/lib/g" coverage/lcov.info >> "$MELOS_ROOT_PATH/coverage_report/lcov.info"
12+
rm -rf "coverage"
13+
fi
14+
fi

melos.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: flutter_html
2+
repository: https://github.com/sub6resources/flutter_html
3+
4+
packages:
5+
- packages/*
6+
- .
7+
- example
8+
9+
command:
10+
bootstrap:
11+
usePubspecOverrides: true
12+
runPubGetInParallel: false
13+
version:
14+
includeCommitId: true
15+
16+
scripts:
17+
analyze:
18+
exec: flutter analyze . --fatal-infos
19+
20+
test:selective_unit_test:
21+
run: melos exec --dir-exists="test" --fail-fast -- flutter test --no-pub --coverage
22+
description: Run Flutter tests for a specific package in this project.
23+
select-package:
24+
flutter: true
25+
dir-exists: test
26+
27+
test:
28+
run: melos run test:selective_unit_test --no-select
29+
description: Run all Flutter tests in this project.
30+
31+
gen_coverage: melos exec -- "\$MELOS_ROOT_PATH/combine_coverage.sh"

0 commit comments

Comments
 (0)