Allow CircleCI to generate new test snapshots#1561
Conversation
e146fbf to
e0bf949
Compare
242dd2e to
696d98e
Compare
NachoSoto
left a comment
There was a problem hiding this comment.
Awesome this looks ready! Amazing job.
The only think I don't understand is what's happening with the iOS 12 snapshots generated. They're way too many. Could you invoke a test run with raw output? I think something is happening with those requests that's making them retry many times for some reason.
| steps: | ||
| - run: | ||
| name: Run create_snapshot_pr | ||
| command: bundle exec fastlane create_snapshot_pr version:"tvos" |
There was a problem hiding this comment.
We don't actually need this one. tvOS tests use the equivalent version (so tvOS 15 uses iOS 15 snapshots). Could it be removed?
| branch_name = "generated_snapshots/#{base_branch}-#{version}" | ||
| sh("git", "checkout", "-b", branch_name) | ||
|
|
||
| sh("git", "add", "../Tests") |
|
@NachoSoto Pushed a commit where no Xcode formatter (raw output) will be used when generating snapshots! |
6b6b552 to
5c5b7c5
Compare
60df869 to
6823c7e
Compare
5c5b7c5 to
21c5086
Compare
|
But let's run it against #1560 to see if it generates the new ones correctly too. |
| prelaunch_simulator: true, | ||
| output_types: 'junit', | ||
| number_of_retries: 5, | ||
| number_of_retries: generate_snapshots ? 0 : 5, |
|
what's the status of this one? |
|
Should we close this for now? |
|
Ahhh... this one was super frustrating! CircleCI wasn't generating the things properly even though it should have. Probably should close it 😬 |
|
We can pair to finish it, I'm sure it's almost ready? |
|
I'd be down to pair sometime 😊 |
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6737/workflows/b945f5f6-6f31-4716-b1ac-6e16e3848c7e/jobs/26321 For some reason, on iOS 12.x only, this: ```swift JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: ``` dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) ``` We don't rely on decoding fragments, so I just updated the test to check `.null` within a dictionary instead. `Snapshotting.formattedData`: use `JSONEncoder.OutputFormatting.withoutEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ``` Update CircleCI config to use pipeline parameters to set generate snapshots env Run all in one serially Split OS version into their own jobs Create PR from all os version jobs This is the one Added requestby user in body Fix for pr actually creating Reordered some things Remove tvos from generated jobs Raw output when generating snapshots Don't retry tests when generating snapshots Maybe this will make the PRs Maybe this This is it
835a255 to
5fb1433
Compare
|
Closing in favor of #2472. |

Depends on #1589
Motivation
Our snapshot testing sometimes needs regeneration and it requires regeneration of iOS 12. iOS 12 simulators only run on Intel machines and not all of us have them.
This PR will allow a CircleCI job to be manually triggered to regenerate snapshot tests
Description
Step 1: Trigger CircleCI workflow
Run
bundle exec fastlane generate_snapshotsStep 2: Run CircleCI workflow with generate snapshots
This will start a series of jobs on CircleCI that will have the
CIRCLECI_TESTS_GENERATE_SNAPSHOTSset totruethat will regenerate new/updated snapshot test assets.Step 3: Create pull requests
If there are any files changed, a new PR will be created against the base branch (set earlier in the
generate_snapshotslane)Example PR 👉 #1578