Skip to content

Commit 5c9295c

Browse files
committed
chore: exclude generated pigeon files from code coverage calculation, coverage badge test
1 parent faac094 commit 5c9295c

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

.github/workflows/coverage-badge.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Create coverage badge
2+
3+
on:
4+
push:
5+
branches: [main]
6+
# TODO(EchoEllet): For testing only, remove
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Flutter (Stable)
18+
uses: subosito/flutter-action@v2
19+
with:
20+
channel: stable
21+
cache: true
22+
23+
- name: Install Package Dependencies
24+
run: flutter pub get
25+
26+
- name: Collect coverage info
27+
run: flutter test --coverage
28+
29+
- name: Install lcov
30+
run: sudo apt install -y lcov
31+
32+
- name: Extract coverage percentage
33+
id: coverage-extractor
34+
run: |
35+
percentage=$(lcov --summary coverage/lcov.info | grep 'lines' | awk '{print $2}' | sed 's/%//' | sed 's/.0$//')
36+
echo "COVERAGE=$percentage" >> $GITHUB_OUTPUT
37+
38+
- name: Print the coverage percentage for testing
39+
run: |
40+
echo "The coverage percentage is ${{ steps.coverage-extractor.outputs.COVERAGE }}"

lib/src/messages.g.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// coverage:ignore-file
12
// Autogenerated from Pigeon (v22.7.2), do not edit directly.
23
// See also: https://pub.dev/packages/pigeon
34
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers

pigeons/messages.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import 'package:pigeon/pigeon.dart';
66
dartTestOut: 'test/test_api.g.dart',
77
swiftOut:
88
'macos/native_image_picker_macos/Sources/native_image_picker_macos/Messages.g.swift',
9+
dartOptions: DartOptions(
10+
copyrightHeader: <String>[
11+
'coverage:ignore-file',
12+
],
13+
),
914
),
1015
)
1116

test/test_api.g.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// coverage:ignore-file
12
// Autogenerated from Pigeon (v22.7.2), do not edit directly.
23
// See also: https://pub.dev/packages/pigeon
34
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers

0 commit comments

Comments
 (0)