Skip to content

Commit 88adfae

Browse files
committed
chore: updated melos config
1 parent 4ba31d0 commit 88adfae

File tree

9 files changed

+118
-57
lines changed

9 files changed

+118
-57
lines changed

.github/workflows/code_quality.yml

Lines changed: 91 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,111 @@ jobs:
2525
steps:
2626
- name: Checkout
2727
uses: actions/checkout@v3
28-
- name: Start Docker compose containers
29-
if: ${{ matrix.work_dir == 'openapi-generator' }}
30-
run: docker-compose -f "docker-compose.yaml" up -d --build
28+
# - name: Start Docker compose containers
29+
# if: ${{ matrix.work_dir == 'openapi-generator' }}
30+
# run: docker-compose -f "docker-compose.yaml" up -d --build
3131
- name: Setup Dart
3232
uses: dart-lang/[email protected]
3333
with:
3434
sdk: stable
35+
- name: Install Melos
36+
run: dart pub global activate melos
37+
- name: Bootstrap Melos
38+
run: melos bootstrap
3539
- name: Install Dependencies
3640
run: dart pub get
41+
- name: Run Docker Compose on Specific Package
42+
run: |
43+
melos exec -p openapi-generator -- docker-compose -f "docker-compose.yaml" up -d --build
3744
- name: Build runner
38-
if: ${{ matrix.work_dir == 'openapi-generator' }}
39-
run: dart run build_runner build --delete-conflicting-outputs
45+
run: melos exec -p openapi-generator dart run build_runner build --delete-conflicting-outputs
4046
- name: Validate formatting
41-
run: dart format ./ --set-exit-if-changed
47+
run: melos format --set-exit-if-changed
4248
- name: Run analyzer
43-
run: dart analyze --fatal-warnings
49+
run: melos analyze --fatal-warnings
4450
- name: Run tests
45-
run: dart run test --coverage="coverage"
51+
run: melos run test:all
52+
4653
- name: Install coverage tools
4754
run: dart pub global activate coverage
48-
- name: format coverage
49-
run: $HOME/.pub-cache/bin/format_coverage --lcov --in=coverage --out=./coverage.lcov --package=. --report-on=lib
50-
- name: Upload coverage reports to Codecov
55+
56+
- name: Install Coverage Tools
57+
run: dart pub global activate coverage combine_coverage
58+
59+
- name: Format Coverage for Each Package
60+
run: |
61+
# Find each package's coverage directory and format to lcov
62+
for dir in $(find . -name "coverage" -type d); do
63+
$HOME/.pub-cache/bin/format_coverage \
64+
--lcov \
65+
--in=$dir \
66+
--out=$dir/coverage.lcov \
67+
--packages=$dir/../.packages \
68+
--report-on=lib
69+
done
70+
71+
- name: Combine Coverage Reports
72+
run: |
73+
mkdir -p coverage # Create a root coverage folder if it doesn't exist
74+
dart pub global run combine_coverage \
75+
--repo-path="." \
76+
--output=coverage/combined.lcov # Combines all into a single lcov file
77+
78+
- name: Upload Combined Coverage to Codecov
79+
uses: codecov/codecov-action@v3
80+
with:
81+
files: ./coverage/combined.lcov
82+
flags: combined_coverage
83+
name: Combined Code Coverage
84+
fail_ci_if_error: true
85+
env:
86+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # Required only for private repositories
87+
88+
code_coverage:
89+
name: Collect and Upload Combined Coverage
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v3
94+
95+
- name: Setup Dart
96+
uses: dart-lang/setup-dart@v1
97+
98+
- name: Install Dependencies with Melos
99+
run: dart pub global activate melos && melos bootstrap
100+
101+
- name: Run Tests with Coverage for All Packages
102+
run: |
103+
melos exec -- dart run test --coverage=coverage
104+
105+
- name: Install Coverage Tools
106+
run: dart pub global activate coverage
107+
108+
- name: Format Coverage for Each Package
109+
run: |
110+
for dir in $(find . -name "coverage"); do
111+
$HOME/.pub-cache/bin/format_coverage \
112+
--lcov \
113+
--in=$dir \
114+
--out=$dir/coverage.lcov \
115+
--packages=.packages \
116+
--report-on=lib
117+
done
118+
119+
- name: Combine Coverage
120+
run: |
121+
dart pub global activate combine_coverage
122+
dart pub global run combine_coverage --repo-path="." # Adjust path to your monorepo root
123+
124+
- name: Upload Combined Coverage to Codecov
51125
uses: codecov/codecov-action@v3
126+
with:
127+
files: ./coverage/combined.lcov # Adjust path if necessary
128+
flags: combined_coverage
129+
name: Combined Code Coverage
130+
fail_ci_if_error: true
52131
env:
53-
files: ./coverage.lcov
54-
verbose: true
55-
flags: ${{ matrix.work_dir }}
56-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
57-
- name: Stop Docker Container
58-
if: ${{ matrix.work_dir == 'openapi-generator' && always() }}
59-
run: docker-compose -f "docker-compose.yaml" down
132+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # Required only for private repos
60133

61134
build:
62135
name: Build example project 🛠️

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1818
version: 1.0.0+1
1919

2020
environment:
21-
sdk: ">=2.15.0 <3.0.0"
21+
sdk: ">=2.15.0 <4.0.0"
2222

2323

2424
# Dependencies specify other packages that your package needs in order to work.

example/test/widget_test.dart

Lines changed: 0 additions & 30 deletions
This file was deleted.

melos.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,24 @@ command:
1717
workspaceChangelog: true
1818

1919
scripts:
20-
coverage:
20+
test:all:
21+
run: |
22+
melos run test --no-select && \
23+
melos exec -- "dart pub global activate combine_coverage"
24+
melos run combine_coverage
25+
description: |
26+
Run all tests available.
27+
test:
28+
run: |
29+
melos exec -c 6 --fail-fast -- \
30+
"dart run test --coverage='coverage'"
31+
description: Run `flutter test` for a specific package.
32+
packageFilters:
33+
dirExists:
34+
- test
35+
ignore:
36+
- '*web*'
37+
- '*example*'
38+
39+
combine_coverage:
2140
run: dart pub global run combine_coverage --repo-path="."

openapi-generator-cli/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ description: A new Flutter application.
1414
version: 1.0.0+1
1515

1616
environment:
17-
sdk: ">=2.12.0 <3.0.0"
17+
sdk: ">=2.12.0 <4.0.0"
1818

1919
dependencies:
2020
flutter:

openapi-generator/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ version: 5.0.2
44
homepage: https://github.com/gibahjoe/openapi-generator-dart
55

66
environment:
7-
sdk: '>=2.15.0 <3.0.0'
7+
sdk: '>=2.15.0 <4.0.0'
88

99
dependencies:
1010
build: '>=1.0.0 <=3.0.0'
1111
source_gen: '>=1.0.0 <=2.0.0'
1212
path: '>=1.0.0 <=2.0.0'
13-
openapi_generator_annotations: '>5.0.2 <7.0.0'
13+
openapi_generator_annotations: '5.0.2'
1414
analyzer: '>=2.0.0 <7.0.0'
1515
openapi_generator_cli: '>5.0.2 <7.0.0'
1616
yaml: ^3.1.2

openapi-generator/test/specs/dart_pubspec.test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: a test pubspec
33
version: 4.11.0
44

55
environment:
6-
sdk: '>=2.12.0 <3.0.0'
6+
sdk: '>=2.15.0 <4.0.0'
77

88
dependencies:
99
build: '>=0.12.6 <=3.0.0'

openapi-generator/test/specs/flutter_pubspec.test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: a test flutter pubspec
33
version: 4.11.0
44

55
environment:
6-
sdk: '>=2.12.0 <3.0.0'
6+
sdk: '>=2.15.0 <4.0.0'
77

88
dependencies:
99
flutter:

release-please-config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
"include-component-in-tag": false,
3-
"bootstrap-sha": "5d21f4aa99faf94d22a4958d30c157f9430bdbf3",
2+
"include-component-in-tag": true,
43
"packages": {
54
"openapi-generator": {
65
"release-type": "dart",

0 commit comments

Comments
 (0)