Skip to content

Commit

Permalink
Merge pull request #211 from WeTransfer/feature/bitrise-update
Browse files Browse the repository at this point in the history
Migrate to Bitrise & Danger-Swift
  • Loading branch information
AvdLee authored Jan 28, 2020
2 parents eef276b + 28eaaf9 commit a8e9911
Show file tree
Hide file tree
Showing 20 changed files with 174 additions and 90 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "Submodules/WeTransfer-iOS-CI"]
path = Submodules/WeTransfer-iOS-CI
url=https://github.com/WeTransfer/WeTransfer-iOS-CI.git
url = https://github.com/WeTransfer/WeTransfer-iOS-CI.git
branch = master
[submodule "Submodules/ios-snapshot-test-case"]
path = Submodules/ios-snapshot-test-case
url = https://github.com/uber/ios-snapshot-test-case/
branch = master
url = https://github.com/uber/ios-snapshot-test-case.git
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://help.github.com/en/articles/about-code-owners
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence, they
# will be requested for review when someone opens a PR.
* @Boris-Em @AvdLee
4 changes: 0 additions & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## Changelog

### Next

### 1.3.0
- Updated SwiftLint code style rules
- Forcing a changelog entry now from CI
Expand Down
4 changes: 4 additions & 0 deletions Dangerfile.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Danger
import WeTransferPRLinter

WeTransferPRLinter.lint()
15 changes: 2 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
# frozen_string_literal: true
source "https://rubygems.org"

# Needed for Fastlane & Danger
gem 'danger'
gem 'danger-junit'
gem 'danger-swiftlint'
gem 'danger-xcov'
gem 'danger-xcode_summary'
gem 'fastlane'
gem 'xcpretty'
gem 'xcpretty-json-formatter'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
ci_gems_path = File.join(File.dirname(__FILE__), "Submodules/WeTransfer-iOS-CI/Gemfile")
eval_gemfile(ci_gems_path) if File.exist?(ci_gems_path)
115 changes: 115 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.0)
claide (1.0.3)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
coderay (1.1.2)
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
danger (6.2.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (~> 0.9)
faraday-http-cache (~> 2.0)
git (~> 1.5)
kramdown (~> 2.0)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 4.7)
terminal-table (~> 1)
danger-junit (1.0.0)
danger (> 2.0)
ox (~> 2.0)
danger-rubocop (0.7.1)
danger
rubocop
diff-lcs (1.3)
docile (1.1.5)
faraday (0.17.3)
multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0)
faraday (~> 0.8)
git (1.5.0)
json (2.3.0)
kramdown (2.1.0)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
method_source (0.9.2)
multipart-post (2.1.1)
nap (1.1.0)
no_proxy_fix (0.1.2)
octokit (4.15.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
ox (2.12.1)
parallel (1.19.1)
parser (2.7.0.2)
ast (~> 2.4.0)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (4.0.3)
rainbow (2.2.2)
rake
rake (13.0.1)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.10.1)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
simplecov (0.12.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.6.1)

PLATFORMS
ruby

DEPENDENCIES
danger
danger-junit
danger-rubocop
pry
rspec
rspec_junit_formatter (~> 0.2)
rubocop (~> 0.49.0)
simplecov (~> 0.12.0)

BUNDLED WITH
2.1.4
20 changes: 20 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// swift-tools-version:5.1
// We're hiding dev, test, and danger dependencies with // dev to make sure they're not fetched by users of this package.
import PackageDescription

let package = Package(
name: "Coyote",
products: [
// dev .library(name: "DangerDeps", type: .dynamic, targets: ["DangerDependencies"]) // dev
],
dependencies: [
// dev .package(url: "https://github.com/danger/swift", from: "3.0.0"),
// dev .package(path: "Submodules/WeTransfer-iOS-CI/Danger-Swift")
],
targets: [
// This is just an arbitrary Swift file in the app, that has
// no dependencies outside of Foundation, the dependencies section
// ensures that the library for Danger gets build also.
// dev .target(name: "DangerDependencies", dependencies: ["Danger", "WeTransferPRLinter"], path: "Submodules/WeTransfer-iOS-CI/Danger-Swift", sources: ["DangerFakeSource.swift"])
]
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>

<p align="center">
<img src="https://travis-ci.com/WeTransfer/WeScan.svg?token=Ur5V2zzKmBJLmMYHKJTF&branch=master"/>
<img src="https://app.bitrise.io/app/df00af454f27891d.svg?token=spjxNvzjnRqug6GfGM3_Lg"/>
<img src="https://img.shields.io/cocoapods/v/WeScan.svg?style=flat"/>
<img src="https://img.shields.io/cocoapods/l/WeScan.svg?style=flat"/>
<img src="https://img.shields.io/cocoapods/p/WeScan.svg?style=flat"/>
Expand Down
2 changes: 1 addition & 1 deletion Submodules/WeTransfer-iOS-CI
Submodule WeTransfer-iOS-CI updated 40 files
+7 −1 .gitignore
+0 −3 .rspec
+0 −7 .travis.yml
+ Assets/bitrise_env_vars.png
+ Assets/runscript.png
+46 −0 Bitrise/tag_releasing_bitrise.yml
+79 −0 Bitrise/testing_bitrise.yml
+5 −0 CODEOWNERS
+5 −2 Changelog.md
+6 −0 Danger-Swift/.gitignore
+3 −0 Danger-Swift/DangerFakeSource.swift
+28 −0 Danger-Swift/Package.swift
+37 −0 Danger-Swift/Sources/WeTransferPRLinter/CoverageReporter.swift
+24 −0 Danger-Swift/Sources/WeTransferPRLinter/SwiftLintExecutor.swift
+199 −0 Danger-Swift/Sources/WeTransferPRLinter/WeTransferPRLinter.swift
+59 −0 Danger-Swift/Sources/WeTransferPRLinter/XcodeSummaryReporter.swift
+33 −0 Danger-Swift/Tests/WeTransferPRLinterTests/TestHelpers/DangerTestExtensions.swift
+36 −0 Danger-Swift/Tests/WeTransferPRLinterTests/TestHelpers/Mocks.swift
+2,131 −0 Danger-Swift/Tests/WeTransferPRLinterTests/TestHelpers/TestGithubDSL.swift
+51 −0 Danger-Swift/Tests/WeTransferPRLinterTests/TestHelpers/TestXcodeSummaryJSON.swift
+331 −0 Danger-Swift/Tests/WeTransferPRLinterTests/WeTransferLinterTests.swift
+9 −0 Danger-Swift/Tests/WeTransferPRLinterTests/XCTestManifests.swift
+0 −209 Danger/DangerTests.swift
+0 −89 Danger/Dangerfile
+0 −14 Danger/ext/.rubocop.yml
+0 −115 Danger/ext/git_swift_linter.rb
+0 −18 Dangerfile
+4 −0 Dangerfile.swift
+180 −11 Fastlane/Fastfile
+4 −8 Gemfile
+223 −0 Gemfile.lock
+19 −0 Package.swift
+101 −54 README.md
+0 −6 Scripts/travis.sh
+7 −11 SwiftLint/.swiftlint-source.yml
+4 −2 SwiftLint/.swiftlint-tests.yml
+11 −0 SwiftLint/swiftlint.sh
+0 −11 spec/.rubocop.yml
+0 −237 spec/git_swift_linter_spec.rb
+0 −37 spec/spec_helper.rb
2 changes: 1 addition & 1 deletion Submodules/ios-snapshot-test-case
Submodule ios-snapshot-test-case updated 58 files
+4 −1 .gitignore
+3 −3 .travis.yml
+32 −0 CHANGELOG.md
+27 −15 FBSnapshotTestCase.xcodeproj/project.pbxproj
+10 −16 FBSnapshotTestCase.xcodeproj/xcshareddata/xcschemes/FBSnapshotTestCase iOS.xcscheme
+10 −16 FBSnapshotTestCase.xcodeproj/xcshareddata/xcschemes/FBSnapshotTestCase tvOS.xcscheme
+8 −0 FBSnapshotTestCase.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+9 −1 FBSnapshotTestCase/Categories/UIImage+Compare.h
+73 −26 FBSnapshotTestCase/Categories/UIImage+Compare.m
+4 −4 FBSnapshotTestCase/Categories/UIImage+Snapshot.m
+111 −29 FBSnapshotTestCase/FBSnapshotTestCase.h
+77 −34 FBSnapshotTestCase/FBSnapshotTestCase.m
+15 −21 FBSnapshotTestCase/FBSnapshotTestCasePlatform.h
+13 −29 FBSnapshotTestCase/FBSnapshotTestCasePlatform.m
+42 −14 FBSnapshotTestCase/FBSnapshotTestController.h
+82 −29 FBSnapshotTestCase/FBSnapshotTestController.m
+17 −9 FBSnapshotTestCase/SwiftSupport.swift
+203 −31 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo.xcodeproj/project.pbxproj
+10 −14 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo.xcodeproj/xcshareddata/xcschemes/FBSnapshotTestCaseDemo.xcscheme
+111 −0 ...aseDemo/FBSnapshotTestCaseDemo.xcodeproj/xcshareddata/xcschemes/FBSnapshotTestCasePreprocessorDemo.xcscheme
+8 −0 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+10 −0 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+15 −0 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo/Images.xcassets/AppIcon.appiconset/Contents.json
+0 −36 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo/Images.xcassets/Brand Assets.launchimage/Contents.json
+0 −142 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo/Images.xcassets/LaunchImage.launchimage/Contents.json
+12 −11 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemo/Launch Screen.storyboard
+3 −10 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemoTests/FBSnapshotTestCaseDemoTests.m
+7 −6 FBSnapshotTestCaseDemo/FBSnapshotTestCaseDemoTests/FBSnapshotTestCaseSwiftTests.swift
+ ...ests/ReferenceImages_64/FBSnapshotTestCaseDemoTests/[email protected]
+ ...ests/ReferenceImages_64/FBSnapshotTestCaseDemoTests/[email protected]
+ ...hotTestCaseDemoTests/ReferenceImages_64/FBSnapshotTestCaseDemoTests/[email protected]
+ ...hotTestCaseDemoTests/ReferenceImages_64/FBSnapshotTestCaseDemoTests/[email protected]
+ ...aseDemoTests/ReferenceImages_64/FBSnapshotTestCaseDemoTests/[email protected]
+ ...aseDemoTests/ReferenceImages_64/FBSnapshotTestCaseDemoTests/[email protected]
+6 −2 FBSnapshotTestCaseDemo/Podfile
+7 −7 FBSnapshotTestCaseDemo/Podfile.lock
+87 −11 FBSnapshotTestCaseTests/FBSnapshotControllerTests.m
+ FBSnapshotTestCaseTests/rect_shade.png
+39 −39 README.md
+45 −4 build.sh
+10 −0 docs/HowToRelease.md
+4 −4 iOSSnapshotTestCase.podspec
+1 −0 iOSSnapshotTestCaseCarthageDemo/Cartfile
+1 −0 iOSSnapshotTestCaseCarthageDemo/Cartfile.resolved
+485 −0 iOSSnapshotTestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemo.xcodeproj/project.pbxproj
+7 −0 ...TestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+8 −0 ...ageDemo/iOSSnapshotTestCaseCarthageDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+8 −0 ...emo/iOSSnapshotTestCaseCarthageDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+109 −0 ...o/iOSSnapshotTestCaseCarthageDemo.xcodeproj/xcshareddata/xcschemes/iOSSnapshotTestCaseCarthageDemo.xcscheme
+56 −0 iOSSnapshotTestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemo/AppDelegate.swift
+98 −0 ...apshotTestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemo/Assets.xcassets/AppIcon.appiconset/Contents.json
+6 −0 iOSSnapshotTestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemo/Assets.xcassets/Contents.json
+25 −0 iOSSnapshotTestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemo/Base.lproj/LaunchScreen.storyboard
+43 −0 iOSSnapshotTestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemo/Info.plist
+22 −0 iOSSnapshotTestCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemoSwiftTests/Info.plist
+ ...s_64/iOSSnapshotTestCaseCarthageDemoSwiftTests.iOSSnapshotTestCaseCarthageDemoSwiftTests/[email protected]
+ ...s_64/iOSSnapshotTestCaseCarthageDemoSwiftTests.iOSSnapshotTestCaseCarthageDemoSwiftTests/[email protected]
+25 −0 ...tCaseCarthageDemo/iOSSnapshotTestCaseCarthageDemoSwiftTests/iOSSnapshotTestCaseCarthageDemoSwiftTests.swift
4 changes: 2 additions & 2 deletions WeScan.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -z \"$CI\" ]; then\nif which swiftlint >/dev/null; then\nswiftlint --config \"${SRCROOT}/Submodules/WeTransfer-iOS-CI/SwiftLint/.swiftlint-source.yml\"\nswiftlint --config \"${SRCROOT}/Submodules/WeTransfer-iOS-CI/SwiftLint/.swiftlint-tests.yml\"\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\nfi\n";
shellScript = "./Submodules/WeTransfer-iOS-CI/SwiftLint/swiftlint.sh\n";
};
503A25EC22FB045E00534850 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -826,7 +826,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -z \"$CI\" ]; then\nif which swiftlint >/dev/null; then\nswiftlint --config \"${SRCROOT}/Submodules/WeTransfer-iOS-CI/SwiftLint/.swiftlint-source.yml\"\nswiftlint --config \"${SRCROOT}/Submodules/WeTransfer-iOS-CI/SwiftLint/.swiftlint-tests.yml\"\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\nfi\n";
shellScript = "./Submodules/WeTransfer-iOS-CI/SwiftLint/swiftlint.sh\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion WeScan/Edit/EditScanViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class EditScanViewController: UIViewController {
return button
}()

lazy private var cancelButton: UIBarButtonItem = {
private lazy var cancelButton: UIBarButtonItem = {
let title = NSLocalizedString("wescan.edit.button.cancel", tableName: nil, bundle: Bundle(for: EditScanViewController.self), value: "Cancel", comment: "A generic cancel button")
let button = UIBarButtonItem(title: title, style: .plain, target: self, action: #selector(cancelButtonTapped))
button.tintColor = navigationController?.navigationBar.tintColor
Expand Down
18 changes: 9 additions & 9 deletions WeScan/Extensions/UIImage+Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
import Foundation

extension UIImage {
/// Creates a UIImage from the specified CIImage.
static func from(ciImage: CIImage) -> UIImage {
if let cgImage = CIContext(options: nil).createCGImage(ciImage, from: ciImage.extent) {
return UIImage(cgImage: cgImage)
} else {
return UIImage(ciImage: ciImage, scale: 1.0, orientation: .up)
}
}

/// Draws a new cropped and scaled (zoomed in) image.
///
/// - Parameters:
Expand Down Expand Up @@ -116,4 +107,13 @@ extension UIImage {

return pixelBuffer
}

/// Creates a UIImage from the specified CIImage.
static func from(ciImage: CIImage) -> UIImage {
if let cgImage = CIContext(options: nil).createCGImage(ciImage, from: ciImage.extent) {
return UIImage(cgImage: cgImage)
} else {
return UIImage(ciImage: ciImage, scale: 1.0, orientation: .up)
}
}
}
1 change: 0 additions & 1 deletion WeScan/ImageScannerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public final class ImageScannerController: UINavigationController {
// *** Vision *requires* a completion block to detect rectangles, but it's instant.
// *** When using Vision, we'll present the normal edit view controller first, then present the updated edit view controller later.


guard let ciImage = CIImage(image: image) else { return }
let orientation = CGImagePropertyOrientation(image.imageOrientation)
let orientedImage = ciImage.oriented(forExifOrientation: Int32(orientation.rawValue))
Expand Down
2 changes: 1 addition & 1 deletion WeScanTests/ArrayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class ArrayTests: XCTestCase {

rects1 = ImageFeatureTestHelpers.getRectangleFeatures(from: .rect1, withCount: 10)
rects2 = ImageFeatureTestHelpers.getRectangleFeatures(from: .rect2, withCount: 10)
var rects3 = ImageFeatureTestHelpers.getRectangleFeatures(from: .rect3, withCount: 10)
let rects3 = ImageFeatureTestHelpers.getRectangleFeatures(from: .rect3, withCount: 10)

rectangles = rects1 + rects2 + rects3

Expand Down
2 changes: 1 addition & 1 deletion WeScanTests/CIRectangleDetectorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class CIRectangleDetectorTests: FBSnapshotTestCase {
super.setUp()

recordMode = false
agnosticOptions = .OS
fileNameOptions = .OS
}

func testCorrectlyDetectsAndReturnsQuadilateral() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 8 additions & 33 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,12 @@
# More documentation about how to customize your build
# can be found here:
# https://docs.fastlane.tools
fastlane_version '1.109.0'
# Fastlane requirements
fastlane_version "1.109.0"

# This value helps us track success metrics for Fastfiles
# we automatically generate. Feel free to remove this line
# once you get things running smoothly!
generated_fastfile_id '0121e253-f9e2-40ac-b489-f17f36e24ec6'
import "./../Submodules/WeTransfer-iOS-CI/Fastlane/Fastfile"

import './../Submodules/WeTransfer-iOS-CI/Fastlane/Fastfile'

desc 'Clean the derived data, run tests validate the changes'
desc "Run the tests and prepare for Danger"
lane :test do |options|
clear_derived_data

# Set timeout to prevent xcodebuild -list -project to take to much retries.
ENV['FASTLANE_XCODE_LIST_TIMEOUT'] = '120'

begin
scan(
scheme: options[:project_name],
project: "#{options[:project_name]}.xcodeproj",
device: 'iPhone 7',
clean: true,
fail_build: false,
code_coverage: true,
formatter: 'xcpretty-json-formatter'
)
rescue => ex
UI.error("Tests failed: #{ex}")
end

trainer(output_directory: 'build/reports/', fail_build: false)

validate_changes(project_name: options[:project_name])
test_project(
project_name: "WeScan",
scheme: "WeScan",
device: "iPhone 8")
end
5 changes: 0 additions & 5 deletions fastlane/Pluginfile

This file was deleted.

0 comments on commit a8e9911

Please sign in to comment.