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

feat: identify customer #27

Merged
merged 5 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
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
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ jobs:
strategy:
matrix:
# 12.4 = swift 5.3
# 12.5 = swift 5.4 (not available because macos-11 is private preview, only on github)
# 12.5 = swift 5.4
# 13.0 = swift 5.5
# Thanks: https://swiftly.dev/swift-versions and https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md#xcode
xcode: ["12.4"]
runs-on: macos-10.15
xcode: ["12.4", "12.5", "13.0"]
runs-on: macos-11
name: XCode macOS tests (xcode ${{ matrix.xcode }})
# skip if '[skip ci]' exists in commit message
if: ${{ !contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[skip ci]') }}
Expand All @@ -22,12 +23,15 @@ jobs:
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
# If running tests fails, sometimes it's because of scheme name is wrong. This gives us all available schemes.
- name: Get XCode schemes (xcode ${{ matrix.xcode }})
run: xcrun xcodebuild -list

# run command made with help from `fastlane scan`. Running `scan` will output the command that it uses to run tests that you can use for help constructing test command.
# `-scheme` name found by running: `xcrun xcodebuild -list`
# `-scheme` name found by running: `xcrun xcodebuild -list` (or, see output of workflow run)
# `-destination` chosen to be a simulator that *all* xcode versions include. Help: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md#installed-simulators
- name: Run tests (xcode ${{ matrix.xcode }})
run: xcrun xcodebuild -scheme Customer.io -destination 'platform=iOS Simulator,name=iPhone 8' build test | xcpretty --report html --output 'test-report.html' --report junit --output 'test-report.xml'
run: xcrun xcodebuild -scheme Customer.io-Package -destination 'platform=iOS Simulator,name=iPhone 8' build test | xcpretty --report html --output 'test-report.html' --report junit --output 'test-report.xml'

- name: Upload test report
uses: actions/upload-artifact@v2
Expand Down
3 changes: 3 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
--commas inline
--header strip

# makes swiftlint happy. 120 matches what swiftlint is configured for
--maxwidth 120

--disable unusedArguments

--enable isEmpty
5 changes: 2 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ opt_in_rules: # some rules are only opt-in
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
- Sources
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Sources/SDK/autogenerated
excluded: # paths to ignore during linting. Takes precedence over `included`.
# - Source/ExcludedFolder
# - Source/ExcludedFile.swift
reporter: "emoji" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging)
reporter: "emoji" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging)
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
SHELL = /bin/sh

# --args:
# diAccessLevel - access level of the dependency injection graph. If module is used by another module (like Cio) then you want `public`. Else, `internal`.
# moduleName - the name of the module that you are generating code for.
# imports - Import statements to be at the top of the generated files in case the file needs classes from other modules. Split by `:` (example: `imports=Cio-Foo-Bar`)
generate:
sourcery --sources Sources/SDK --templates Sources/Templates --output Sources/SDK/autogenerated
sourcery --sources Sources/Tracking --templates Sources/Templates --output Sources/Tracking/autogenerated --args diAccessLevel=public,moduleName=Tracking

lint:
swiftlint lint --strict
Expand All @@ -10,3 +14,9 @@ lint:
# use the min Swift version that we support/test against.
format:
swiftformat . --swiftversion 5.3 && swiftlint lint --fix

# Check what code has not yet had documentation written for it.
# Jazzy is a great tool that generates docs, yes, but also tells you what public facing code is missing docs.
# This command will simply show you the output of the undocumented code of jazzy. It's not the most human-readable but it will do for now.
check-undocumented:
jazzy --module CioTracking --swift-build-tool spm --output /tmp/CIO-SDK-jazzy > /dev/null 2>&1 && cat /tmp/CIO-SDK-jazzy/undocumented.json
38 changes: 31 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,39 @@ let package = Package(
platforms: [
.iOS(.v9)
],
products: [
.library(name: "CIO", targets: ["CIO"])
products: [ // externally visible products for clients to install.
// library name is the name given when installing the SDK.
// target name is the name used for `import X`
.library(name: "Tracking", targets: ["CioTracking"]),
.library(name: "MessagingPushAPN", targets: ["CioMessagingPushAPN"]),
],
dependencies: [],
targets: [
.target(name: "CIO",
path: "Sources/SDK"),
.testTarget(name: "SDKTests",
dependencies: ["CIO"],
path: "Tests/SDK")
// Tracking
.target(name: "CioTracking",
path: "Sources/Tracking"),
.testTarget(name: "TrackingTests",
dependencies: ["CioTracking", "SharedTests"],
path: "Tests/Tracking"),

// shared code dependency that other test targets use.
.target(name: "SharedTests",
dependencies: ["CioTracking"],
path: "Tests/Shared"),

// Messaging Push
.target(name: "CioMessagingPush",
dependencies: ["CioTracking"],
path: "Sources/MessagingPush"),
.testTarget(name: "MessagingPushTests",
dependencies: ["CioMessagingPush", "SharedTests"],
path: "Tests/MessagingPush"),

.target(name: "CioMessagingPushAPN",
dependencies: ["CioMessagingPush"],
path: "Sources/MessagingPushAPN"),
.testTarget(name: "MessagingPushAPNTests",
dependencies: ["CioMessagingPushAPN", "SharedTests"],
path: "Tests/MessagingPushAPN"),
]
)
5 changes: 5 additions & 0 deletions Sources/MessagingPush/Placeholder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
Swift code goes into this module that are common to *all* of the Messaging Push modules (APN, FCM, etc).
So, performing an HTTP request to the API with a device token goes here.
*/
class Placeholder {}
4 changes: 4 additions & 0 deletions Sources/MessagingPushAPN/Placeholder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
Swift code goes into this module that is specific to APN push notification messaging.
*/
class Placeholder {}
16 changes: 0 additions & 16 deletions Sources/SDK/Example.swift

This file was deleted.

10 changes: 0 additions & 10 deletions Sources/SDK/ExampleRepository.swift

This file was deleted.

16 changes: 0 additions & 16 deletions Sources/SDK/ExampleViewModel.swift

This file was deleted.

113 changes: 0 additions & 113 deletions Sources/SDK/autogenerated/AutoDependencyInjection.generated.swift

This file was deleted.

Loading