Skip to content

Commit

Permalink
Merge pull request #38 from adobe/dev
Browse files Browse the repository at this point in the history
Dev -> Main [AEPMedia v3.0.0 Release]
  • Loading branch information
addb authored May 4, 2021
2 parents a3cdd22 + b487aff commit 8d72639
Show file tree
Hide file tree
Showing 103 changed files with 17,010 additions and 195 deletions.
25 changes: 20 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ workflows:
jobs:
- build-and-test
orbs:
slack: circleci/slack@4.0.2
slack: circleci/slack@4.2.0

jobs:

build-and-test:
macos:
xcode: 11.1.0 # Specify the Xcode version to use
xcode: 11.2.1 # Specify the Xcode version to use

steps:
- checkout
Expand All @@ -27,11 +27,15 @@ jobs:
- cocoapods-cache-v4-{{ arch }}-{{ .Branch }}-{{ checksum "Podfile.lock" }}
- cocoapods-cache-v4-{{ arch }}-{{ .Branch }}
- cocoapods-cache-v4
- 1-gems-{{ checksum "Gemfile.lock" }}

# install Gemfile
- run: bundle check || bundle install --path vendor/bundle --clean

# install CocoaPods - using default CocoaPods version, not the bundle
- run:
name: Repo Update & Install CocoaPods
command: make pod-install
command: make bundle-exec-pod-install

# save pods related files
- save_cache:
Expand All @@ -40,7 +44,7 @@ jobs:
paths:
- ./Pods
- ~/.cocoapods

- vendor/bundle
- run:
name: Install SwiftLint
command: make install-swiftlint
Expand All @@ -61,7 +65,18 @@ jobs:
# code coverage
- run:
name: Upload Code Coverage Report
command: bash <(curl -s https://codecov.io/bash) -v -X s3 -c -D "./build/out" -J "AEPMedia" -t ${CODECOV_TOKEN}
command: |
curl -s https://codecov.io/bash > codecov;
VERSION=$(grep 'VERSION=\".*\"' codecov | cut -d'"' -f2);
SHAVERSION=$(shasum -v);
echo "Using CodeCov version '$VERSION'"
echo "Using shasum '$SHAVERSION'"
for i in 1 256 512
do
shasum -a $i -c --ignore-missing <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM") ||
shasum -a $i -c <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM" | head -n 1)
done
bash ./codecov -v -X s3 -c -D "./build/out" -J "AEPMedia"
# verify XCFramework archive builds
- run:
Expand Down
4 changes: 4 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
template: |
## What’s Changed
$CHANGES
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release


on:
workflow_dispatch:
inputs:
tag:
description: 'tag/version'
required: true
default: '3.0.0'

action_tag:
description: 'create tag ("no" to skip)'
required: true
default: 'yes'

release_AEPMedia:
description: 'release AEPMedia ("no" to skip)'
required: true
default: 'yes'

jobs:
release_media:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
ref: main

- name: Install jq
run: brew install jq

- name: Install cocoapods
run: gem install cocoapods

- name: Check version in Podspec
run: |
set -eo pipefail
echo Target version: ${{ github.event.inputs.tag }}
make check-version VERSION=${{ github.event.inputs.tag }}
- name: Pod repo update
run: |
pod repo update
- name: SPM integration test
if: ${{ github.event.inputs.action_tag == 'yes' }}
run: |
set -eo pipefail
echo SPM integration test starts:
make test-SPM-integration
- name: podspec file verification
if: ${{ github.event.inputs.action_tag == 'yes' }}
run: |
set -eo pipefail
echo podspec file verification starts:
make test-podspec
- uses: release-drafter/release-drafter@v5
if: ${{ github.event.inputs.action_tag == 'yes' }}
with:
name: v${{ github.event.inputs.tag }}
tag: ${{ github.event.inputs.tag }}
version: ${{ github.event.inputs.tag }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Pods - AEPMedia
if: ${{ github.event.inputs.release_AEPMedia == 'yes' }}
run: |
set -eo pipefail
pod trunk push AEPMedia.podspec --allow-warnings --synchronous --swift-version=5.1
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}


2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ playground.xcworkspace
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
.swiftpm

build/out/
.build/

# CocoaPods
Expand Down
7 changes: 5 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
excluded: # paths to ignore during linting. Takes precedence over `included`.
- AEPMedia/Tests
excluded: # paths to ignore during linting. Takes precedence over `included`.
- .build
- Pods/

line_length: 1000

function_body_length: 100

type_body_length: 500

disabled_rules: # rule identifiers to exclude from running
- identifier_name
- force_cast
Expand Down
15 changes: 7 additions & 8 deletions AEPMedia.podspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Pod::Spec.new do |s|
s.name = "AEPAudience"
s.version = "0.0.1"
s.summary = "AEPAudience"
s.name = "AEPMedia"
s.version = "3.0.0"
s.summary = "Media library for Adobe Experience Platform SDK. Written and maintained by Adobe."
s.description = <<-DESC
AEPCore
The Media library provides APIs that allow use of the Media Analytics product in the Adobe Experience Platform SDK.
DESC
s.homepage = "https://github.com/adobe/aepsdk-audience-ios"
s.homepage = "https://github.com/adobe/aepsdk-media-ios"
s.license = 'Apache V2'
s.author = "Adobe Experience Platform SDK Team"
s.source = { :git => "https://github.com/adobe/aepsdk-audience-ios", :tag => s.version.to_s }
s.source = { :git => "https://github.com/adobe/aepsdk-media-ios", :tag => s.version.to_s }

s.ios.deployment_target = '10.0'

Expand All @@ -17,9 +17,8 @@ AEPCore
s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }

s.dependency 'AEPCore'
s.dependency 'AEPServices'

s.source_files = 'AEPAudience/Sources/*.swift'
s.source_files = 'AEPMedia/Sources/**/*.swift'


end
19 changes: 19 additions & 0 deletions AEPMedia/Sources/Double+Media.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

import Foundation

// Adds functionality to compare the equality of two doubles to within the specified delta.
extension Double {
func isAlmostEqual(_ doubleToCompare: Double, accuracy: Double = 0.000001) -> Bool {
return fabs(self - doubleToCompare) < accuracy
}
}
28 changes: 28 additions & 0 deletions AEPMedia/Sources/Event+Media.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

import Foundation
import AEPCore

extension Event {
/// Returns tracker id associated with Event
var trackerId: String? {
return data?[MediaConstants.Tracker.ID] as? String
}

/// Returns tracker config associated with EVENT_SOURCE_TRACKER_REQUEST Event
var trackerConfig: [String: Any]? {
guard source == MediaConstants.Media.EVENT_SOURCE_TRACKER_REQUEST else {
return nil
}
return data?[MediaConstants.Tracker.EVENT_PARAM] as? [String: Any]
}
}
Loading

0 comments on commit 8d72639

Please sign in to comment.