Skip to content

Commit 2f80f54

Browse files
committed
feat(git): integrate coverage artifact upload for flutter_package workflow
1 parent 8f4c1cf commit 2f80f54

File tree

2 files changed

+132
-16
lines changed

2 files changed

+132
-16
lines changed

.github/workflows/flutter_document_scanner_platform_interface.yaml

+2-16
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,10 @@ on:
1616

1717
jobs:
1818
build:
19-
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1.18.0
19+
uses: ./.github/templates/flutter_package.yml
2020
with:
2121
flutter_channel: stable
2222
flutter_version: 3.24.0
2323
working_directory: flutter_document_scanner_platform_interface
2424
min_coverage: 90
25-
26-
upload-coverage:
27-
needs: build
28-
runs-on: ubuntu-latest
29-
steps:
30-
- name: Checkout code
31-
uses: actions/checkout@v3
32-
33-
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v3
35-
with:
36-
files: flutter_document_scanner_platform_interface/coverage/lcov.info
37-
token: ${{ secrets.CODECOV_TOKEN }}
38-
flags: flutter_document_scanner_platform_interface
39-
fail_ci_if_error: true
25+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Flutter Package Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
analyze_directories:
7+
required: false
8+
type: string
9+
default: "lib test"
10+
concurrency:
11+
required: false
12+
type: number
13+
default: 4
14+
coverage_excludes:
15+
required: false
16+
type: string
17+
default: ""
18+
flutter_channel:
19+
required: false
20+
type: string
21+
default: "stable"
22+
flutter_version:
23+
required: false
24+
type: string
25+
default: ""
26+
format_directories:
27+
required: false
28+
type: string
29+
default: "lib test"
30+
format_line_length:
31+
required: false
32+
type: string
33+
default: "80"
34+
min_coverage:
35+
required: false
36+
type: number
37+
default: 100
38+
runs_on:
39+
required: false
40+
type: string
41+
default: "ubuntu-latest"
42+
setup:
43+
required: false
44+
type: string
45+
default: ""
46+
test_optimization:
47+
required: false
48+
type: boolean
49+
default: true
50+
test_recursion:
51+
required: false
52+
type: boolean
53+
default: false
54+
working_directory:
55+
required: false
56+
type: string
57+
default: "."
58+
package_get_excludes:
59+
required: false
60+
type: string
61+
default: "!*"
62+
secrets:
63+
ssh_key:
64+
required: false
65+
codecov_token:
66+
required: false
67+
68+
jobs:
69+
build:
70+
defaults:
71+
run:
72+
working-directory: ${{inputs.working_directory}}
73+
74+
runs-on: ${{inputs.runs_on}}
75+
76+
steps:
77+
- name: 📚 Git Checkout
78+
uses: actions/checkout@v4
79+
80+
- name: 🐦 Setup Flutter
81+
uses: subosito/flutter-action@v2
82+
with:
83+
flutter-version: ${{inputs.flutter_version}}
84+
channel: ${{inputs.flutter_channel}}
85+
cache: true
86+
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
87+
88+
- name: 🤫 Set SSH Key
89+
env:
90+
ssh_key: ${{secrets.ssh_key}}
91+
if: env.ssh_key != null
92+
uses: webfactory/[email protected]
93+
with:
94+
ssh-private-key: ${{secrets.ssh_key}}
95+
96+
- name: 📦 Install Dependencies
97+
run: |
98+
flutter pub global activate very_good_cli
99+
very_good packages get --recursive --ignore=${{inputs.package_get_excludes}}
100+
101+
- name: ⚙️ Run Setup
102+
if: "${{inputs.setup != ''}}"
103+
run: ${{inputs.setup}}
104+
105+
- name: ✨ Check Formatting
106+
run: dart format --line-length ${{inputs.format_line_length}} --set-exit-if-changed ${{inputs.format_directories}}
107+
108+
- name: 🕵️ Analyze
109+
run: flutter analyze ${{inputs.analyze_directories}}
110+
111+
- name: 🧪 Run Tests
112+
run: very_good test -j ${{inputs.concurrency}} ${{(inputs.test_recursion && '--recursive') || ''}} ${{(inputs.test_optimization && '--optimization') || '--no-optimization'}} --coverage --test-randomize-ordering-seed random
113+
114+
- name: 📊 Check Code Coverage
115+
uses: VeryGoodOpenSource/very_good_coverage@v3
116+
with:
117+
path: ${{inputs.working_directory}}/coverage/lcov.info
118+
exclude: ${{inputs.coverage_excludes}}
119+
min_coverage: ${{inputs.min_coverage}}
120+
121+
- name: 📤 Upload Coverage Artifact
122+
env:
123+
codecov_token: ${{secrets.codecov_token}}
124+
if: env.codecov_token != null
125+
uses: actions/upload-artifact@v3
126+
with:
127+
name: coverage-report
128+
path: ${{inputs.working_directory}}/coverage/lcov.info
129+
flags: ${{inputs.working_directory}}
130+
token: ${{secrets.codecov_token}}

0 commit comments

Comments
 (0)