Skip to content

Commit

Permalink
Add code and tests for YAnalytics Firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Pospesel committed Feb 22, 2023
1 parent 62ba457 commit 1e2a62f
Show file tree
Hide file tree
Showing 18 changed files with 991 additions and 22 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/run_jazzy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This is a basic workflow to help you get started with Actions

name: Run Jazzy

# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the main branch
push:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "deploy_docs"
deploy_docs:
# The type of runner that the job will run on
runs-on: macos-12

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v1
- name: Publish Jazzy Docs
uses: steven0351/publish-jazzy-docs@v1
with:
personal_access_token: ${{ secrets.ACCESS_TOKEN }}
config: .jazzy.yaml
34 changes: 34 additions & 0 deletions .github/workflows/run_linter_and_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run linter and unit tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:

runs-on: macos-12

steps:
- uses: actions/checkout@v3

- name: Set Xcode version
run: |
ls -l /Applications | grep 'Xcode'
sudo xcode-select -s /Applications/Xcode_14.0.1.app
- name: Lint code using SwiftLint
run: swiftlint --strict --reporter github-actions-logging

- name: Build iOS
run: |
xcodebuild -scheme YAnalyticsFirebase -sdk iphonesimulator16.0 -destination 'platform=iOS Simulator,name=iPhone 14' build-for-testing
- name: Run tests iOS
run: |
xcodebuild -scheme YAnalyticsFirebase -sdk iphonesimulator16.0 -destination 'platform=iOS Simulator,name=iPhone 14' test-without-building
36 changes: 16 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
# Generated by MacOS
.DS_Store

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcuserstate
*.xcuserdatad
*.xcuserdata
xcschememanagement.plist
*/xcuserdata/*
*.xcbkptlist
*.xcworkspacedata
IDEWorkspaceChecks.plist

## Obj-C/Swift specific
*.hmap
Expand All @@ -39,7 +32,7 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
Expand All @@ -54,7 +47,7 @@ playground.xcworkspace
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
*/Pods/*
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
Expand Down Expand Up @@ -88,3 +81,6 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

## Docs
/docs
16 changes: 16 additions & 0 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
author: 'Y Media Labs'
author_url: https://yml.co
min_acl: public
hide_documentation_coverage: false
theme: fullwidth
output: ./docs
documentation: ./*.md
swift_build_tool: xcodebuild
module: YAnalyticsFirebase
xcodebuild_arguments:
- -scheme
- YAnalyticsFirebase
- -sdk
- iphonesimulator
- -destination
- 'platform=iOS Simulator,name=iPhone 13'
3 changes: 3 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: 1
external_links:
documentation: "https://yml-org.github.io/yanalytics-firebase-ios/"
43 changes: 43 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# By default, SwiftLint uses a set of sensible default rules you can adjust:
disabled_rules: # rule identifiers turned on by default to exclude from running

- multiple_closures_with_trailing_closure

opt_in_rules: # some rules are turned off by default, so you need to opt-in
- contains_over_first_not_nil
- empty_count
- first_where
- force_unwrapping
- implicit_return
- missing_docs
- multiline_arguments
- multiline_arguments_brackets
- multiline_function_chains
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- operator_whitespace
- prohibited_interface_builder
- unneeded_parentheses_in_closure_argument
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces

excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
- docs
- .build

# configurable rules can be customized from this configuration file
# binary rules can set their severity level

cyclomatic_complexity:
ignores_case_statements: true

identifier_name:
min_length: 1

trailing_whitespace:
ignores_empty_lines: true

function_parameter_count:
warning: 6
107 changes: 107 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/YAnalyticsFirebase.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "YAnalyticsFirebase_YAnalyticsFirebaseTests"
BuildableName = "YAnalyticsFirebase_YAnalyticsFirebaseTests"
BlueprintName = "YAnalyticsFirebase_YAnalyticsFirebaseTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "YAnalyticsFirebase"
BuildableName = "YAnalyticsFirebase"
BlueprintName = "YAnalyticsFirebase"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "YAnalyticsFirebaseTests"
BuildableName = "YAnalyticsFirebaseTests"
BlueprintName = "YAnalyticsFirebaseTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO"
testExecutionOrdering = "random">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "YAnalyticsFirebaseTests"
BuildableName = "YAnalyticsFirebaseTests"
BlueprintName = "YAnalyticsFirebaseTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "YAnalyticsFirebase_YAnalyticsFirebaseTests"
BuildableName = "YAnalyticsFirebase_YAnalyticsFirebaseTests"
BlueprintName = "YAnalyticsFirebase_YAnalyticsFirebaseTests"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
39 changes: 39 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Introduction ##

In layman's terms, provide a brief introduction to the issue. No more than 3 sentences.

## Purpose ##

Explain the purpose of this pull request. Include a link to the issue being addressed.

## Scope ##

Detail the scope of the pull request, i.e. what changed.

// Optional sections

## Discussion ##

Any discussion about approach, challenges, etc. that you feel is relevant.

## Out of Scope ##

Call out any known issues that are purposely not addressed in this pull request.

## 📱 Screenshots ##

For UI work, please include before/after screenshots hosted in a 2-column table for easy side-by-side comparison.

## 🎬 Video ##

Same as Screenshots above.

## 📈 Coverage ##

##### Code #####

Include a snapshot of the Code Coverage report generated when you ran the full unit test suite.

##### Documentation #####

Include a snapshot of the documentation coverage report when you ran jazzy locally to generate documentation. We require 100% documentation coverage of all `public` interfaces.
40 changes: 40 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// swift-tools-version: 5.7

import PackageDescription

let package = Package(
name: "YAnalyticsFirebase",
platforms: [
.iOS(.v14)
],
products: [
.library(
name: "YAnalyticsFirebase",
targets: ["YAnalyticsFirebase"]
)
],
dependencies: [
.package(
url: "https://github.com/yml-org/yanalytics-ios.git",
from: "1.1.0"
),
.package(
url: "https://github.com/firebase/firebase-ios-sdk.git",
.upToNextMajor(from: "10.4.0")
)
],
targets: [
.target(
name: "YAnalyticsFirebase",
dependencies: [
.product(name: "YAnalytics", package: "yanalytics-ios"),
.product(name: "FirebaseAnalytics", package: "firebase-ios-sdk")
]
),
.testTarget(
name: "YAnalyticsFirebaseTests",
dependencies: ["YAnalyticsFirebase"],
resources: [.process("Resources")]
)
]
)
Loading

0 comments on commit 1e2a62f

Please sign in to comment.