Skip to content

Add basic melos support #1147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions combine_coverage.sh
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -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"