Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIS-363] Sample app improvements #549

Merged
merged 5 commits into from
Oct 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/beta.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Beta
name: Firebase Testing Build (v2)

on:
push:
67 changes: 43 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -125,12 +125,6 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache Carthage dependencies
uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-cache-${{ hashFiles('**/Cartfile.resolved') }}
- name: Cache RubyGems
uses: actions/cache@v2
id: rubygem-cache
@@ -141,8 +135,6 @@ jobs:
- name: Install RubyGems
if: steps.rubygem-cache.outputs.cache-hit != 'true'
run: bundle install
- name: Install Carthage dependencies
run: bundle exec fastlane carthage_bootstrap
- name: Run v3 Tests (Debug)
run: bundle exec fastlane test_v3
- name: Post Codecov report
@@ -153,12 +145,6 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache Carthage dependencies
uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-cache-${{ hashFiles('**/Cartfile.resolved') }}
- name: Cache RubyGems
uses: actions/cache@v2
id: rubygem-cache
@@ -169,8 +155,6 @@ jobs:
- name: Install RubyGems
if: steps.rubygem-cache.outputs.cache-hit != 'true'
run: bundle install
- name: Install Carthage dependencies
run: bundle exec fastlane carthage_bootstrap
- name: Run v3 Tests (Release)
run: bundle exec fastlane test_v3_release

@@ -179,12 +163,6 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache Carthage dependencies
uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-cache-${{ hashFiles('**/Cartfile.resolved') }}
- name: Cache RubyGems
uses: actions/cache@v2
id: rubygem-cache
@@ -195,8 +173,6 @@ jobs:
- name: Install RubyGems
if: steps.rubygem-cache.outputs.cache-hit != 'true'
run: bundle install
- name: Install Carthage dependencies
run: bundle exec fastlane carthage_bootstrap
- name: Prepare iOS 12 simulator
run: |
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
@@ -206,3 +182,46 @@ jobs:
xcrun simctl list devices 12.4
- name: Run v3 Tests (Debug - iOS 12.4)
run: bundle exec fastlane test_v3 device:"iPhone 7 (12.4)"

build-sample-v3:
name: Build v3 Sample
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache RubyGems
uses: actions/cache@v2
id: rubygem-cache
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-
- name: Install RubyGems
if: steps.rubygem-cache.outputs.cache-hit != 'true'
run: bundle install
- name: Build v3 Sample
run: bundle exec fastlane build_sample_v3

build-sample-v3-ios12:
name: Build v3 Sample (iOS12.4)
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache RubyGems
uses: actions/cache@v2
id: rubygem-cache
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-
- name: Install RubyGems
if: steps.rubygem-cache.outputs.cache-hit != 'true'
run: bundle install
- name: Prepare iOS 12 simulator
run: |
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 12.4.simruntime
xcrun simctl list runtimes
xcrun simctl create custom-test-device "iPhone 7" "com.apple.CoreSimulator.SimRuntime.iOS-12-4"
xcrun simctl list devices 12.4
- name: Build v3 Sample
run: bundle exec fastlane build_sample_v3 device:"iPhone 7 (12.4)"
26 changes: 1 addition & 25 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Stres Tests (v3)
name: Stress Tests (v3)

on:
schedule:
@@ -10,12 +10,6 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache Carthage dependencies
uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-cache-${{ hashFiles('**/Cartfile.resolved') }}
- name: Cache RubyGems
uses: actions/cache@v1
id: rubygem-cache
@@ -26,8 +20,6 @@ jobs:
- name: Install RubyGems
if: steps.rubygem-cache.outputs.cache-hit != 'true'
run: bundle install
- name: Install Carthage dependencies
run: bundle exec fastlane carthage_bootstrap
- name: Run Stress Tests
run: bundle exec fastlane stress_test_v3

@@ -36,12 +28,6 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache Carthage dependencies
uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-cache-${{ hashFiles('**/Cartfile.resolved') }}
- name: Cache RubyGems
uses: actions/cache@v1
id: rubygem-cache
@@ -52,8 +38,6 @@ jobs:
- name: Install RubyGems
if: steps.rubygem-cache.outputs.cache-hit != 'true'
run: bundle install
- name: Install Carthage dependencies
run: bundle exec fastlane carthage_bootstrap
- name: Run Stress Tests
run: bundle exec fastlane stress_test_v3_release

@@ -62,12 +46,6 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Cache Carthage dependencies
uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-cache-${{ hashFiles('**/Cartfile.resolved') }}
- name: Cache RubyGems
uses: actions/cache@v2
id: rubygem-cache
@@ -80,8 +58,6 @@ jobs:
run: bundle install
- name: Install iOS11.4 runtime
run: bundle exec xcversion simulators --install='iOS 11.4'
- name: Install Carthage dependencies
run: bundle exec fastlane carthage_bootstrap
- name: Run v3 Tests (Debug - iOS 11.4)
run: bundle exec fastlane test_v3 device:"iPhone 7 (11.4)"
- name: Post Codecov report
2 changes: 1 addition & 1 deletion .github/workflows/test-old-ios-versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test-Old-iOS-Versions
name: Test Old iOS Versions (v2)

on:
schedule:
2 changes: 2 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@

--exclude **/*_Vendor.swift

--ifdef no-indent

# Rules inferred from Swift Standard Library:
--disable anyObjectProtocol, wrapMultilineStatementBraces
--indent 4
12 changes: 12 additions & 0 deletions Sample_v3/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -211,6 +211,9 @@
<rect key="frame" x="118" y="4" width="276" height="34.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="didEndEditing:" destination="cRN-bf-0sE" eventType="primaryActionTriggered" id="tfw-AB-pId"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="API Key" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O9V-S5-Tu3">
<rect key="frame" x="52" y="11" width="58" height="21.5"/>
@@ -241,6 +244,9 @@
<rect key="frame" x="118" y="4" width="276" height="34.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="didEndEditing:" destination="cRN-bf-0sE" eventType="primaryActionTriggered" id="FWT-kP-eat"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="User Id" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g4c-z5-52n">
<rect key="frame" x="55" y="11" width="55" height="21.5"/>
@@ -271,6 +277,9 @@
<rect key="frame" x="118" y="4" width="276" height="34.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="didEndEditing:" destination="cRN-bf-0sE" eventType="primaryActionTriggered" id="XFn-C8-qjQ"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="User Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MD7-e5-EhG">
<rect key="frame" x="24" y="11" width="86" height="21.5"/>
@@ -324,6 +333,9 @@
<rect key="frame" x="118" y="4" width="276" height="34.5"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="didEndEditing:" destination="cRN-bf-0sE" eventType="primaryActionTriggered" id="kZP-GC-ZqG"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="JWT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c6J-OZ-Csy">
<rect key="frame" x="74.5" y="11" width="35.5" height="21.5"/>
33 changes: 29 additions & 4 deletions Sample_v3/Configuration.swift
Original file line number Diff line number Diff line change
@@ -18,15 +18,40 @@ struct Configuration {

struct DefaultValues {
static let apiKey = "qk4nn7rpcn75"
static let userId = "broken-waterfall-5"
static let userName = "Broken Waterfall"
static let userId = TestUser.defaults[0].id
static let userName = TestUser.defaults[0].name
static let token = TestUser.defaults[0].token
static let baseURL = BaseURL.usEast
static let token =
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYnJva2VuLXdhdGVyZmFsbC01In0.d1xKTlD_D0G-VsBoDBNbaLjO-2XWNA8rlTm4ru4sMHg"
static let isLocalStorageEnabled = true
static let shouldFlushLocalStorageOnStart = false
}

struct TestUser {
let name: String
let id: String
let token: String

static var defaults: [Self] {
[
TestUser(
name: "Broken Waterfall",
id: "broken-waterfall-5",
token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYnJva2VuLXdhdGVyZmFsbC01In0.d1xKTlD_D0G-VsBoDBNbaLjO-2XWNA8rlTm4ru4sMHg"
),
TestUser(
name: "Suspicious Coyote",
id: "suspicious-coyote-3",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic3VzcGljaW91cy1jb3lvdGUtMyJ9.xVaBHFTexlYPEymPmlgIYCM5M_iQVHrygaGS1QhkaEE"
),
TestUser(
name: "Steep Moon",
id: "steep-moon-9",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic3RlZXAtbW9vbi05In0.xwGjOwnTy3r4o2owevNTyzZLWMsMh_bK7e5s1OQ2zXU"
)
]
}
}

static var apiKey: String {
get { UserDefaults.standard.string(forKey: PersistenceKeys.apiKey) ?? DefaultValues.apiKey }
set { UserDefaults.standard.setValue(newValue, forKey: PersistenceKeys.apiKey) }
Loading