summaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: 66194f6309dbddc21f3941bb6ca101ed606873be (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
95
96
97
98
99
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 11,OS=14.1'

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.1.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.1.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 --no-use-binaries --platform iOS --cache-builds
              # run: carthage 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
              with: 
                yml: ./codecov.yml

    rpcTest:
        name: RPCSpecGeneratorTests
        runs-on: ubuntu-latest
        strategy:
            fail-fast: false
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2.3.1
              with:
                  submodules: true
            - name: Current Directory
              run: ls
            - name: Install dependencies
              run: |
                python3 -m pip install -r generator/requirements.txt
            - name: Run RPC generator tests
              run: |
                python3 generator/test/runner.py