Skip to content

Commit

Permalink
Merge pull request #15 from tech-andgar/main
Browse files Browse the repository at this point in the history
chore(workflows): Update workflow for Dart setup and analysis
  • Loading branch information
tech-andgar authored May 3, 2024
2 parents 35013a9 + 98e2f10 commit 760e852
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
branches: ["main", "feature/*"]
workflow_dispatch:

jobs:
Expand All @@ -19,41 +19,71 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: dart-lang/setup-dart@v1.6.4
- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1.6.4
with:
sdk: ${{ matrix.channel }}

- id: disabled_analytics_dart
name: Disabled Analytics Dart
run: dart --disable-analytics

- name: Install dependencies
- name: 📦 Install Dependencies
run: dart pub get

# Verifies if the dart code is formatted well
- name: Verify formatting
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
# --set-exit-if-changed stops execution if the any code is not well formatted
# --output=none prints files which needs to be formatted

# Checks for Semantic errors. Can be configured using analysis_options.yaml
- name: Analyze project source
- name: 🔍 Analyze project source
run: dart analyze --fatal-infos
# optionally use --fatal-warnings to stop execution if any warnings are found

- name: Run Tests
# Checks for the quality and consistency of Dart code. Can be configured using analysis_options.yaml
- name: 🔍 Analyze project source (Dart code Linter - DCL)
run: dart run dart_code_linter:metrics analyze .

- name: 🔍 Analyze check unused files (DCL)
run: dart run dart_code_linter:metrics check-unused-files lib

- name: 🔍 Analyze check unused l10n (DCL)
run: dart run dart_code_linter:metrics check-unused-l10n .

- name: 🔍 Analyze check unused code (DCL)
run: dart run dart_code_linter:metrics check-unused-code .

- name: 🔍 Analyze check unnecessary nullable (DCL)
run: dart run dart_code_linter:metrics check-unnecessary-nullable .

- name: 🧪 Run Tests
run: |
dart pub global activate coverage
dart pub global run coverage:test_with_coverage
- name: Check Code Coverage
- name: 📦 Pre-publish - dry run
run: dart pub publish --dry-run

- name: 📊 Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
path: "./coverage/lcov.info"
min_coverage: 100

- name: Coveralls GitHub Action
- name: ⬆️ Upload Coverage to Coveralls
uses: coverallsapp/github-action@v2.2.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
path-to-lcov: coverage/lcov.info

- name: 💯 Verify Pub Score
run: |
dart pub global activate pana
sudo apt-get install webp
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
echo "score: $PANA_SCORE"
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi
if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi

0 comments on commit 760e852

Please sign in to comment.