diff options
author | NicoleYarroch <nicole@livio.io> | 2020-06-02 10:07:15 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2020-06-02 10:07:15 -0400 |
commit | cbca7f5b6b194f7d1732bddea79e71ec80266f03 (patch) | |
tree | 56409606ec9b22152224a0a20944088dbe6c2de1 | |
parent | 37cb5edcd23a8228b8db2f7dc5bd3360c88cb9f7 (diff) | |
download | sdl_ios-cbca7f5b6b194f7d1732bddea79e71ec80266f03.tar.gz |
Added support for GitHub Actions CI
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r-- | .github/workflows/test.yml | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..5bd4dcb65 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,89 @@ +name: SmartDeviceLink Unit Tests + +# This workflow is triggered on a push or pull request. +on: [push, pull_request] + +jobs: + build: + name: Build Example Apps + runs-on: macOS-latest + + strategy: + fail-fast: false + matrix: + destination: ['platform=iOS Simulator,name=iPhone 11,OS=13.5'] + scheme: ['SmartDeviceLink-Example-ObjC', 'SmartDeviceLink-Example-Swift'] + project: ['SmartDeviceLink-iOS.xcodeproj'] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: true + + # Print the available Xcode versions + - 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_11.5.app + + - name: Build + run: | + set -o pipefail && xcodebuild -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" build | xcpretty --color --simple + + test: + name: SmartDeviceLinkTests + runs-on: macOS-latest + + strategy: + fail-fast: false + matrix: + destination: ['platform=iOS Simulator,name=iPhone 11,OS=13.5'] + scheme: ['SmartDeviceLink'] + project: ['SmartDeviceLink-iOS.xcodeproj'] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + 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: Installing dependencies + if: steps.carthage-cache.outputs.cache-hit != 'true' + run: | + carthage bootstrap --no-use-binaries --platform iOS --cache-builds + + # Print the available Xcode versions + - 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_11.5.app + + # 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 "${{ matrix.project }}" -destination "${{ matrix.destination }}" -scheme "${{ matrix.scheme }}" + + - name: Running unit tests + run: | + set -o pipefail && xcodebuild test-without-building -project "${{ matrix.project }}" -destination "${{ matrix.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 test | xcpretty --color --simple + + # Upload coverage reports to Codecov + - name: Codecov + uses: codecov/codecov-action@v1 + with: + file: ./codecov.yml + flags: unittests + |