Skip to content

Commit

Permalink
Merge pull request #17 from grmeyer-hw-dev/feature/DTSERWONE-821_addr…
Browse files Browse the repository at this point in the history
…ess_swiflint_issues_v0_50

DTSERWONE-821 - Address swift lint issue
  • Loading branch information
grmeyer-hw-dev authored Mar 29, 2023
2 parents fd67a51 + e5b298b commit 8d3f5d5
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 77 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: iOS Insight

on:
workflow_dispatch:
push:
branches:
- master
- support/SDK-V3
- feature/**
- bugfix/**

jobs:
test:
name: Test - ${{ matrix.os }} - ${{ matrix.xcode_version }} - ${{ matrix.fastlane_task }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-12
xcode_version: 14.2
fastlane_task: unit_tests

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '${{ matrix.xcode_version }}'

- name: Carthage [Setup cache]
uses: actions/cache@v3
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
restore-keys: |
${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
- name: Carthage [Install dependencies]
run: carthage bootstrap
--platform ios
--cache-builds
--use-xcframeworks
--no-use-binaries

- name: Run ${{ matrix.task_title }}
run: fastlane ${{ matrix.fastlane_task }}

- name: Lint validation
run:
swiftlint lint --strict --reporter json

- name: Code Coverage [Build report]
run: |
brew install llvm
export PATH="$(brew --prefix llvm)/bin:$PATH"
llvm-cov report \
--use-color \
--instr-profile=$(find ./output -name "*.profdata") \
--object $(find ./output -name "Insights")
- name: Code Coverage [Export report to lcov format]
run: |
export PATH="$(brew --prefix llvm)/bin:$PATH"
mkdir coverage
llvm-cov export \
--format=lcov > ./coverage/lcov.info \
--instr-profile=$(find ./output -name "*.profdata") \
--object $(find ./output -name "Insights")
- name: Post to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Update Documentation

on:
workflow_dispatch:
push:
branches:
- master

jobs:
documentation:
name: Documentation
strategy:
matrix:
include:
- os: macos-12
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Generate documentation
run: |
jazzy \
--min-acl public \
--no-hide-documentation-coverage \
--theme fullwidth \
--title HyperwalletSDK \
--module HyperwalletSDK \
--output ./docs \
--documentation=./*.md
- name: Publish on GitHub Pages
uses: ftnext/[email protected]
with:
build_dir: docs
github_token: ${{ secrets.GITHUB_TOKEN }}
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

26 changes: 3 additions & 23 deletions Insights.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -24,6 +24,7 @@
4ADE281323671B35000F0BEB /* Insights.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADE281223671B35000F0BEB /* Insights.swift */; };
9865B6B92375D81E00ED1EA1 /* SuccessResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 9865B6B82375D81E00ED1EA1 /* SuccessResponse.json */; };
B3102892236C9CF2008C9757 /* HttpClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3102891236C9CF2008C9757 /* HttpClient.swift */; };
DBB5EEEA29D37E7F002A0A70 /* Hippolyte.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11B7FF92282B47EF005522A7 /* Hippolyte.xcframework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -71,6 +72,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
DBB5EEEA29D37E7F002A0A70 /* Hippolyte.xcframework in Frameworks */,
2EB32DEA23579E47009F120E /* Insights.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -190,7 +192,6 @@
2EB32D6623513979009F120E /* Sources */,
2EB32D6723513979009F120E /* Frameworks */,
2EB32D6823513979009F120E /* Resources */,
4A72C78C2369BC8500FC7A7E /* SwiftLint */,
);
buildRules = (
);
Expand Down Expand Up @@ -275,27 +276,6 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4A72C78C2369BC8500FC7A7E /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = SwiftLint;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nset -x\nif [ -z \"$CI\" ]; then\n if ! which swiftlint > /dev/null; then\n echo \"warning: SwiftLint is not installed. To install run `brew install SwiftLint`\"\n else\n swiftlint autocorrect\n swiftlint\n fi\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
2EB32D6623513979009F120E /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
12 changes: 6 additions & 6 deletions Tests/InsightsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class InsightsTests: XCTestCase {
pageGroup: pageGroup,
link: link,
params: [:])
sleep(2)
sleep(10)

let events = EventManager.shared.loadEvents(before: Date().epochMilliseconds())
XCTAssertEqual(events.count, 1, "There should be 1 record in database")
Expand All @@ -67,7 +67,7 @@ final class InsightsTests: XCTestCase {
params: [:])
}

sleep(2)
sleep(10)

let events = EventManager.shared.loadEvents(before: Date().epochMilliseconds())
XCTAssertEqual(events.count, 2, "There should be 2 Impression events in the storage")
Expand All @@ -90,7 +90,7 @@ final class InsightsTests: XCTestCase {
errorInfo: errorInfo)
}

sleep(2)
sleep(10)

let events = EventManager.shared.loadEvents(before: Date().epochMilliseconds())
XCTAssertEqual(events.count, 3, "There should be 3 Error events in the storage")
Expand All @@ -107,7 +107,7 @@ final class InsightsTests: XCTestCase {
link: "test_link",
params: [:])
}
sleep(2)
sleep(10)

let countAfterSave = EventManager.shared.getEventsCount()
XCTAssertEqual(countAfterSave, 5, "There should be 5 Click events in the storage")
Expand All @@ -127,11 +127,11 @@ final class InsightsTests: XCTestCase {
params: [:])
if eventNumber == 10 {
// wait 1 second to separate other events (createdOn)
sleep(1)
sleep(10)
}
}

sleep(2)
sleep(10)

let countAfterSave = EventManager.shared.getEventsCount()
XCTAssertEqual(countAfterSave, 15, "There should be 15 Click events in the storage")
Expand Down
12 changes: 12 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ lane :beta do
update("beta", version)
end

lane :unit_tests do
run_tests(
project: "Insights.xcodeproj",
devices: ['iPhone 14 Pro'],
derived_data_path: './output',
scheme: "Insights",
configuration: 'Debug',
code_coverage: true,
xcargs: 'ONLY_ACTIVE_ARCH=YES ENABLE_TESTABILITY=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO'
)
end

lane :release_beta do
version = updateVersion("beta")
commit = last_git_commit
Expand Down

0 comments on commit 8d3f5d5

Please sign in to comment.