diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..148bfbae6 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,8 @@ +codecov: + branch: develop + +coverage: + precision: 1 + round: nearest + ignore: + - "XCDYouTubeKit Tests" diff --git a/.jazzy.yaml b/.jazzy.yaml index 540ec67f6..1be74c945 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -4,11 +4,11 @@ source_directory: XCDYouTubeKit framework_root: . umbrella_header: XCDYouTubeKit/XCDYouTubeKit.h module: XCDYouTubeKit -module_version: 2.5.2 +module_version: 2.5.4 author: Cédric Luthi author_url: https://twitter.com/0xced readme: README.md github_url: https://github.com/0xced/XCDYouTubeKit -github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.5.2/XCDYouTubeKit +github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.5.4/XCDYouTubeKit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 357bffeb3..000000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -osx_image: xcode7.3 -language: objective-c -env: - matrix: - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Code Coverage" SCHEME="XCDYouTubeKit iOS Static Library" OBJROOT="build"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.1" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.4" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.0" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.3" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.3" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" IPHONEOS_DEPLOYMENT_TARGET="9.3"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 4s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" RUN_CLANG_STATIC_ANALYZER="YES"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" RUN_CLANG_STATIC_ANALYZER="YES"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 4s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" RUN_CLANG_STATIC_ANALYZER="YES"' - - 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" RUN_CLANG_STATIC_ANALYZER="YES"' - - 'DESTINATION="platform=OS X" CONFIGURATION="Release" SCHEME="XCDYouTubeKit OS X" RUN_CLANG_STATIC_ANALYZER="YES"' - - 'DESTINATION="platform=OS X" CONFIGURATION="Release" SCHEME="XCDYouTubeKit OS X" MACOSX_DEPLOYMENT_TARGET="10.11"' - - 'DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p" CONFIGURATION="Release" SCHEME="XCDYouTubeKit tvOS" RUN_CLANG_STATIC_ANALYZER="YES"' -install: - - gem install xcpretty-travis-formatter --no-rdoc --no-ri --no-document --quiet - - sudo easy_install cpp-coveralls - - sudo easy_install codecov -script: - - open -b com.apple.iphonesimulator # Workaround https://github.com/travis-ci/travis-ci/issues/3040 - - ./Scripts/run-tests.sh -after_success: - - '[ "$CONFIGURATION" == "Code Coverage" ] && coveralls --include XCDYouTubeKit' - - '[ "$CONFIGURATION" == "Code Coverage" ] && codecov --gcov-glob "*XCDYouTubeKit iOS Tests*"' -after_failure: - - cat xcodebuild.log - - cat $TMPDIR/com.apple.dt.XCTest-status/Session*.log - - cat ~/Library/Logs/DiagnosticReports/xctest*.crash - - sleep 5 diff --git a/CHANGELOG.md b/CHANGELOG.md index ba3db1e55..0f148434d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +#### Version 2.5.4 + +* Adaptation to YouTube API change. (#295, #296, #297) +* Upgrade deployment target to iOS 8.0 (macOS is still 10.9 and tvOS is still 9.0) + #### Version 2.5.3 * Adaptation to YouTube API change. (#257) diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..76cd8098d --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +CIRCLE_ARTIFACTS ?= artifacts +CIRCLE_TEST_REPORTS ?= test_reports + +export SCAN_PROJECT = XCDYouTubeKit.xcodeproj +export SCAN_SCHEME = XCDYouTubeKit Framework +export SCAN_BUILDLOG_PATH = ${CIRCLE_ARTIFACTS}/$@ +export SCAN_OUTPUT_TYPES = + +.PHONY: default test_macOS_report test_iOS_report test_tvOS_report test_macOS test_iOS test_tvOS test_iOS_9 check_scan check_slather + +default: check_slather check_scan + scan --clean --device "iPhone 5s" --code_coverage --buildlog_path "~/Library/Logs/scan" + slather coverage --verbose --output-directory "${TMPDIR}/${SCAN_SCHEME} Coverage Report" --html --show --ignore "../**/Contents/Developer/**" --scheme "${SCAN_SCHEME}" "${SCAN_PROJECT}" || true + +test_macOS_report: check_scan + scan --output_directory "${CIRCLE_TEST_REPORTS}" --output_types junit --custom_report_file_name $@.xml + +test_iOS_report: check_scan + scan --output_directory "${CIRCLE_TEST_REPORTS}" --output_types junit --custom_report_file_name $@.xml --device "iPhone 5s" --code_coverage --xcargs "OBJROOT=build GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES" + +test_tvOS_report: check_scan + scan --output_directory "${CIRCLE_TEST_REPORTS}" --output_types junit --custom_report_file_name $@.xml --device "Apple TV 1080p" + +test_macOS: check_scan + scan --configuration Release --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep MACOSX_DEPLOYMENT_TARGET=`xcrun --sdk "macosx" --show-sdk-version`" + +test_iOS: check_scan + scan --configuration Release --device "iPhone 5s" --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep IPHONEOS_DEPLOYMENT_TARGET=`xcrun --sdk "iphonesimulator" --show-sdk-version`" + +test_tvOS: check_scan + scan --configuration Release --device "Apple TV 1080p" --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep TVOS_DEPLOYMENT_TARGET=`xcrun --sdk "appletvsimulator" --show-sdk-version`" + +test_iOS_9: check_scan + scan --device "iPhone 5s (9.0)" + +check_scan: + @scan --version > /dev/null 2>&1 || (printf "❌ Please install \e[1;30mscan\e[0m (https://github.com/fastlane/fastlane/tree/master/scan) to run unit tests: $$ [sudo] \e[1;30mgem install scan\e[0m\n" && false) + +check_slather: + @slather version > /dev/null 2>&1 || printf "⚠️ Please install \e[1;30mslather\e[0m (https://github.com/SlatherOrg/slather) to get a code coverage report: $$ [sudo] \e[1;30mgem install slather\e[0m\n" diff --git a/README.md b/README.md index ea1fddfec..a8ee15a88 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## About -[![Build Status](https://img.shields.io/travis/0xced/XCDYouTubeKit/master.svg?style=flat)](https://travis-ci.org/0xced/XCDYouTubeKit) -[![Coverage Status](https://img.shields.io/coveralls/0xced/XCDYouTubeKit/master.svg?style=flat)](https://coveralls.io/r/0xced/XCDYouTubeKit?branch=master) +[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/master.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) +[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/master.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch.master) [![Platform](https://img.shields.io/cocoapods/p/XCDYouTubeKit.svg?style=flat)](http://cocoadocs.org/docsets/XCDYouTubeKit/) [![Pod Version](https://img.shields.io/cocoapods/v/XCDYouTubeKit.svg?style=flat)](https://cocoapods.org/pods/XCDYouTubeKit) [![Carthage Compatibility](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage/) diff --git a/Scripts/release.sh b/Scripts/release.sh index 480374a10..c76df1f9f 100755 --- a/Scripts/release.sh +++ b/Scripts/release.sh @@ -5,7 +5,7 @@ function update_badges() echo "Updating badges" set -v sed -i "" "s/$1\.svg/$2.svg/g" "README.md" - sed -i "" "s/branch=$1/branch=$2/g" "README.md" + sed -i "" "s/branch.$1/branch.$2/g" "README.md" set +v git add "README.md" git commit -m "Point badges to the $2 branch" @@ -36,11 +36,14 @@ sed -i "" "s/DYLIB_CURRENT_VERSION = .*;/DYLIB_CURRENT_VERSION = ${VERSION};/g" sed -i "" "s/CURRENT_PROJECT_VERSION = .*;/CURRENT_PROJECT_VERSION = ${CURRENT_PROJECT_VERSION};/g" "XCDYouTubeKit.xcodeproj/project.pbxproj" sed -i "" "s/CURRENT_PROJECT_VERSION = .*;/CURRENT_PROJECT_VERSION = ${VERSION};/g" "XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj" sed -i "" "s/^\(.*s.version.*=.*\)\".*\"/\1\"${VERSION}\"/" "XCDYouTubeKit.podspec" +sed -i "" "s/module_version: .*/module_version: ${VERSION}/" ".jazzy.yaml" +sed -i "" "s/tree\\/.*\\/XCDYouTubeKit/tree\\/${VERSION}\\/XCDYouTubeKit/" ".jazzy.yaml" sed -E -i "" "s/~> [0-9\.]+/~> ${VERSION_PARTS[0]}.${VERSION_PARTS[1]}/g" "README.md" set +v git add "XCDYouTubeKit.xcodeproj" git add "XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj" git add "XCDYouTubeKit.podspec" +git add ".jazzy.yaml" git add "README.md" git commit -m "Update version to ${VERSION}" diff --git a/Scripts/run-tests.sh b/Scripts/run-tests.sh deleted file mode 100755 index e8760d1ab..000000000 --- a/Scripts/run-tests.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -o pipefail - -: ${SCHEME:="XCDYouTubeKit iOS Static Library"} -: ${CONFIGURATION:="Release"} -: ${DESTINATION:="platform=iOS Simulator,name=iPhone 5s"} - -COMMAND="env NSUnbufferedIO=YES xcodebuild clean test -project XCDYouTubeKit.xcodeproj -scheme '${SCHEME}' -configuration '${CONFIGURATION}' -destination '${DESTINATION}'" - -for BUILD_SETTING in OBJROOT RUN_CLANG_STATIC_ANALYZER IPHONEOS_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET; do - VALUE=`eval echo \\$"${BUILD_SETTING}"` - if [ ! -z "${VALUE}" ]; then - COMMAND+=" ${BUILD_SETTING}='${VALUE}'" - unset ${BUILD_SETTING} - fi -done - -COMMAND+=" | tee xcodebuild.log" - -xcpretty --version > /dev/null 2>&1 && COMMAND+=" | xcpretty" && [ "${TRAVIS}" == "true" ] && xcpretty-travis-formatter > /dev/null 2>&1 && COMMAND+=" -f `xcpretty-travis-formatter`" - -set -x -eval "${COMMAND}" && rm xcodebuild.log diff --git a/XCDYouTubeKit Demo/Playground.playground/Contents.swift b/XCDYouTubeKit Demo/Playground.playground/Contents.swift index e53530735..8be03b019 100644 --- a/XCDYouTubeKit Demo/Playground.playground/Contents.swift +++ b/XCDYouTubeKit Demo/Playground.playground/Contents.swift @@ -1,18 +1,44 @@ -import XCPlayground import XCDYouTubeKit +#if swift(>=3.0) + import PlaygroundSupport + struct YouTubeVideoQuality { + static let hd720 = NSNumber(value: XCDYouTubeVideoQuality.HD720.rawValue) + static let medium360 = NSNumber(value: XCDYouTubeVideoQuality.medium360.rawValue) + static let small240 = NSNumber(value: XCDYouTubeVideoQuality.small240.rawValue) + } +#else + import XCPlayground + typealias Error = NSError + struct YouTubeVideoQuality { + static let hd720 = NSNumber(unsignedLong: XCDYouTubeVideoQuality.HD720.rawValue) + static let medium360 = NSNumber(unsignedLong: XCDYouTubeVideoQuality.Medium360.rawValue) + static let small240 = NSNumber(unsignedLong: XCDYouTubeVideoQuality.Small240.rawValue) + } +#endif setenv("XCDYouTubeKitLogLevel", "0", 1) var client = XCDYouTubeClient(languageIdentifier: "en") -client.getVideoWithIdentifier("6v2L2UGZJAM") { (video: XCDYouTubeVideo?, error: NSError?) -> Void in - video - error?.localizedDescription +client.getVideoWithIdentifier("6v2L2UGZJAM") { (video: XCDYouTubeVideo?, error: Error?) -> Void in + if let video = video { + video.description + video.streamURLs[XCDYouTubeVideoQualityHTTPLiveStreaming] + video.streamURLs[YouTubeVideoQuality.hd720] + video.streamURLs[YouTubeVideoQuality.medium360] + video.streamURLs[YouTubeVideoQuality.small240] + } else { + error?.localizedDescription + } } -client.getVideoWithIdentifier("xxxxxxxxxxx") { (video: XCDYouTubeVideo?, error: NSError?) -> Void in +client.getVideoWithIdentifier("xxxxxxxxxxx") { (video: XCDYouTubeVideo?, error: Error?) -> Void in video error?.localizedDescription } -XCPlaygroundPage.currentPage.needsIndefiniteExecution = true +#if swift(>=3.0) + PlaygroundPage.current.needsIndefiniteExecution = true +#else + XCPlaygroundPage.currentPage.needsIndefiniteExecution = true +#endif diff --git a/XCDYouTubeKit Demo/Playground.playground/timeline.xctimeline b/XCDYouTubeKit Demo/Playground.playground/timeline.xctimeline deleted file mode 100644 index bf468afec..000000000 --- a/XCDYouTubeKit Demo/Playground.playground/timeline.xctimeline +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj index 728e1687e..1025cc5d3 100644 --- a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj +++ b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj @@ -760,7 +760,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 2.5.3; + CURRENT_PROJECT_VERSION = 2.5.4; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -783,7 +783,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -805,7 +804,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 2.5.3; + CURRENT_PROJECT_VERSION = 2.5.4; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; @@ -823,7 +822,6 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; }; @@ -839,6 +837,7 @@ LD_RUNPATH_SEARCH_PATHS = "@loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = ch.pitaya.xcdyoutubekit.demo.ios; PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; @@ -853,6 +852,7 @@ LD_RUNPATH_SEARCH_PATHS = "@loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = ch.pitaya.xcdyoutubekit.demo.ios; PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Release; diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit OS X Demo.xcscheme b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit OS X Demo.xcscheme index f57428131..250787686 100644 --- a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit OS X Demo.xcscheme +++ b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit OS X Demo.xcscheme @@ -1,6 +1,6 @@ + buildForAnalyzing = "YES"> diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit iOS Demo.xcscheme b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit iOS Demo.xcscheme index 8633ada40..efbafa9b7 100644 --- a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit iOS Demo.xcscheme +++ b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit iOS Demo.xcscheme @@ -1,6 +1,6 @@ + buildForAnalyzing = "YES"> diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit tvOS Demo.xcscheme b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit tvOS Demo.xcscheme index 8f88545bd..740b74d90 100644 --- a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit tvOS Demo.xcscheme +++ b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcshareddata/xcschemes/XCDYouTubeKit tvOS Demo.xcscheme @@ -1,6 +1,6 @@ + buildForAnalyzing = "YES"> + + + +