Skip to content

Commit 3fceec4

Browse files
committed
fixes
1 parent ee303f1 commit 3fceec4

File tree

7 files changed

+118
-132
lines changed

7 files changed

+118
-132
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Flutter Package Workflow
2+
description: Build and test a Flutter package.
3+
4+
inputs:
5+
concurrency:
6+
required: false
7+
default: "4"
8+
description: The value of the concurrency flag (-j) used when running tests
9+
coverage_excludes:
10+
required: false
11+
default: ""
12+
description: Globs to exclude from coverage
13+
working_directory:
14+
required: false
15+
default: "."
16+
description: The working directory for this workflow
17+
min_coverage:
18+
required: false
19+
default: "100"
20+
description: The minimum coverage percentage value
21+
analyze_directories:
22+
required: false
23+
default: "lib test"
24+
description: Directories to analyze
25+
report_on:
26+
required: false
27+
default: "lib"
28+
description: Directories to report on when collecting coverage
29+
platform:
30+
required: false
31+
default: "vm"
32+
description: Platform to use when running tests
33+
34+
runs:
35+
using: "composite"
36+
steps:
37+
- name: 🐦 Setup Flutter
38+
uses: subosito/flutter-action@v2
39+
40+
- name: 📦 Install Dependencies
41+
working-directory: ${{ inputs.working_directory }}
42+
shell: ${{ inputs.shell }}
43+
run: flutter pub get
44+
45+
- name: ✨ Format
46+
working-directory: ${{ inputs.working_directory }}
47+
shell: ${{ inputs.shell }}
48+
run: dart format --set-exit-if-changed .
49+
50+
- name: 🔍 Analyze
51+
working-directory: ${{ inputs.working_directory }}
52+
shell: ${{ inputs.shell }}
53+
run: dart analyze --fatal-warnings ${{inputs.analyze_directories}}
54+
55+
- name: 🧪 Test
56+
working-directory: ${{ inputs.working_directory }}
57+
shell: ${{ inputs.shell }}
58+
run: |
59+
if [ -d "test" ]; then
60+
flutter test --no-pub --test-randomize-ordering-seed random --coverage
61+
fi
62+
63+
- name: 📊 Verify Coverage
64+
if: inputs.collect_coverage == 'true'
65+
uses: VeryGoodOpenSource/very_good_coverage@v3
66+
with:
67+
path: ${{inputs.working_directory}}/coverage/lcov.info
68+
exclude: ${{inputs.coverage_excludes}}
69+
min_coverage: ${{inputs.min_coverage}}
70+
71+
- name: 💯 Verify Pub Score
72+
if: inputs.collect_score == 'true'
73+
working-directory: ${{ inputs.working_directory }}
74+
shell: ${{ inputs.shell }}
75+
run: |
76+
dart pub global activate pana 0.21.45
77+
sudo apt-get install webp
78+
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
79+
echo "score: $PANA_SCORE"
80+
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
81+
if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi
82+
if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi

.github/workflows/ci.yaml

-19
This file was deleted.

.github/workflows/fresh.yaml

-25
This file was deleted.

.github/workflows/fresh_dio.yaml

-25
This file was deleted.

.github/workflows/fresh_dio_example.yaml

-36
This file was deleted.

.github/workflows/fresh_graphql.yaml

-25
This file was deleted.

.github/workflows/main.yaml

+36-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626

2727
outputs:
2828
needs_dart_package_checks: ${{ steps.needs_dart_package_checks.outputs.changes }}
29+
needs_flutter_package_checks: ${{ steps.needs_flutter_package_checks.outputs.changes }}
2930

3031
name: 👀 Detect Changes
3132

@@ -42,11 +43,21 @@ jobs:
4243
- ./.github/workflows/main.yaml
4344
- ./.github/actions/dart_package/action.yaml
4445
- packages/fresh/**
46+
fresh_graphql:
47+
- ./.github/workflows/main.yaml
48+
- ./.github/actions/dart_package/action.yaml
49+
- packages/fresh_dio/**
50+
51+
- uses: dorny/paths-filter@v3
52+
name: Flutter Package Detection
53+
id: needs_flutter_package_checks
54+
with:
55+
filters: |
4556
fresh_dio:
4657
- ./.github/workflows/main.yaml
4758
- ./.github/actions/dart_package/action.yaml
4859
- packages/fresh_dio/**
49-
fresh_graphql:
60+
fresh_dio/example:
5061
- ./.github/workflows/main.yaml
5162
- ./.github/actions/dart_package/action.yaml
5263
- packages/fresh_dio/**
@@ -74,8 +85,31 @@ jobs:
7485
working_directory: packages/${{ matrix.package }}
7586
min_coverage: 100
7687

88+
flutter_package_checks:
89+
needs: changes
90+
if: ${{ needs.changes.outputs.needs_flutter_package_checks != '[]' }}
91+
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
package: ${{ fromJSON(needs.changes.outputs.needs_flutter_package_checks) }}
96+
97+
runs-on: ubuntu-latest
98+
99+
name: 🐦 ${{ matrix.package }}
100+
101+
steps:
102+
- name: 📚 Git Checkout
103+
uses: actions/checkout@v4
104+
105+
- name: 🎯 Build ${{ matrix.package }}
106+
uses: ./.github/actions/flutter_package
107+
with:
108+
working_directory: packages/${{ matrix.package }}
109+
min_coverage: 100
110+
77111
build:
78-
needs: [semantic_pull_request, dart_package_checks]
112+
needs: [semantic_pull_request, dart_package_checks, flutter_package_checks]
79113

80114
if: ${{ always() }}
81115

0 commit comments

Comments
 (0)