Skip to content

Commit 76d9ab6

Browse files
committed
ci: expand workflows for coverage build deploy and automation
1 parent aa53810 commit 76d9ab6

7 files changed

Lines changed: 282 additions & 5 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build Windows Artifact
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build-windows:
15+
name: Build Windows
16+
runs-on: windows-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Flutter
23+
uses: subosito/flutter-action@v2
24+
with:
25+
flutter-version: '3.27.0'
26+
channel: 'stable'
27+
cache: true
28+
29+
- name: Get dependencies
30+
run: flutter pub get
31+
32+
- name: Generate code
33+
run: dart run build_runner build --delete-conflicting-outputs
34+
35+
- name: Build Windows release
36+
run: flutter build windows --release
37+
38+
- name: Upload Windows artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: localizer-windows-release
42+
path: build/windows/x64/runner/Release

‎.github/workflows/deploy-docs.yml‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- docs/**
9+
- .github/workflows/deploy-docs.yml
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: true
19+
20+
jobs:
21+
deploy:
22+
name: Deploy docs
23+
runs-on: ubuntu-latest
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v5
34+
35+
- name: Upload Pages artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: docs
39+
40+
- name: Deploy to GitHub Pages
41+
id: deployment
42+
uses: actions/deploy-pages@v4

‎.github/workflows/flutter.yml‎

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ permissions:
1212
checks: write
1313

1414
jobs:
15-
# Code quality checks
1615
analyze:
1716
name: Analyze & Format
1817
runs-on: ubuntu-latest
@@ -23,7 +22,7 @@ jobs:
2322
- name: Setup Flutter
2423
uses: subosito/flutter-action@v2
2524
with:
26-
flutter-version: '3.27.0'
25+
flutter-version: '3.32.1'
2726
channel: 'stable'
2827
cache: true
2928

@@ -39,7 +38,6 @@ jobs:
3938
- name: Run analyzer
4039
run: flutter analyze --no-pub --no-fatal-warnings --no-fatal-infos
4140

42-
# Unit and widget tests
4341
test:
4442
name: Run Tests
4543
runs-on: ubuntu-latest
@@ -51,7 +49,7 @@ jobs:
5149
- name: Setup Flutter
5250
uses: subosito/flutter-action@v2
5351
with:
54-
flutter-version: '3.27.0'
52+
flutter-version: '3.32.1'
5553
channel: 'stable'
5654
cache: true
5755

@@ -63,3 +61,58 @@ jobs:
6361

6462
- name: Run tests
6563
run: flutter test
64+
65+
coverage:
66+
name: Coverage Report
67+
runs-on: ubuntu-latest
68+
needs: test
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@v4
72+
73+
- name: Setup Flutter
74+
uses: subosito/flutter-action@v2
75+
with:
76+
flutter-version: '3.32.1'
77+
channel: 'stable'
78+
cache: true
79+
80+
- name: Get dependencies
81+
run: flutter pub get
82+
83+
- name: Generate code
84+
run: dart run build_runner build --delete-conflicting-outputs
85+
86+
- name: Run tests with coverage
87+
run: flutter test --coverage
88+
89+
- name: Calculate coverage percentage
90+
id: coverage
91+
shell: bash
92+
run: |
93+
LF=$(grep -E '^LF:' coverage/lcov.info | awk -F: '{sum += $2} END {print sum + 0}')
94+
LH=$(grep -E '^LH:' coverage/lcov.info | awk -F: '{sum += $2} END {print sum + 0}')
95+
96+
if [ "$LF" -eq 0 ]; then
97+
PERCENT="0.00"
98+
else
99+
PERCENT=$(awk "BEGIN {printf \"%.2f\", ($LH/$LF)*100}")
100+
fi
101+
102+
echo "coverage=$PERCENT" >> "$GITHUB_OUTPUT"
103+
echo "Coverage: $PERCENT%"
104+
105+
- name: Enforce minimum coverage
106+
shell: bash
107+
run: |
108+
THRESHOLD=20
109+
ACTUAL=${{ steps.coverage.outputs.coverage }}
110+
echo "Coverage threshold: ${THRESHOLD}%"
111+
echo "Actual coverage: ${ACTUAL}%"
112+
awk -v actual="$ACTUAL" -v threshold="$THRESHOLD" 'BEGIN {exit (actual >= threshold) ? 0 : 1}'
113+
114+
- name: Upload coverage artifact
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: flutter-coverage
118+
path: coverage/lcov.info

‎.github/workflows/greetings.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Community Greetings
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request_target:
7+
types: [opened]
8+
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
greeting:
15+
name: First interaction greeting
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Send greeting
19+
uses: actions/first-interaction@v1
20+
with:
21+
repo-token: ${{ secrets.GITHUB_TOKEN }}
22+
issue-message: |
23+
Thanks for opening your first issue in Localization Comparison Tool.
24+
We appreciate your time and will review this as soon as possible.
25+
Please include steps to reproduce and screenshots when relevant.
26+
pr-message: |
27+
Thanks for your first pull request.
28+
We appreciate your contribution and will review it soon.
29+
Please make sure tests and analysis pass and that the PR description is complete.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Pull Request Size Labeler
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
issues: write
11+
12+
jobs:
13+
size-label:
14+
name: Label PR by size
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Label pull request size
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const pr = context.payload.pull_request;
23+
const owner = context.repo.owner;
24+
const repo = context.repo.repo;
25+
const issue_number = pr.number;
26+
27+
const files = await github.paginate(github.rest.pulls.listFiles, {
28+
owner,
29+
repo,
30+
pull_number: issue_number,
31+
per_page: 100,
32+
});
33+
34+
const total = files.reduce((sum, f) => sum + f.additions + f.deletions, 0);
35+
36+
let label;
37+
if (total <= 50) label = 'size/xs';
38+
else if (total <= 200) label = 'size/s';
39+
else if (total <= 400) label = 'size/m';
40+
else if (total <= 800) label = 'size/l';
41+
else label = 'size/xl';
42+
43+
const palette = {
44+
'size/xs': '0e8a16',
45+
'size/s': '6cc644',
46+
'size/m': 'fbca04',
47+
'size/l': 'f9d0c4',
48+
'size/xl': 'b60205',
49+
};
50+
51+
const existingLabels = await github.paginate(github.rest.issues.listLabelsForRepo, {
52+
owner,
53+
repo,
54+
per_page: 100,
55+
});
56+
57+
const existingNames = new Set(existingLabels.map((l) => l.name));
58+
59+
for (const [name, color] of Object.entries(palette)) {
60+
if (!existingNames.has(name)) {
61+
await github.rest.issues.createLabel({
62+
owner,
63+
repo,
64+
name,
65+
color,
66+
description: 'Automatically assigned pull request size label',
67+
});
68+
}
69+
}
70+
71+
const currentIssueLabels = await github.paginate(github.rest.issues.listLabelsOnIssue, {
72+
owner,
73+
repo,
74+
issue_number,
75+
per_page: 100,
76+
});
77+
78+
const sizeLabels = currentIssueLabels
79+
.map((l) => l.name)
80+
.filter((name) => name.startsWith('size/'));
81+
82+
for (const oldLabel of sizeLabels) {
83+
if (oldLabel !== label) {
84+
await github.rest.issues.removeLabel({
85+
owner,
86+
repo,
87+
issue_number,
88+
name: oldLabel,
89+
});
90+
}
91+
}
92+
93+
if (!sizeLabels.includes(label)) {
94+
await github.rest.issues.addLabels({
95+
owner,
96+
repo,
97+
issue_number,
98+
labels: [label],
99+
});
100+
}
101+
102+
core.info(`PR #${issue_number} changed lines: ${total}, assigned label: ${label}`);

‎.gitignore‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,12 @@ GEMINI.md
182182
gemini.md
183183
LocalizerAppMain.md
184184
POLISH_PLAN.md
185+
dev/active/test-coverage-audit/test-coverage-audit-code-review.md
186+
dev/active/flutter-arch-audit/flutter-arch-audit-code-review.md
187+
dev/active/bloc-audit/bloc-audit-code-review.md
188+
dev/active/accessibility-audit/accessibility-audit-code-review.md
189+
bloc.md
190+
CHANGELOG.md
191+
AUDIT_REPORT.md
192+
AUDIT_REPORT.md
193+
CHANGELOG.md

‎pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies:
3131
hive_flutter: ^1.1.0 # For Flutter integration (includes init)
3232
sqflite: ^2.3.2 # For local SQLite storage
3333
sqflite_common_ffi: ^2.3.2 # SQLite on desktop via FFI
34-
intl: ^0.20.2 # For date formatting (upgraded for PlutoGrid compatibility)
34+
intl: ^0.20.2 # For date formatting (compatible with PlutoGrid and Flutter 3.32.x)
3535
csv: ^6.0.0
3636
excel: ^4.0.0
3737
string_similarity: ^2.1.1 # For calculating similarity between modified strings

0 commit comments

Comments
 (0)