@@ -2,7 +2,7 @@ name: Scheduled Updates (Firmware, Hardware, Translations)
22
33on :
44 schedule :
5- - cron : ' 0 */4 * * *' # Run every 4 hours (was hourly — reduced to cut cascade CI cost )
5+ - cron : ' 0 */6 * * *' # Run every 6 hours (raised from 4h to absorb the added baseline-profile step )
66 workflow_dispatch : # Allow manual triggering
77
88jobs :
@@ -111,6 +111,45 @@ jobs:
111111 run : ./gradlew graphUpdate
112112 continue-on-error : true
113113
114+ # ── Baseline Profile regeneration ───────────────────────────────────
115+ # Runs on every scheduled tick (and manual dispatch). Generation needs a booted emulator
116+ # (~10 min); continue-on-error keeps flakiness from blocking the firmware/translation PR.
117+ - name : Enable KVM (for the emulator)
118+ run : |
119+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
120+ | sudo tee /etc/udev/rules.d/99-kvm4all.rules
121+ sudo udevadm control --reload-rules
122+ sudo udevadm trigger --name-match=kvm
123+
124+ - name : Generate Baseline Profile
125+ id : generate_baseline
126+ continue-on-error : true # Emulator flakiness must not block the firmware/translation PR.
127+ uses : reactivecircus/android-emulator-runner@v2
128+ with :
129+ api-level : 34
130+ target : google_apis # google flavor needs GMS (Maps) on the device image
131+ arch : x86_64
132+ profile : pixel_6
133+ disable-animations : true
134+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
135+ # Writes androidApp/src/google/generated/baselineProfiles/ via the androidx.baselineprofile plugin.
136+ script : ./gradlew :androidApp:generateGoogleReleaseBaselineProfile -Pci=true
137+
138+ - name : Detect baseline profile changes
139+ id : baseline
140+ run : |
141+ profile_dir="androidApp/src/google/generated/baselineProfiles"
142+ outcome="${{ steps.generate_baseline.outcome }}"
143+ if [ "$outcome" = "skipped" ]; then
144+ echo "status=skipped" >> "$GITHUB_OUTPUT"
145+ elif [ "$outcome" != "success" ]; then
146+ echo "::warning::Baseline profile generation failed (outcome: $outcome). Skipping."
147+ echo "status=error" >> "$GITHUB_OUTPUT"
148+ elif [ -n "$(git status --porcelain "$profile_dir" 2>/dev/null)" ]; then
149+ echo "status=updated" >> "$GITHUB_OUTPUT"
150+ else
151+ echo "status=unchanged" >> "$GITHUB_OUTPUT"
152+ fi
114153
115154 - name : Build PR body
116155 id : pr_body
@@ -119,6 +158,7 @@ jobs:
119158 firmware_detail="${{ steps.firmware.outputs.detail }}"
120159 hardware_status="${{ steps.hardware.outputs.status }}"
121160 hardware_detail="${{ steps.hardware.outputs.detail }}"
161+ baseline_status="${{ steps.baseline.outputs.status }}"
122162
123163 body="This PR includes automated updates from the scheduled workflow:"
124164 body+=$'\n'
@@ -139,6 +179,15 @@ jobs:
139179 *) body+=$'\n'"- ❓ \`device_hardware.json\` — unknown status." ;;
140180 esac
141181
182+ # Baseline profile (daily / manual only)
183+ case "$baseline_status" in
184+ updated) body+=$'\n'"- ✅ \`androidApp\` baseline profile regenerated on an emulator." ;;
185+ unchanged) body+=$'\n'"- ✔️ \`androidApp\` baseline profile regenerated — no changes detected." ;;
186+ error) body+=$'\n'"- ⚠️ \`androidApp\` baseline profile generation failed — skipped (see workflow logs)." ;;
187+ skipped) ;; # Not a daily/manual run — omit the line entirely.
188+ *) ;;
189+ esac
190+
142191 # Crowdin & graphs (always attempted)
143192 body+=$'\n'"- Source strings were uploaded to Crowdin."
144193 body+=$'\n'"- Latest translations were downloaded from Crowdin (if available)."
@@ -158,22 +207,24 @@ jobs:
158207 with :
159208 token : ${{ secrets.CROWDIN_GITHUB_TOKEN }}
160209 commit-message : |
161- chore: Scheduled updates (Firmware, Hardware, Translations, Graphs)
210+ chore: Scheduled updates (Firmware, Hardware, Translations, Graphs, Baseline )
162211
163212 Automated updates for:
164213 - Firmware releases list
165214 - Device hardware list
166215 - Crowdin source string uploads
167216 - Crowdin translation downloads
168217 - Module dependency graphs
169- title : ' chore: Scheduled updates (Firmware, Hardware, Translations, Graphs)'
218+ - androidApp baseline profile
219+ title : ' chore: Scheduled updates (Firmware, Hardware, Translations, Graphs, Baseline)'
170220 body : ${{ steps.pr_body.outputs.content }}
171221 branch : ' scheduled-updates'
172222 base : ' main'
173223 delete-branch : true
174224 add-paths : |
175225 androidApp/src/main/assets/firmware_releases.json
176226 androidApp/src/main/assets/device_hardware.json
227+ androidApp/src/google/generated/baselineProfiles/**
177228 fastlane/metadata/android/**
178229 **/strings.xml
179230 **/README.md
0 commit comments