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

Issue - 2118 | Fix Unit Tests dependencies using pods #2120

Closed
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 8 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on: [push, pull_request, workflow_dispatch]

env:
PROJECT: 'SmartDeviceLink-iOS.xcodeproj'
DESTINATION: 'platform=iOS Simulator,name=iPhone 13,OS=15.2'
PROJECT_UT: 'SmartDeviceLink-iOS.xcworkspace'
DESTINATION: 'platform=iOS Simulator,name=iPhone 14,OS=16.2'

jobs:
build:
Expand All @@ -25,12 +26,8 @@ jobs:
- name: Get available Xcode versions on the server
run: ls /Applications | grep Xcode

# Select the Xcode version (the platform/simulator/OS available for testing depend on the Xcode version)
- name: Select Xcode version
run: sudo xcode-select -switch /Applications/Xcode_13.2.app

- name: Build
run: set -o pipefail && xcodebuild -scheme "${{ matrix.scheme }}" -destination "$DESTINATION" build | xcpretty --color --simple
run: set -o pipefail && xcodebuild -scheme "${{ matrix.scheme }}" -destination "$DESTINATION" build

test:
name: SmartDeviceLinkTests
Expand All @@ -44,33 +41,23 @@ jobs:
- name: Get available Xcode versions on the server
run: ls /Applications | grep Xcode

# Select the Xcode version (the platform/simulator/OS available for testing depend on the Xcode version)
- name: Select Xcode version
run: sudo xcode-select -switch /Applications/Xcode_13.2.app

- name: Checkout repository
uses: actions/[email protected]
with:
submodules: true

- name: Checking for cached dependencies
uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
restore-keys: ${{ runner.os }}-carthage-
- name: Install Cocoapods
run: sudo gem install cocoapods

- name: Installing dependencies
if: steps.carthage-cache.outputs.cache-hit != 'true'
run: carthage bootstrap --use-xcframeworks --no-use-binaries --platform ios --cache-builds
run: pod install

# Split build into build-only and test-only as it is faster than building and running in one step
- name: Building unit tests
run: xcodebuild build-for-testing -project "$PROJECT" -destination "$DESTINATION" -scheme "${{ matrix.scheme }}"
run: xcodebuild build-for-testing -workspace "$PROJECT_UT" -destination "$DESTINATION" -scheme "${{ matrix.scheme }}"

- name: Running unit tests
run: set -o pipefail && xcodebuild test-without-building -project "$PROJECT" -destination "$DESTINATION" -scheme "${{ matrix.scheme }}" -configuration Debug ONLY_ACTIVE_ARCH=NO RUN_CLANG_STATIC_ANALYZER=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ENABLE_TESTABILITY=YES | xcpretty --color --simple
run: set -o pipefail && xcodebuild test-without-building -workspace "$PROJECT_UT" -destination "$DESTINATION" -scheme "${{ matrix.scheme }}" -configuration Debug ONLY_ACTIVE_ARCH=NO RUN_CLANG_STATIC_ANALYZER=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ENABLE_TESTABILITY=YES

# Upload coverage reports to Codecov
- name: Upload coverage to Codecov
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Thumbs.db
*.lock
profile

# Cocoapods #
Pods/
# Add back the Podfile.lock to our git repo after *.lock in previous block
!Podfile.lock

# Carthage #
############
Carthage.pkg
Expand Down
3 changes: 0 additions & 3 deletions Cartfile.private

This file was deleted.

3 changes: 0 additions & 3 deletions Cartfile.resolved

This file was deleted.

42 changes: 42 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

#target 'SmartDeviceLink' do
# # Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
#
# # Pods for SmartDeviceLink
#
target 'SmartDeviceLinkTests' do
use_frameworks!
# Pods for testing
pod 'Quick', '5.0.1'
pod 'Nimble', '10.0.0'
pod 'OCMock', '3.9.1'
end
#
#end
#
#target 'SmartDeviceLink-Example-ObjC' do
# # Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
#
# # Pods for SmartDeviceLink-Example-ObjC
#
#end
#
#target 'SmartDeviceLink-Example-Swift' do
# # Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
#
# # Pods for SmartDeviceLink-Example-Swift
#
#end
#
#target 'SmartDeviceLinkSwift' do
# # Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
#
# # Pods for SmartDeviceLinkSwift
#
#end
24 changes: 24 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PODS:
- Nimble (10.0.0)
- OCMock (3.9.1)
- Quick (5.0.1)

DEPENDENCIES:
- Nimble (= 10.0.0)
- OCMock (= 3.9.1)
- Quick (= 5.0.1)

SPEC REPOS:
trunk:
- Nimble
- OCMock
- Quick

SPEC CHECKSUMS:
Nimble: 5316ef81a170ce87baf72dd961f22f89a602ff84
OCMock: 9491e4bec59e0b267d52a9184ff5605995e74be8
Quick: 749aa754fd1e7d984f2000fe051e18a3a9809179

PODFILE CHECKSUM: baffe692a0115b236a8ddcfb5d1f1941964b772e

COCOAPODS: 1.12.1
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ To prepare the library for development, you will need to take a few steps:
When creating or updating an RPC, you will need to install and use the [RPC generator](https://github.com/smartdevicelink/sdl_ios/tree/master/generator). The generator must be used to ensure that the content is correct. To use the generator, the RPC must be updated on the [RPC spec repository](https://github.com/smartdevicelink/rpc_spec).

#### Running Tests
To run tests, you will need to bootstrap the Carthage testing libraries. To do so, first [install Carthage](https://github.com/Carthage/Carthage#installing-carthage).
To run tests, you will need to bootstrap the Cocoapods testing libraries. To do so, run:
```bash
sudo gem install cocoapods
```
For more information, [check Cocoapods](https://cocoapods.org/).

Then, from the root project directory, run:
```bash
carthage bootstrap --use-xcframeworks --platform ios
pod install
```

At this point, you can run tests from Xcode, or, if you wish to run the tests exactly as they will be run on the CI server, see the [YAML document](https://github.com/smartdevicelink/sdl_ios/blob/master/.github/workflows/test.yml) describing those tests. You can also check the [previously run CI tests](https://github.com/smartdevicelink/sdl_ios/actions?query=workflow%3A%22SmartDeviceLink+Tests%22) to see how they're currently being run.
Loading