summaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: 45d857d1ba219c3e2286623abd8beedfd3a53cb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: SmartDeviceLink Tests

# This workflow is triggered on a push or pull request.
on: [push, pull_request]

env:
    PROJECT: 'SmartDeviceLink-iOS.xcodeproj'
    DESTINATION: 'platform=iOS Simulator,name=iPhone 12,OS=14.4'

jobs:
    build:
        name: Build Example Apps
        runs-on: macOS-latest
        strategy:
            fail-fast: false
            matrix:
                scheme: ['SmartDeviceLink-Example-ObjC', 'SmartDeviceLink-Example-Swift']
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2.3.1
              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_12.4.app

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

    test:
        name: SmartDeviceLinkTests
        runs-on: macOS-latest
        strategy:
            fail-fast: false
            matrix:
                scheme: ['SmartDeviceLink']
        steps:
            # 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_12.4.app

            - name: Checkout repository
              uses: actions/checkout@v2.3.1
              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: bash carthage-build.sh bootstrap --no-use-binaries --platform ios --cache-builds

            # 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 }}"

            - 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

            # Upload coverage reports to Codecov
            - name: Upload coverage to Codecov
              uses: codecov/codecov-action@v1.0.10

    rpcTest:
        name: RPC Generator Tests
        runs-on: ubuntu-20.04
        strategy:
            fail-fast: false
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2.3.1
              with:
                  submodules: true

            - name: Install dependencies
              run: python3 -m pip install -r generator/requirements.txt

            - name: Run RPC generator tests
              run: python3 generator/test/runner.py