diff --git a/.circleci/config.yml b/.circleci/config.yml index 16c40c66b9..ac1b6f299e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,13 +1,34 @@ version: 2.1 orbs: codecov: codecov/codecov@1.0.2 +executors: + default-executor: + docker: + - image: cirrusci/flutter:stable + resource_class: large + shell: /bin/bash jobs: build: - docker: - - image: cirrusci/flutter + executor: default-executor steps: - - checkout - - run: flutter --version - - run: flutter test --coverage - - codecov/upload: - file: coverage/lcov.info + - checkout + - run: flutter --version + - run: + name: Set up environment + command: | + echo 'export PATH=$HOME/.pub-cache/bin:$PATH' >> $BASH_ENV + source $BASH_ENV + - run: + name: Setup melos + command: | + flutter pub global activate melos + melos --version + melos bootstrap + - run: + name: Run Test Suite + command: melos run test + - run: + name: Generate Coverage Report + command: melos run gen_coverage + - codecov/upload: + file: coverage_report/lcov.info diff --git a/.gitignore b/.gitignore index 34258e6aad..caf0d56dbf 100644 --- a/.gitignore +++ b/.gitignore @@ -151,3 +151,7 @@ modules.xml **/flutter_export_environment.sh /example/ios/Flutter/Flutter.podspec + +packages/**/pubspec_overrides.yaml +./pubspec_overrides.yaml +/example/pubspec_overrides.yaml \ No newline at end of file diff --git a/combine_coverage.sh b/combine_coverage.sh new file mode 100755 index 0000000000..8831e1fa6a --- /dev/null +++ b/combine_coverage.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +escapedPath="$(echo `pwd` | sed 's/\//\\\//g')" + +if grep flutter pubspec.yaml > /dev/null; then + if [ -d "coverage" ]; then + # combine line coverage info from package tests to a common file + if [ ! -d "$MELOS_ROOT_PATH/coverage_report" ]; then + mkdir "$MELOS_ROOT_PATH/coverage_report" + fi + sed "s/^SF:lib/SF:$escapedPath\/lib/g" coverage/lcov.info >> "$MELOS_ROOT_PATH/coverage_report/lcov.info" + rm -rf "coverage" + fi +fi \ No newline at end of file diff --git a/melos.yaml b/melos.yaml new file mode 100644 index 0000000000..31db195878 --- /dev/null +++ b/melos.yaml @@ -0,0 +1,31 @@ +name: flutter_html +repository: https://github.com/sub6resources/flutter_html + +packages: + - packages/* + - . + - example + +command: + bootstrap: + usePubspecOverrides: true + runPubGetInParallel: false + version: + includeCommitId: true + +scripts: + analyze: + exec: flutter analyze . --fatal-infos + + test:selective_unit_test: + run: melos exec --dir-exists="test" --fail-fast -- flutter test --no-pub --coverage + description: Run Flutter tests for a specific package in this project. + select-package: + flutter: true + dir-exists: test + + test: + run: melos run test:selective_unit_test --no-select + description: Run all Flutter tests in this project. + + gen_coverage: melos exec -- "\$MELOS_ROOT_PATH/combine_coverage.sh" \ No newline at end of file