Skip to content

Commit 5f24404

Browse files
committed
Temporary: record snapshot references on CI
1 parent 5391a9d commit 5f24404

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Temporary: records the snapshot references for this branch on a mac runner and
2+
# commits them back. Delete before opening the pull request.
3+
name: Record Snapshots
4+
5+
permissions:
6+
contents: write
7+
8+
on:
9+
push:
10+
branches:
11+
- claude/complication-icon-color-watch-iqh2hf
12+
13+
env:
14+
DEVELOPER_DIR: /Applications/Xcode_26.4.app/Contents/Developer
15+
FASTLANE_SKIP_UPDATE_CHECK: true
16+
FASTLANE_XCODE_LIST_TIMEOUT: 80
17+
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 80
18+
BUNDLE_PATH: vendor/bundle
19+
20+
jobs:
21+
record:
22+
runs-on: macos-26
23+
timeout-minutes: 120
24+
steps:
25+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26+
with:
27+
fetch-depth: 0
28+
29+
- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
30+
with:
31+
ruby-version: .ruby-version
32+
33+
- name: Install Gems
34+
run: bundle install --jobs 4 --retry 3
35+
36+
# A missing reference is recorded and then reported as a failure, which aborts the
37+
# lane before the watchOS suite it runs second. Repeat until a run comes back green:
38+
# the first records the iOS references, the second the watchOS ones, the third asserts
39+
# against both.
40+
- name: Record snapshots
41+
id: record
42+
continue-on-error: true
43+
run: |
44+
for attempt in 1 2 3; do
45+
echo "::group::fastlane test (attempt $attempt)"
46+
if bundle exec fastlane test; then
47+
echo "::endgroup::"
48+
echo "Tests passed on attempt $attempt"
49+
exit 0
50+
fi
51+
echo "::endgroup::"
52+
done
53+
echo "Tests still failing after 3 attempts"
54+
exit 1
55+
56+
- name: Report patch coverage
57+
continue-on-error: true
58+
run: |
59+
python3 Tools/xccov_to_lcov.py fastlane/test_output/Tests-Unit.xcresult \
60+
--lcov fastlane/test_output/coverage.lcov \
61+
--summary "$GITHUB_STEP_SUMMARY"
62+
python3 Tools/diff_coverage.py fastlane/test_output/coverage.lcov \
63+
--base origin/main \
64+
--threshold 90 \
65+
--summary "$GITHUB_STEP_SUMMARY"
66+
67+
- name: Commit recorded snapshots
68+
run: |
69+
find Tests -name '*.failure.png' -delete
70+
git config user.name "github-actions[bot]"
71+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
72+
git add Tests
73+
if git diff --cached --quiet; then
74+
echo "No snapshot changes to commit"
75+
exit 0
76+
fi
77+
git commit -m "Record complication icon color snapshot references"
78+
git push origin "HEAD:$GITHUB_REF_NAME"
79+
80+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
81+
if: ${{ always() }}
82+
with:
83+
name: test-logs
84+
path: |
85+
~/Library/Logs/scan
86+
~/Library/Developer/Xcode/DerivedData/HomeAssistant-*/Logs/Test
87+
if-no-files-found: ignore

0 commit comments

Comments
 (0)