Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and Test (PR)

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
workflow_dispatch:

concurrency:
group: build-and-test-${{ github.head_ref || github.ref }}
cancel-in-progress: true

run-name: Build and Test

jobs:
build-and-test:
runs-on: macos-14

env:
DESTINATION: 'generic/platform=iOS Simulator'
# Connectors to build — Yospace excluded (requires proprietary YOAdManagement SDK)
BUILD_SCHEMES: >-
THEOplayerConnectorUtilities
THEOplayerConnectorConviva
THEOplayerConnectorNielsen
THEOplayerConnectorSideloadedSubtitle
THEOplayerConnectorUplynk
# Test schemes to run
TEST_SCHEMES: >-
THEOplayerConnectorUplynkTests

steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.2.0'

- name: Log environment
run: |
echo "macOS:" && sw_vers
echo "Xcode:" && xcodebuild -version
echo "Swift:" && swift --version

- name: Check out repository
uses: actions/checkout@v4

- name: Resolve SPM dependencies
run: |
xcodebuild -resolvePackageDependencies \
-scheme THEOplayerConnectorUtilities \
-destination "$DESTINATION"

- name: Build connectors
run: |
set -euo pipefail
for scheme in $BUILD_SCHEMES; do
echo "----------------------------------------"
echo "Building: $scheme"
echo "----------------------------------------"
xcodebuild build \
-scheme "$scheme" \
-destination "$DESTINATION" \
-skipPackagePluginValidation \
| xcpretty
done

- name: Run tests
run: |
set -euo pipefail
SIM_DEST='platform=iOS Simulator,name=iPhone 16'
for scheme in $TEST_SCHEMES; do
echo "----------------------------------------"
echo "Testing: $scheme"
echo "----------------------------------------"
xcodebuild test \
-scheme "$scheme" \
-destination "$SIM_DEST" \
-skipPackagePluginValidation \
| xcpretty
done
2 changes: 1 addition & 1 deletion Code/Uplynk/Tests/Mocks/MockAdBreak.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct MockAdBreak: AdBreak {

struct MockAd: Ad {
let isSlate = false
var adBreak: AdBreak = MockAdBreak()
var adBreak: AdBreak? = MockAdBreak()
var companions: [CompanionAd] = []
var type: String = ""
var id: String?
Expand Down
9 changes: 8 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down Expand Up @@ -85,6 +85,13 @@ let package = Package(
"THEOplayerConnectorUplynk"
],
path: "Code/Uplynk/Tests"
),
.testTarget(
name: "THEOplayerConnectorSideloadedSubtitleTests",
dependencies: [
"THEOplayerConnectorSideloadedSubtitle"
],
path: "Code/Sideloaded-TextTracks/Tests/THEOplayerConnectorSideloadedSubtitleTests"
)
]
)
Loading