From 16110c0d0f9bade8df22a1d00f338b419dbfc6b9 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 20:54:36 +0100 Subject: [PATCH 01/24] Screenshot automation --- .github/workflows/screenshots.yml | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/screenshots.yml diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml new file mode 100644 index 00000000000..dea4e4c78f9 --- /dev/null +++ b/.github/workflows/screenshots.yml @@ -0,0 +1,50 @@ +name: Screenshot automation +on: + push: + branches: + - 'release/*' + +jobs: + screenshot-automation: + name: Screenshot automation + runs-on: macos-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Decrypt AuthKey file + run: cd ./fastlane/envfiles && ./decrypt_secrets.sh + env: + AUTH_KEY_FILE_DECRYPTKEY: ${{ secrets.AUTH_KEY_FILE_DECRYPTKEY }} + + - uses: actions/cache@v2 + id: cache-carthage + with: + path: ~/Carthage + key: ${{ runner.os }}-carthage-${{ hashFiles('Cartfile.resolved') }} + + - name: Install sentry-cli + run: curl -sL https://sentry.io/get-cli/ | bash + + - name: Install Dependencies + run: gem install bundler:1.17.3 && bundle install + + - name: Prepare xcodeproj + run: sh scripts/setup.sh + + - name: Run Fastlane beta lane + run: bundle exec fastlane screenshots + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + FASTLANE_USER: ${{ secrets.FASTLANE_USER }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }} + MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} + MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + PILOT_APPLE_ID: ${{ secrets.PILOT_APPLE_ID }} + SPACESHIP_CONNECT_API_ISSUER_ID: ${{ secrets.SPACESHIP_CONNECT_API_ISSUER_ID }} + SPACESHIP_CONNECT_API_KEY_ID: ${{ secrets.SPACESHIP_CONNECT_API_KEY_ID }} + SPACESHIP_CONNECT_API_KEY_FILEPATH: envfiles/AuthKey_KDAUTTM76R.p8 + CI_RELEASE: true + From 773498a6abc481ce260089097ef1737789a34b48 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 21:46:56 +0100 Subject: [PATCH 02/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index dea4e4c78f9..fa3d7931b48 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -2,7 +2,8 @@ name: Screenshot automation on: push: branches: - - 'release/*' + #- 'release/*' + - '*' jobs: screenshot-automation: From 2e2163bc460125af5355121f39348e02f4cfe9de Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 21:47:57 +0100 Subject: [PATCH 03/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index fa3d7931b48..9b4d0dd0f4c 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -1,9 +1,9 @@ name: Screenshot automation -on: - push: - branches: +#on: + #push: + #branches: #- 'release/*' - - '*' +on: [push] jobs: screenshot-automation: From 42d554075cac2a8fc02d81530742c418279950a1 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 21:50:21 +0100 Subject: [PATCH 04/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index 9b4d0dd0f4c..bda7562f707 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -3,7 +3,7 @@ name: Screenshot automation #push: #branches: #- 'release/*' -on: [push] +on: [push, pull_request] jobs: screenshot-automation: From eee721d9561afb48aec26daf0e7bf9aa7163a166 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 21:54:34 +0100 Subject: [PATCH 05/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index bda7562f707..7a4996b643d 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -35,6 +35,7 @@ jobs: - name: Run Fastlane beta lane run: bundle exec fastlane screenshots + env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} FASTLANE_USER: ${{ secrets.FASTLANE_USER }} From e5382c086e70aca4008c33e8e8950d6e4da22d38 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 22:07:30 +0100 Subject: [PATCH 06/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index 7a4996b643d..f7f99290b28 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -34,7 +34,7 @@ jobs: run: sh scripts/setup.sh - name: Run Fastlane beta lane - run: bundle exec fastlane screenshots + run: bundle exec fastlane snapshot env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} @@ -49,4 +49,7 @@ jobs: SPACESHIP_CONNECT_API_KEY_ID: ${{ secrets.SPACESHIP_CONNECT_API_KEY_ID }} SPACESHIP_CONNECT_API_KEY_FILEPATH: envfiles/AuthKey_KDAUTTM76R.p8 CI_RELEASE: true - + - uses: actions/upload-artifact@v2 + with: + name: screenshots + path: fastlane/screenshots/ # or path/to/artifact From b2b986f46f9247b119c19cf7848f87dab0af2a45 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 22:08:10 +0100 Subject: [PATCH 07/24] Rename disabletravis.txt to travis.yml --- disabletravis.txt => travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename disabletravis.txt => travis.yml (100%) diff --git a/disabletravis.txt b/travis.yml similarity index 100% rename from disabletravis.txt rename to travis.yml From 2953a33b28df5230dce83ceeba327c81d4cb655c Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 22:14:38 +0100 Subject: [PATCH 08/24] Delete travis.yml --- travis.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 travis.yml diff --git a/travis.yml b/travis.yml deleted file mode 100644 index 388c1d0d266..00000000000 --- a/travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: swift -osx_image: xcode11 -before_install: -- openssl aes-256-cbc -K $encrypted_593143e92a35_key -iv $encrypted_593143e92a35_iv - -in fastlane/envfiles/AuthKey_KDAUTTM76R.p8.enc -out fastlane/envfiles/AuthKey_KDAUTTM76R.p8 -d -- FILE="/usr/local/bin/mint"; if [[ -d $FILE ]]; then rm -rf "$FILE"; fi -- sh scripts/setup.sh -- killall Xcode || true -xcode_project: OpenFoodFacts.xcodeproj -xcode_destination: platform=iOS Simulator,OS=13.0,name=iPhone 11 -xcode_scheme: OpenFoodFacts -cache: - bundler: true - directories: - - Carthage - - "/usr/local/lib/mint" - - "/usr/local/bin/mint" -notifications: - slack: openfoodfacts:Pw0UOEvADDxNN90ugITF7PKC -env: - global: - secure: TzLeh5qKxmFNlP/LpwsBPdjmXu7UpyKIe6SQdHDQm/bQ9+fSu89Lp8Db9dTPyWXEgKcC3i5X0TeaRcEzvYBk3eZdevd3Axx6dA+xM31FRtGVmZdJ62tUZbQsLNHJo5lAe+K6gQBfiJd983s2goEwrNHNnRaGrmv7xSPPJW4DCeCFW9S/jC0cRCcSZwdrmR986DjnIr7aTiWaSd+XMms60rmBCb7jZbCxYAOPU64uOqRdc0Og2mi8q1XHZzWi7b2OkAdpOwrWzcd4K2XTxfbEIbfhOkAg9bZ2h3+z7VMpWcUYwV7aIOo4ra2u/QkzNK6jZ4Q3h3TLK0e4ilj6vNCWsCqYScDU/BzgZCfhenWcD75Zz5CO0rdAlyQ3gMaxvIsntEyiCpUknYi+i1lMfH/mFwnb323qYdIXJ/BEBLnycqZqZksl43DUoKjmxMElNKKJ8g+TKp+M7FXKBKCd/zPejycLsq4/Z50OKPHPa+q7SLoo1Iryir5IRlD9uZ1EWQq2II2ACUZRuf0gA6GUm7aZEJNWk8QrunI0G75TlKmu9l7gsie5NVMcqZeETfU3vIxuFKJtbV/k2Viw/sQ6h2pr4hUf/VRrfzZCAljTs7ZgKP1sweMRGgU/U2T/Kw2/wB7no8eZ9KdrEcxe1xid0yKyTIWBkeP+7Yvjcu2y2GtYao0= -jobs: - include: - - stage: Deploy - name: Deploy to TestFlight - install: - - brew install getsentry/tools/sentry-cli - - bundle install - script: - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then travis_wait 50 bundle exec fastlane beta; fi' - if: branch =~ /^release\/.*$/ From c7741f8096a1f92595aa49881b927ca6c2297dea Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 22:22:49 +0100 Subject: [PATCH 09/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index f7f99290b28..d711526e633 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -51,5 +51,5 @@ jobs: CI_RELEASE: true - uses: actions/upload-artifact@v2 with: - name: screenshots - path: fastlane/screenshots/ # or path/to/artifact + name: screenshots + path: fastlane/screenshots/ # or path/to/artifact From 81135aafe6a05e102b3464d8d40e0e7c57b9df80 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 22:38:19 +0100 Subject: [PATCH 10/24] Update project.yml --- project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.yml b/project.yml index 02e8cb6803f..8f1ac45ae25 100644 --- a/project.yml +++ b/project.yml @@ -1,6 +1,6 @@ name: OpenFoodFacts -fileGroups: [Cartfile, CONTRIBUTING.md, crowdin.yml, fastlane, ISSUE_TEMPLATE.md, LICENSE, project.yml, PULL_REQUEST_TEMPLATE.md, README.md, Snapshots, scripts, .swiftlint.yml, .travis.yml, .gitignore] +fileGroups: [Cartfile, CONTRIBUTING.md, crowdin.yml, fastlane, ISSUE_TEMPLATE.md, LICENSE, project.yml, PULL_REQUEST_TEMPLATE.md, README.md, Snapshots, scripts, .swiftlint.yml, .gitignore] options: minimumXcodeGenVersion: 2.14.0 From 635c94f2eae55b63cc92e392cfd3236101bf7f1d Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 22:50:29 +0100 Subject: [PATCH 11/24] Update Snapfile --- fastlane/Snapfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fastlane/Snapfile b/fastlane/Snapfile index dbaa6e3fceb..e888944ee52 100644 --- a/fastlane/Snapfile +++ b/fastlane/Snapfile @@ -9,13 +9,15 @@ devices([ # "iPhone Xs Max", # "iPad Pro (12.9-inch) (2nd generation)", -"iPad Pro (12.9-inch) (3rd generation)" +"iPad Pro (12.9-inch) (4th generation)" #"iPad Pro (12.9-inch)", # "iPad Pro (9.7-inch)", # "Apple TV 1080p" ]) + + languages([ "en-US", "fr-FR" From 718332dcec046c8d171e18ea070f221f58407a63 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 23:00:20 +0100 Subject: [PATCH 12/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index d711526e633..623d87000be 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -34,7 +34,7 @@ jobs: run: sh scripts/setup.sh - name: Run Fastlane beta lane - run: bundle exec fastlane snapshot + run: bundle exec fastlane snapshot update && fastlane snapshot env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} From 0e385aabe74f60b33983441ae5d771a852530113 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 23:11:54 +0100 Subject: [PATCH 13/24] Update SnapshotHelper.swift --- Snapshots/SnapshotHelper.swift | 78 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/Snapshots/SnapshotHelper.swift b/Snapshots/SnapshotHelper.swift index aaa2a9a9234..25f8e5e4a21 100644 --- a/Snapshots/SnapshotHelper.swift +++ b/Snapshots/SnapshotHelper.swift @@ -38,22 +38,13 @@ func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { } enum SnapshotError: Error, CustomDebugStringConvertible { - case cannotDetectUser - case cannotFindHomeDirectory case cannotFindSimulatorHomeDirectory - case cannotAccessSimulatorHomeDirectory(String) case cannotRunOnPhysicalDevice var debugDescription: String { switch self { - case .cannotDetectUser: - return "Couldn't find Snapshot configuration files - can't detect current user " - case .cannotFindHomeDirectory: - return "Couldn't find Snapshot configuration files - can't detect `Users` dir" case .cannotFindSimulatorHomeDirectory: return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable." - case .cannotAccessSimulatorHomeDirectory(let simulatorHostHome): - return "Can't prepare environment. Simulator home location is inaccessible. Does \(simulatorHostHome) exist?" case .cannotRunOnPhysicalDevice: return "Can't use Snapshot on a physical device." } @@ -75,7 +66,7 @@ open class Snapshot: NSObject { Snapshot.waitForAnimations = waitForAnimations do { - let cacheDir = try pathPrefix() + let cacheDir = try getCacheDirectory() Snapshot.cacheDirectory = cacheDir setLanguage(app) setLocale(app) @@ -174,6 +165,12 @@ open class Snapshot: NSObject { } let screenshot = XCUIScreen.main.screenshot() + #if os(iOS) + let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image + #else + let image = screenshot.image + #endif + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } do { @@ -183,7 +180,11 @@ open class Snapshot: NSObject { simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") - try screenshot.pngRepresentation.write(to: path) + #if swift(<5.0) + UIImagePNGRepresentation(image)?.write(to: path, options: .atomic) + #else + try image.pngData()?.write(to: path, options: .atomic) + #endif } catch let error { NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") NSLog(error.localizedDescription) @@ -191,6 +192,19 @@ open class Snapshot: NSObject { #endif } + class func fixLandscapeOrientation(image: UIImage) -> UIImage { + if #available(iOS 10.0, *) { + let format = UIGraphicsImageRendererFormat() + format.scale = image.scale + let renderer = UIGraphicsImageRenderer(size: image.size, format: format) + return renderer.image { context in + image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) + } + } else { + return image + } + } + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { #if os(tvOS) return @@ -206,40 +220,28 @@ open class Snapshot: NSObject { _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) } - class func pathPrefix() throws -> URL? { - let homeDir: URL + class func getCacheDirectory() throws -> URL { + let cachePath = "Library/Caches/tools.fastlane" // on OSX config is stored in /Users//Library // and on iOS/tvOS/WatchOS it's in simulator's home dir #if os(OSX) - guard let user = ProcessInfo().environment["USER"] else { - throw SnapshotError.cannotDetectUser - } - - guard let usersDir = FileManager.default.urls(for: .userDirectory, in: .localDomainMask).first else { - throw SnapshotError.cannotFindHomeDirectory + let homeDir = URL(fileURLWithPath: NSHomeDirectory()) + return homeDir.appendingPathComponent(cachePath) + #elseif arch(i386) || arch(x86_64) || arch(arm64) + guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { + throw SnapshotError.cannotFindSimulatorHomeDirectory } - - homeDir = usersDir.appendingPathComponent(user) + let homeDir = URL(fileURLWithPath: simulatorHostHome) + return homeDir.appendingPathComponent(cachePath) #else - #if arch(i386) || arch(x86_64) - guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { - throw SnapshotError.cannotFindSimulatorHomeDirectory - } - guard let homeDirUrl = URL(string: simulatorHostHome) else { - throw SnapshotError.cannotAccessSimulatorHomeDirectory(simulatorHostHome) - } - homeDir = URL(fileURLWithPath: homeDirUrl.path) - #else - throw SnapshotError.cannotRunOnPhysicalDevice - #endif + throw SnapshotError.cannotRunOnPhysicalDevice #endif - return homeDir.appendingPathComponent("Library/Caches/tools.fastlane") } } private extension XCUIElementAttributes { var isNetworkLoadingIndicator: Bool { - if hasWhiteListedIdentifier { return false } + if hasAllowListedIdentifier { return false } let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) @@ -247,10 +249,10 @@ private extension XCUIElementAttributes { return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize } - var hasWhiteListedIdentifier: Bool { - let whiteListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] + var hasAllowListedIdentifier: Bool { + let allowListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] - return whiteListedIdentifiers.contains(identifier) + return allowListedIdentifiers.contains(identifier) } func isStatusBar(_ deviceWidth: CGFloat) -> Bool { @@ -300,4 +302,4 @@ private extension CGFloat { // Please don't remove the lines below // They are used to detect outdated configuration files -// SnapshotHelperVersion [1.21] +// SnapshotHelperVersion [1.24] From 63123b7caba473c8dc56bddbc27275d819ad6066 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 8 Feb 2021 23:27:33 +0100 Subject: [PATCH 14/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index 623d87000be..d711526e633 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -34,7 +34,7 @@ jobs: run: sh scripts/setup.sh - name: Run Fastlane beta lane - run: bundle exec fastlane snapshot update && fastlane snapshot + run: bundle exec fastlane snapshot env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} From 8d6f593c0968ae0540171e58a748d7caad097a40 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Tue, 9 Feb 2021 00:14:03 +0100 Subject: [PATCH 15/24] Update Snapfile --- fastlane/Snapfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fastlane/Snapfile b/fastlane/Snapfile index e888944ee52..623d316cf22 100644 --- a/fastlane/Snapfile +++ b/fastlane/Snapfile @@ -169,11 +169,16 @@ languages([ # The name of the scheme which contains the UI Tests scheme("OpenFoodFactsSnapshots") +workspace + # Where should the resulting screenshots be stored? output_directory("./fastlane/screenshots") # remove the '#' to clear all previously generated screenshots before creating new ones -# clear_previous_screenshots(true) +clear_previous_screenshots(true) + +override_status_bar(true) +localize_simulator(true) # Arguments to pass to the app on launch. See https://docs.fastlane.tools/actions/snapshot/#launch-arguments launch_arguments(["debug"]) From 15c683a39905ead25feddac315eba6d9d5195d74 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Tue, 9 Feb 2021 00:14:48 +0100 Subject: [PATCH 16/24] Update Snapfile --- fastlane/Snapfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/fastlane/Snapfile b/fastlane/Snapfile index 623d316cf22..66c590f9418 100644 --- a/fastlane/Snapfile +++ b/fastlane/Snapfile @@ -169,8 +169,6 @@ languages([ # The name of the scheme which contains the UI Tests scheme("OpenFoodFactsSnapshots") -workspace - # Where should the resulting screenshots be stored? output_directory("./fastlane/screenshots") From 4c41f218dd1fe13c2440b93c613bbe1da6779841 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Tue, 9 Feb 2021 00:17:40 +0100 Subject: [PATCH 17/24] Update setup.sh --- scripts/setup.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 07b1c7ad9fd..eeb7aa5e8f2 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -24,12 +24,12 @@ fi echo "✨ Installing mint dependencies" mint bootstrap -l -if [ "$CI" = true ] ; then - echo "✨ Skipping carthage dependencies as CI=true" -else - echo "✨ Installing carthage dependencies" - carthage bootstrap --platform iOS --cache-builds -fi +# if [ "$CI" = true ] ; then + # echo "✨ Skipping carthage dependencies as CI=true" +# else +echo "✨ Installing carthage dependencies" +carthage bootstrap --platform iOS --cache-builds +# fi echo "✨ Generating project" . $SCRIPTS_DIR/create-project.sh From 5f10930312e63287b52e93d170318807ee292ef8 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Tue, 9 Feb 2021 00:39:45 +0100 Subject: [PATCH 18/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index d711526e633..5022284071a 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -23,7 +23,8 @@ jobs: with: path: ~/Carthage key: ${{ runner.os }}-carthage-${{ hashFiles('Cartfile.resolved') }} - + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install sentry-cli run: curl -sL https://sentry.io/get-cli/ | bash @@ -32,8 +33,10 @@ jobs: - name: Prepare xcodeproj run: sh scripts/setup.sh + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run Fastlane beta lane + - name: Run Fastlane snapshot run: bundle exec fastlane snapshot env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b65b8e383f52b6e0e86b98108a2c48089d3b02ff Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Tue, 9 Feb 2021 00:57:42 +0100 Subject: [PATCH 19/24] Update setup.sh --- scripts/setup.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index eeb7aa5e8f2..fd965ec3759 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -24,12 +24,12 @@ fi echo "✨ Installing mint dependencies" mint bootstrap -l -# if [ "$CI" = true ] ; then - # echo "✨ Skipping carthage dependencies as CI=true" -# else -echo "✨ Installing carthage dependencies" -carthage bootstrap --platform iOS --cache-builds -# fi +if [ "$CI" = true ] ; then + echo "✨ Skipping carthage dependencies as CI=true" +else + echo "✨ Installing carthage dependencies" + carthage bootstrap --platform iOS --cache-builds +fi echo "✨ Generating project" . $SCRIPTS_DIR/create-project.sh From ebd81b8760130b8ede1098e894befc11c2abe520 Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Tue, 9 Feb 2021 10:20:28 +0100 Subject: [PATCH 20/24] Update setup.sh --- scripts/setup.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index fd965ec3759..c771dfbcdcd 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -24,12 +24,12 @@ fi echo "✨ Installing mint dependencies" mint bootstrap -l -if [ "$CI" = true ] ; then - echo "✨ Skipping carthage dependencies as CI=true" -else - echo "✨ Installing carthage dependencies" - carthage bootstrap --platform iOS --cache-builds -fi +#if [ "$CI" = true ] ; then +# echo "✨ Skipping carthage dependencies as CI=true" +#else +echo "✨ Installing carthage dependencies" +carthage bootstrap --platform iOS --cache-builds +#fi echo "✨ Generating project" . $SCRIPTS_DIR/create-project.sh From 09ea0f6f3ea9991e0f2e6a721184db4c0154311a Mon Sep 17 00:00:00 2001 From: Philippe Auriach Date: Tue, 9 Feb 2021 10:43:24 +0100 Subject: [PATCH 21/24] mock conform to protocols --- Tests/Common/DataManagerMock.swift | 5 +++++ Tests/Models/PersistenceManagerMock.swift | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Tests/Common/DataManagerMock.swift b/Tests/Common/DataManagerMock.swift index 34f5622ed62..f2e5041f53c 100644 --- a/Tests/Common/DataManagerMock.swift +++ b/Tests/Common/DataManagerMock.swift @@ -12,6 +12,7 @@ import RealmSwift import UIKit class DataManagerMock: DataManagerProtocol { + // Search var query: String? var page: Int? @@ -123,6 +124,10 @@ class DataManagerMock: DataManagerProtocol { func allergen(forTag: Tag) -> Allergen? { return nil } + + func label(forTag: String) -> Label? { + return nil + } func additive(forTag: Tag) -> Additive? { return nil diff --git a/Tests/Models/PersistenceManagerMock.swift b/Tests/Models/PersistenceManagerMock.swift index 80244d94cbb..d44e2d9a3c7 100644 --- a/Tests/Models/PersistenceManagerMock.swift +++ b/Tests/Models/PersistenceManagerMock.swift @@ -10,6 +10,8 @@ import RealmSwift class PersistenceManagerMock: PersistenceManagerProtocol { + var labelsIsEmpty: Bool = false + // =======------------------======= // // TODO: implement code below if needed (for now only add the function/propety signatures, so it builds) // =======------------------======= // From 557baf2f479ee7abd1778419d54a6cdbc2bb98ca Mon Sep 17 00:00:00 2001 From: Philippe Auriach Date: Tue, 9 Feb 2021 10:50:39 +0100 Subject: [PATCH 22/24] use a lane for snapshots --- .github/workflows/screenshots.yml | 2 +- fastlane/Fastfile | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index 5022284071a..86ac3566b71 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -37,7 +37,7 @@ jobs: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run Fastlane snapshot - run: bundle exec fastlane snapshot + run: bundle exec fastlane perform_snapshots env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 07433be58ce..79dcefea7f1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -150,3 +150,9 @@ desc "Upload metadata" lane :metadata do deliver(skip_binary_upload: true) end + +lane :perform_snapshots do + carthage(command: "bootstrap", platform: "iOS", cache_builds: true) + + snapshot +end \ No newline at end of file From bcffcf338fa88d0f9204ef7800ae34602bb936a9 Mon Sep 17 00:00:00 2001 From: Philippe Auriach Date: Tue, 9 Feb 2021 10:58:07 +0100 Subject: [PATCH 23/24] setup.sh should not build carthage in CI mode, as it is done by fastlane --- scripts/setup.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index c771dfbcdcd..07b1c7ad9fd 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -24,12 +24,12 @@ fi echo "✨ Installing mint dependencies" mint bootstrap -l -#if [ "$CI" = true ] ; then -# echo "✨ Skipping carthage dependencies as CI=true" -#else -echo "✨ Installing carthage dependencies" -carthage bootstrap --platform iOS --cache-builds -#fi +if [ "$CI" = true ] ; then + echo "✨ Skipping carthage dependencies as CI=true" +else + echo "✨ Installing carthage dependencies" + carthage bootstrap --platform iOS --cache-builds +fi echo "✨ Generating project" . $SCRIPTS_DIR/create-project.sh From 8951075b3f282d82a390ba0611d80d26108d372e Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Tue, 9 Feb 2021 13:48:00 +0100 Subject: [PATCH 24/24] Update screenshots.yml --- .github/workflows/screenshots.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index 86ac3566b71..7bea49f1284 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -1,9 +1,8 @@ name: Screenshot automation -#on: - #push: - #branches: - #- 'release/*' -on: [push, pull_request] +on: + push: + branches: + - 'screenshots/*' jobs: screenshot-automation: