Skip to content

Commit

Permalink
chore: fix fatal ci (#27)
Browse files Browse the repository at this point in the history
* fix fatal ci

* fix ci

* add pub get to analyze

* add melos

* fit test lint

* add package score as test to ci

* fix action version number

* fix(fmCache): add web support

* no dartdoc
  • Loading branch information
josxha authored Feb 10, 2024
1 parent 9a352a1 commit e1f38ec
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 15 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/on-commit-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ concurrency:
cancel-in-progress: true

jobs:
analyze:
runs-on: ubuntu-latest
name: Analyze
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install melos
run: dart pub global activate melos
- name: Bootstrap melos
run: melos bootstrap
- name: Get dependencies
run: melos run pub_get --no-select
- name: Analyze all projects
run: dart analyze --fatal-infos --fatal-warnings
- name: Format all projects
run: dart format --output=none --set-exit-if-changed .
test:
runs-on: ubuntu-latest
name: Test
Expand All @@ -22,8 +42,6 @@ jobs:
run: dart pub global activate melos
- name: Bootstrap melos
run: melos bootstrap
- name: Analyze all projects
run: melos run analyze --no-select
- name: Install coverde
run: dart pub global activate coverde
- name: Run tests with coverage
Expand All @@ -32,10 +50,28 @@ jobs:
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
package-score:
name: "Package score"
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install melos
run: dart pub global activate melos
- name: Bootstrap melos
run: melos bootstrap
- name: Install pana
run: dart pub global activate pana
- name: Check package score for all
run: melos run package_score --no-select
build-android:
runs-on: ubuntu-latest
name: Build Android
needs: [ test ]
needs: [ test, analyze, package-score ]
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -59,7 +95,7 @@ jobs:
build-web:
runs-on: ubuntu-latest
name: Build Web
needs: [ test ]
needs: [ test, analyze, package-score ]
if: github.repository == 'josxha/flutter_map_plugins'
defaults:
run:
Expand Down
44 changes: 39 additions & 5 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ concurrency:
cancel-in-progress: true

jobs:
test:
analyze:
runs-on: ubuntu-latest
name: Analyze & Test
name: Analyze
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -22,8 +22,26 @@ jobs:
run: dart pub global activate melos
- name: Bootstrap melos
run: melos bootstrap
- name: Get dependencies
run: melos run pub_get --no-select
- name: Analyze all projects
run: melos run analyze --no-select
run: dart analyze --fatal-infos --fatal-warnings
- name: Format all projects
run: dart format --output=none --set-exit-if-changed .
test:
runs-on: ubuntu-latest
name: Test
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install melos
run: dart pub global activate melos
- name: Bootstrap melos
run: melos bootstrap
- name: Install coverde
run: dart pub global activate coverde
- name: Run tests with coverage
Expand All @@ -32,10 +50,27 @@ jobs:
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
package-score:
name: "Package score"
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install melos
run: dart pub global activate melos
- name: Bootstrap melos
run: melos bootstrap
- name: Install pana
run: dart pub global activate pana
- name: Check package score for all
run: melos run package_score --no-select
build-android:
runs-on: ubuntu-latest
name: Build Android
needs: [ test ]
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -59,7 +94,6 @@ jobs:
build-web:
runs-on: ubuntu-latest
name: Build Web
needs: [ test ]
if: github.repository == 'josxha/flutter_map_plugins'
defaults:
run:
Expand Down
14 changes: 8 additions & 6 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ packages:
- example

scripts:
analyze:
description: Run `dart analyze` in all packages
run: |
melos exec dart format --output=none --set-exit-if-changed .
melos exec dart analyze --fatal-infos --fatal-warnings
test:
description: Run tests of all packages
run: melos exec --dir-exists="test" --fail-fast flutter test --no-pub
run: melos exec --dir-exists="test"--fail-fast flutter test --no-pub
pub_get:
description: Run `pub get` for all packages
run: melos exec --file-exists="pubspec.yaml" --fail-fast flutter pub get
package_score:
description: Run pana for all packages
run: melos exec --fail-fast --ignore="flutter_map_plugins_example" pana --exit-code-threshold 0 --no-dartdoc .
test_with_coverage:
description: Run tests of all packages with coverage and merge its results
run: |
melos exec rm -rf coverage
melos exec --dir-exists="test" --fail-fast flutter pub get
melos exec --dir-exists="test" --fail-fast flutter test --no-pub -r expanded --coverage
melos exec -c 1 --file-exists=coverage/lcov.info coverde filter --input ./coverage/lcov.info --output MELOS_ROOT_PATH/coverage/filtered.lcov.info --filters \.g\.dart
coverde value -i coverage/filtered.lcov.info > MELOS_ROOT_PATH/coverage/result.txt

0 comments on commit e1f38ec

Please sign in to comment.