Skip to content

Commit 377cb29

Browse files
[CI] Optimize snapshots recording job (#756)
1 parent f45ead6 commit 377cb29

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

.github/workflows/record-snapshots.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@ name: Record Snapshots
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
remove_and_record_snapshots:
7-
description: 'Reset all the snapshots on CI?'
8-
type: boolean
9-
required: false
10-
default: false
115

126
jobs:
137
record:
148
name: Record
159
runs-on: ubuntu-latest
1610
steps:
1711
- uses: actions/[email protected]
18-
- run: gh workflow run smoke-checks.yml --ref "${GITHUB_REF#refs/heads/}" -f record_snapshots=true -f remove_and_record_snapshots=${{ github.event.inputs.remove_and_record_snapshots }}
12+
- run: gh workflow run smoke-checks.yml --ref "${GITHUB_REF#refs/heads/}" -f record_snapshots=true
1913
timeout-minutes: 5
2014
env:
2115
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/smoke-checks.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ on:
99
workflow_dispatch:
1010
inputs:
1111
record_snapshots:
12-
description: 'Record missing snapshots on CI?'
13-
type: boolean
14-
required: false
15-
default: false
16-
remove_and_record_snapshots:
17-
description: 'Reset all the snapshots on CI?'
12+
description: 'Record snapshots on CI?'
1813
type: boolean
1914
required: false
2015
default: false
@@ -52,7 +47,7 @@ jobs:
5247
automated-code-review:
5348
name: Automated Code Review
5449
runs-on: macos-15
55-
if: ${{ github.event.inputs.record_snapshots != 'true' && github.event.inputs.remove_and_record_snapshots != 'true' }}
50+
if: ${{ github.event.inputs.record_snapshots != 'true' }}
5651
env:
5752
XCODE_VERSION: "15.4"
5853
steps:
@@ -71,7 +66,7 @@ jobs:
7166
build-xcode15:
7267
name: Build SDKs (Xcode 15.0)
7368
runs-on: macos-15
74-
if: ${{ github.event.inputs.record_snapshots != 'true' && github.event.inputs.remove_and_record_snapshots != 'true' }}
69+
if: ${{ github.event.inputs.record_snapshots != 'true' }}
7570
env:
7671
XCODE_VERSION: "15.4"
7772
steps:
@@ -104,7 +99,7 @@ jobs:
10499
INSTALL_YEETD: true
105100
INSTALL_SONAR: true
106101
- name: Run UI Tests (Debug)
107-
run: bundle exec fastlane test_ui device:"${{ env.IOS_SIMULATOR_DEVICE }}" record:"${{ github.event.inputs.record_snapshots }}" remove_and_record:"${{ github.event.inputs.remove_and_record_snapshots }}"
102+
run: bundle exec fastlane test_ui device:"${{ env.IOS_SIMULATOR_DEVICE }}" record:"${{ github.event.inputs.record_snapshots }}"
108103
timeout-minutes: 120
109104
env:
110105
GITHUB_TOKEN: ${{ secrets.CI_BOT_GITHUB_TOKEN }} # to open a PR
@@ -139,7 +134,7 @@ jobs:
139134
allure_testops_launch:
140135
name: Launch Allure TestOps
141136
runs-on: macos-13
142-
if: ${{ github.event.inputs.record_snapshots != 'true' && github.event.inputs.remove_and_record_snapshots != 'true' }}
137+
if: ${{ github.event.inputs.record_snapshots != 'true' }}
143138
needs: build-test-app-and-frameworks
144139
outputs:
145140
launch_id: ${{ steps.get_launch_id.outputs.launch_id }}
@@ -158,7 +153,7 @@ jobs:
158153
test-e2e-debug:
159154
name: Test E2E UI (Debug)
160155
runs-on: macos-15
161-
if: ${{ github.event.inputs.record_snapshots != 'true' && github.event.inputs.remove_and_record_snapshots != 'true' }}
156+
if: ${{ github.event.inputs.record_snapshots != 'true' }}
162157
needs:
163158
- allure_testops_launch
164159
- build-test-app-and-frameworks
@@ -213,7 +208,7 @@ jobs:
213208
build-apps:
214209
name: Build Demo App
215210
runs-on: macos-14
216-
if: ${{ github.event.inputs.record_snapshots != 'true' && github.event.inputs.remove_and_record_snapshots != 'true' }}
211+
if: ${{ github.event.inputs.record_snapshots != 'true' }}
217212
needs: build-test-app-and-frameworks
218213
steps:
219214
- uses: actions/[email protected]

fastlane/Fastfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,8 @@ desc 'Runs tests in Debug config'
222222
lane :test_ui do |options|
223223
next unless is_check_required(sources: sources_matrix[:ui], force_check: @force_check)
224224

225-
soft_record_mode = options[:record].to_s == 'true'
226-
hard_record_mode = options[:remove_and_record].to_s == 'true'
227-
record_mode = soft_record_mode || hard_record_mode
228-
remove_snapshots if hard_record_mode
225+
record_mode = options[:record].to_s == 'true'
226+
remove_snapshots if record_mode
229227

230228
update_testplan_on_ci(path: 'StreamChatSwiftUITests/Tests/StreamChatSwiftUI.xctestplan')
231229

0 commit comments

Comments
 (0)