-
-
Notifications
You must be signed in to change notification settings - Fork 487
161 lines (142 loc) · 5.91 KB
/
Copy pathpull-request.yml
File metadata and controls
161 lines (142 loc) · 5.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Pull Request CI
on:
pull_request:
branches: [ main, "release/**" ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# 1. CHANGE DETECTION: Prevents unnecessary builds
check-changes:
if: github.repository == 'meshtastic/Meshtastic-Android' && !( github.head_ref == 'scheduled-updates' || github.head_ref == 'l10n_main' )
runs-on: ubuntu-24.04-arm
timeout-minutes: 10
outputs:
android: ${{ steps.filter.outputs.android }}
steps:
- uses: actions/checkout@v7.0.0
- uses: dorny/paths-filter@v4
id: filter
with:
token: ''
filters: |
android:
# CI/workflow implementation
- '.github/workflows/**'
- '.github/actions/**'
# Product modules validated by reusable-check
- 'androidApp/**'
- 'baselineprofile/**'
- 'desktopApp/**'
- 'core/**'
- 'feature/**'
- 'screenshot-tests/**'
- 'docs-screenshots/**'
# Shared build infrastructure
- 'build-logic/**'
- 'config/**'
- 'gradle/**'
# Root build entrypoints/config that can alter task graph or outputs
- 'build.gradle.kts'
- 'config.properties'
- 'compose_compiler_config.conf'
- 'gradle.properties'
- 'gradlew'
- 'gradlew.bat'
- 'settings.gradle.kts'
- 'test.gradle.kts'
# 1b. FILTER DRIFT CHECK: Ensures check-changes stays aligned with module roots
verify-check-changes-filter:
if: github.repository == 'meshtastic/Meshtastic-Android' && !( github.head_ref == 'scheduled-updates' || github.head_ref == 'l10n_main' )
runs-on: ubuntu-24.04-arm
timeout-minutes: 10
steps:
- uses: actions/checkout@v7.0.0
- name: Verify module roots are represented in check-changes filter
run: |
python3 - <<'PY'
import re
from pathlib import Path
settings = Path('settings.gradle.kts').read_text()
workflow = Path('.github/workflows/pull-request.yml').read_text()
module_roots = {
module.split(':')[0]
for module in re.findall(r'":([^"]+)"', settings)
}
allowed_extra_roots = {'baselineprofile'}
expected_roots = module_roots | allowed_extra_roots
filter_paths = {
path.split('/')[0]
for path in re.findall(r"-\s*'([^']+/\*\*)'", workflow)
}
actual_module_roots = filter_paths & expected_roots
missing = sorted(expected_roots - actual_module_roots)
unexpected = sorted(actual_module_roots - expected_roots)
if missing or unexpected:
print('check-changes filter drift detected:')
if missing:
print(' Missing roots:', ', '.join(missing))
if unexpected:
print(' Unexpected roots:', ', '.join(unexpected))
raise SystemExit(1)
print('check-changes filter is aligned with settings.gradle module roots.')
PY
# 1c. STORE METADATA: Enforce store-listing length limits (e.g. the F-Droid /
# Play 80-char short_description). These files are mirrored from Crowdin, so
# this guard intentionally runs on the translation-sync PRs too (no
# scheduled-updates / l10n_main skip) -- that is where overlength translations
# land. It is a standalone lightweight job, decoupled from the Gradle build so
# a one-line translation fix never triggers a full assemble/test cycle.
check-metadata:
name: Check Store Metadata
if: github.repository == 'meshtastic/Meshtastic-Android'
runs-on: ubuntu-24.04-arm
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Validate store listing metadata lengths
run: python3 scripts/check-metadata-length.py
# 2. VALIDATION & BUILD: Delegate to reusable-check.yml
# We disable coverage and desktop builds for PRs to keep feedback fast
# (< 10 mins). Desktop compilation is already covered by the :desktopApp:test
# task in the shard-app test shard.
validate-and-build:
needs: check-changes
if: needs.check-changes.outputs.android == 'true'
uses: ./.github/workflows/reusable-check.yml
with:
run_lint: true
run_unit_tests: true
run_coverage: false
upload_artifacts: true
secrets: inherit
# 3. WORKFLOW STATUS: Ensures required checks are satisfied
check-workflow-status:
name: Check Workflow Status
runs-on: ubuntu-24.04-arm
timeout-minutes: 5
permissions: {}
needs: [check-changes, verify-check-changes-filter, check-metadata, validate-and-build]
if: always()
steps:
- name: Check Workflow Status
run: |
if [[ "${{ needs.verify-check-changes-filter.result }}" == "failure" || "${{ needs.verify-check-changes-filter.result }}" == "cancelled" ]]; then
echo "::error::check-changes filter verification failed"
exit 1
fi
if [[ "${{ needs.check-metadata.result }}" == "failure" || "${{ needs.check-metadata.result }}" == "cancelled" ]]; then
echo "::error::Store metadata length check failed"
exit 1
fi
# If changes were detected but build failed, fail the status check
if [[ "${{ needs.check-changes.outputs.android }}" == "true" && ("${{ needs.validate-and-build.result }}" == "failure" || "${{ needs.validate-and-build.result }}" == "cancelled") ]]; then
echo "::error::Android Check failed"
exit 1
fi
# If no changes were detected, this still succeeds to satisfy required status check
echo "Workflow status satisfied."