Skip to content

Commit

Permalink
Feat: Melos (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucJosin committed Apr 11, 2023
1 parent 2cd9798 commit e8d881b
Show file tree
Hide file tree
Showing 199 changed files with 73 additions and 18 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/dart-analyzer.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Scripts:
# * fluttercommunity/plus_plugins/.github/workflows/scripts/install-tools.sh
# * fluttercommunity/plus_plugins/.github/workflows/scripts/install-flutter.sh

name: Dart Analyzer
on:
push:
Expand All @@ -8,23 +12,27 @@ on:
- main

jobs:
package-analysis:
analyze:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: axel-op/dart-package-analyzer@v3
id: dart_analysis
- uses: dart-lang/setup-dart@v1
with:
sdk: "2.18.0"
- name: Install dependencies
run: dart pub get
- name: "Install flutter"
run: ./.github/workflows/scripts/install-flutter.sh
- name: "Install tools"
run: ./.github/workflows/scripts/install-tools.sh
- name: "Bootstrap workspace (Melos)"
run: melos bootstrap
- name: "Run Dart Analyze"
uses: invertase/github-action-dart-analyzer@v1
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
relativePath: on_audio_query/
- name: Check Scores
env:
TOTAL: ${{ steps.dart_analysis.outputs.total }}
TOTAL_MAX: ${{ steps.dart_analysis.outputs.total_max }}
run: |
SCORES=$(( $TOTAL + 10 / $TOTAL_MAX + 10 ))
if (( $SCORES < 1 ))
then
echo Score too low!
exit 1
fi
fatal-infos: false
fatal-warnings: true
annotate: true
annotate-only: false
working-directory: ./packages
4 changes: 4 additions & 0 deletions .github/workflows/scripts/install-flutter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

git clone https://github.com/flutter/flutter.git --depth 1 -b stable _flutter
echo "$GITHUB_WORKSPACE/_flutter/bin" >> $GITHUB_PATH
10 changes: 10 additions & 0 deletions .github/workflows/scripts/install-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

flutter config --no-analytics
flutter pub global activate melos 3.0.1
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
echo "$HOME/AppData/Local/Pub/Cache/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/_flutter/.pub-cache/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/_flutter/bin/cache/dart-sdk/bin" >> $GITHUB_PATH
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ pubspec.lock

.atom/
.idea/
.vscode/

.packages
.pub/
.dart_tool/
pubspec.lock
pubspec_overrides.yaml
flutter_export_environment.sh

examples/all_plugins/pubspec.yaml
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dart.runPubGetOnPubspecChanges": "always"
}
2 changes: 1 addition & 1 deletion README.md
23 changes: 23 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: on_audio_query
repository: https://github.com/LucJosin/on_audio_query

packages:
- packages/*

command:
bootstrap:
# It seems so that running "pub get" in parallel has some issues (like
# https://github.com/dart-lang/pub/issues/3404). Disabling this feature
# makes the CI much more stable.
runPubGetInParallel: false

scripts:
reset:
run: melos clean && melos bootstrap
description: Useful to give your workspace a 'fresh start'
analyze:
exec: flutter analyze --no-fatal-infos
description: Analyze code
format:
run: melos exec dart format . --fix
description: Run `dart format` for all packages.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: on_audio_query_workspace

environment:
sdk: ">=2.17.0 <3.0.0"

dev_dependencies:
melos: ^3.0.1

0 comments on commit e8d881b

Please sign in to comment.