Skip to content

Commit

Permalink
Record swift-snapshot-testing snapshots (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-e authored Nov 22, 2024
1 parent a3e8412 commit ab6e2ae
Show file tree
Hide file tree
Showing 32 changed files with 17 additions and 137 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/ios_emerge_upload_snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths: [ios/**, .github/workflows/ios*]

jobs:
build:
upload_emerge_snapshots:
runs-on: macos-14

defaults:
Expand All @@ -35,26 +35,31 @@ jobs:
run: bundle exec fastlane ios build_upload_emerge_snapshot
env:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
upload_snapshots:
runs-on: ubuntu-latest

upload_swift_snapshot_testing_snapshots:
runs-on: macos-14
defaults:
run:
working-directory: ./ios

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_15.4.app/Contents/Developer'
- name: Generate new snapshots
run: |
xcodebuild test \
-scheme HackerNews \
-destination 'platform=iOS Simulator,name=iPhone 14' \
-only-testing:HackerNewsTests/SwiftSnapshotTest
continue-on-error: true
- name: Ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.5
bundler-cache: true

- name: Setup gems
run: gem install emerge

- name: Upload snapshots
env:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
Expand Down
3 changes: 3 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

# Swift Snapshot Testing
**/__Snapshots__/**/*.png

## User settings
xcuserdata/

Expand Down
128 changes: 0 additions & 128 deletions ios/HackerNews.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ios/HackerNewsTests/SwiftSnapshotTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ final class SwiftSnapshotTest: XCTestCase {
}

override func invokeTest() {
// Change the record mode when updating tests
withSnapshotTesting(record: .never) {
// Always record new snapshots
withSnapshotTesting(record: .all) {
super.invokeTest()
}
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.

0 comments on commit ab6e2ae

Please sign in to comment.