|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + |
| 8 | +jobs: |
| 9 | + Tests: |
| 10 | + name: Tests |
| 11 | + runs-on: macOS-12 |
| 12 | + env: |
| 13 | + DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer |
| 14 | + PROJECT: VirgilSDKRatchet.xcodeproj |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - destination: "OS=15.5,name=iPhone 13 Pro" |
| 19 | + prefix: "iOS" |
| 20 | + test: "1" |
| 21 | + - destination: "arch=x86_64" |
| 22 | + prefix: "macOS" |
| 23 | + test: "1" |
| 24 | + - destination: "OS=15.4,name=Apple TV" |
| 25 | + prefix: "tvOS" |
| 26 | + test: "1" |
| 27 | + - destination: "OS=8.5,name=Apple Watch Series 7 - 45mm" |
| 28 | + prefix: "watchOS" |
| 29 | + test: "0" |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + - name: Decrypt tests config |
| 33 | + run: ./CI/decrypt-config.sh |
| 34 | + env: |
| 35 | + ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }} |
| 36 | + ENCRYPTION_IV: ${{ secrets.ENCRYPTION_IV }} |
| 37 | + - name: Prepare Dependencies |
| 38 | + env: |
| 39 | + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + run: | |
| 41 | + carthage version |
| 42 | + carthage bootstrap --use-xcframeworks --platform ${{ matrix.prefix }} |
| 43 | + - name: Run ${{ matrix.prefix }} Tests |
| 44 | + run: | |
| 45 | + SCHEME="VirgilSDKRatchet ${{ matrix.prefix }}" |
| 46 | +
|
| 47 | + if [ "${{ matrix.test }}" == "1" ]; then |
| 48 | + # Build Framework |
| 49 | + xcodebuild -verbose -project "$PROJECT" -scheme "$SCHEME" -destination "${{ matrix.destination }}" -configuration Debug clean build-for-testing | xcpretty; |
| 50 | + # Run Tests |
| 51 | + xcodebuild -verbose -project "$PROJECT" -scheme "$SCHEME" -destination "${{ matrix.destination }}" -configuration Debug test-without-building | xcpretty; |
| 52 | + else |
| 53 | + xcodebuild -verbose -project "$PROJECT" -scheme "$SCHEME" -destination "${{ matrix.destination }}" -configuration Release clean build | xcpretty; |
| 54 | + fi |
| 55 | + SPM: |
| 56 | + runs-on: macOS-12 |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v2 |
| 59 | + - name: Decrypt tests config |
| 60 | + run: ./CI/decrypt-config.sh |
| 61 | + env: |
| 62 | + ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }} |
| 63 | + ENCRYPTION_IV: ${{ secrets.ENCRYPTION_IV }} |
| 64 | + - name: SPM test |
| 65 | + run: | |
| 66 | + brew install coreutils # install 'timeout' utility |
| 67 | + swift --version |
| 68 | + # fix for Swift Package Manager when it fails to download binary targets |
| 69 | + timeout 5m bash -c 'until swift build; do rm -fr .build && sleep 10; done' |
| 70 | + swift test |
| 71 | +
|
| 72 | + Swiftlint: |
| 73 | + runs-on: macOS-12 |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v2 |
| 76 | + - name: Swiftlint |
| 77 | + run: | |
| 78 | + brew outdated swiftlint || brew upgrade swiftlint |
| 79 | + swiftlint |
0 commit comments