Skip to content

Commit

Permalink
feat(#173): Implement danger and improve PR pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: Ryne Cheow <[email protected]>
  • Loading branch information
rynecheow committed May 24, 2020
1 parent ab25f8f commit e1d8ff8
Show file tree
Hide file tree
Showing 629 changed files with 1,596 additions and 61,850 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/swift.yml → .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Build pipeline
name: Lint, build and test

on:
push:
branches:
- 'feature/**'
pull_request:
branches: [master]

Expand All @@ -17,12 +14,13 @@ jobs:
- name: Resolve dependencies
run: |
brew bundle
bundle
# - name: Danger
# run: |
# danger-swift ci
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Danger
run: |
bundle exec danger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Restore SPM Cache
uses: actions/cache@v1
Expand Down Expand Up @@ -53,14 +51,21 @@ jobs:
run: |
carthage update --cache-builds --new-resolver --configuration Debug
- name: Testing "RxAlamofire iOS" on Swift 5.1
- name: Testing RxAlamofire iOS framework
run: |
xcodebuild test -scheme 'RxAlamofire iOS' -project 'RxAlamofire.xcodeproj' -sdk iphonesimulator -destination "platform=iOS simulator,name=iPhone 11"
- name: Testing RxAlamofire tvOS framework
run: |
xcodebuild test SWIFT_VERSION=5.1 -scheme 'RxAlamofire iOS' -project 'RxAlamofire.xcodeproj' -sdk iphonesimulator -destination "platform=iOS simulator,name=iPhone 11"
xcodebuild test -scheme 'RxAlamofire tvOS' -project 'RxAlamofire.xcodeproj' -destination "platform=tvOS simulator,name=Apple TV 4K"
- name: Testing "RxAlamofire tvOS" on Swift 5.1
- name: Testing RxAlamofire macOS framework
run: |
xcodebuild test SWIFT_VERSION=5.1 -scheme 'RxAlamofire tvOS' -project 'RxAlamofire.xcodeproj' -destination "platform=tvOS simulator,name=Apple TV 4K"
xcodebuild test -scheme 'RxAlamofire macOS' -project 'RxAlamofire.xcodeproj'
- name: Testing "RxAlamofire macOS" on Swift 5.1
- name: Build Cocoapods iOS Demo
run: |
xcodebuild test SWIFT_VERSION=5.1 -scheme 'RxAlamofire macOS' -project 'RxAlamofire.xcodeproj'
cd Examples
xcodegen
pod install --repo-update
xcodebuild build -scheme 'RxAlamofireDemo-iOS' -workspace 'RxAlamofireDemo.xcworkspace' -sdk iphonesimulator -destination "platform=iOS simulator,name=iPhone 11"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ xcuserdata
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
Pods/

# Carthage
#
Expand Down
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ opt_in_rules: # some rules are only opt-in
included:
- Sources
- Tests
- Examples/RxAlamofireDemo-iOS
- Examples/RxAlamofireDemo-tvOS

# excluded: # paths to ignore during linting. Takes precedence over `included`.

Expand Down
Empty file added .versionrc
Empty file.
2 changes: 0 additions & 2 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
tap "danger/tap"
brew "danger/tap/danger-swift"
brew "xcodegen"
40 changes: 40 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = (github.pr_title + github.pr_body).include?("#trivial")

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn summary on pull request
if github.pr_body.length < 5
warn "Please provide a summary in the Pull Request description"
end

# If these are all empty something has gone wrong, better to raise it in a comment
if git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty?
fail "This PR has no changes at all, this is likely a developer issue."
end

# Warn when there is a big PR
message("Big PR") if git.lines_of_code > 500
warn("Huge PR") if git.lines_of_code > 1000
fail("Enormous PR. Please split this pull request.") if git.lines_of_code > 3000

# Warn Cartfile changes
message("Cartfile changed") if git.modified_files.include?("Cartfile")
message("Cartfile.resolved changed") if git.modified_files.include?("Cartfile.resolved")

# Lint
swiftlint.lint_all_files = true
swiftlint.max_num_violations = 20
swiftlint.config_file = ".swiftlint.yml"
swiftlint.lint_files fail_on_error: true

# xcov.report(
# scheme: "RxAlamofire iOS",
# project: "RxAlamofire.xcodeproj",
# include_targets: "RxAlamofire.framework",
# minimum_coverage_percentage: 20.0,
# derived_data_path: "Build/",
# )

45 changes: 0 additions & 45 deletions Dangerfile.swift

This file was deleted.

28 changes: 28 additions & 0 deletions Examples/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
source "https://cdn.cocoapods.org/"
project "RxAlamofireDemo.xcodeproj"
use_frameworks!

def common
pod "RxAlamofire/RxCocoa", :path => "../"
end

def common_tests
pod "OHHTTPStubs", "~> 9.0"
pod "OHHTTPStubs/Swift", "~> 9.0"
pod "RxBlocking", "~> 5.1"
end

target "RxAlamofireDemo-iOS" do
platform :ios, "10.0"
common
end

# target "RxAlamofireDemo-macOS" do
# platform :osx, "10.12"
# common
# end

target "RxAlamofireDemo-tvOS" do
platform :tvos, "10.0"
common
end
39 changes: 39 additions & 0 deletions Examples/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
PODS:
- Alamofire (5.2.0)
- RxAlamofire/Core (5.3.0):
- Alamofire (~> 5.1)
- RxSwift (~> 5.1)
- RxAlamofire/RxCocoa (5.3.0):
- RxAlamofire/Core
- RxCocoa (~> 5.1)
- RxCocoa (5.1.1):
- RxRelay (~> 5)
- RxSwift (~> 5)
- RxRelay (5.1.1):
- RxSwift (~> 5)
- RxSwift (5.1.1)

DEPENDENCIES:
- RxAlamofire/RxCocoa (from `../`)

SPEC REPOS:
trunk:
- Alamofire
- RxCocoa
- RxRelay
- RxSwift

EXTERNAL SOURCES:
RxAlamofire:
:path: "../"

SPEC CHECKSUMS:
Alamofire: c1ca147559e730bfb2182c8c7aafbdd90a867987
RxAlamofire: 739785bc0e47ce5f72eefbbb03e065790d753f92
RxCocoa: 32065309a38d29b5b0db858819b5bf9ef038b601
RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9
RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178

PODFILE CHECKSUM: 87577e46619859a5ff08dd18af527a2f96b51859

COCOAPODS: 1.9.2
42 changes: 42 additions & 0 deletions Examples/RxAlamofireDemo-iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for
// certain types of temporary interruptions (such as an incoming phone call or SMS message) or when
// the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame
// rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough
// application state information to restore your application to its current state in case it is
// terminated later.
// If your application supports background execution, this method is called instead of
// applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can
// undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive.
// If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate.
// See also applicationDidEnterBackground:.
}
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8173.3" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8142"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RxAlamofire" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gYm-Ht-LmS">
<rect key="frame" x="254" y="289" width="92" height="21"/>
<rect key="frame" x="161" y="437.5" width="92" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="gYm-Ht-LmS" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="9DZ-Ms-all"/>
<constraint firstItem="gYm-Ht-LmS" firstAttribute="centerX" secondItem="tS1-q1-vRe" secondAttribute="centerX" id="9DZ-Ms-all"/>
<constraint firstItem="gYm-Ht-LmS" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="FFB-rd-bch"/>
</constraints>
<viewLayoutGuide key="safeArea" id="tS1-q1-vRe"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="51" y="76"/>
</scene>
</scenes>
</document>
Loading

0 comments on commit e1d8ff8

Please sign in to comment.