build #1707
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: [main, dev] | |
paths-ignore: | |
- 'Docs/**' # Docs folder in root of repo | |
- '**/*.md' # .md files anywhere in the repo | |
- '**/LICENSE' # LICENSE files anywhere in the repo | |
- '**/.gitignore' # .gitignore files anywhere in the repo | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- 'Docs/**' # Docs folder in root of repo | |
- '**/*.md' # .md files anywhere in the repo | |
- '**/LICENSE' # LICENSE files anywhere in the repo | |
- '**/.gitignore' # .gitignore files anywhere in the repo | |
workflow_dispatch: | |
schedule: | |
- cron: '40 11 * * *' # once a day @ 11:40am UTC (4:40am PST) | |
env: | |
SCHEME: "TimecodeKit-CI" | |
jobs: | |
macOS: | |
name: macOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Build | |
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Unit Tests | |
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
macOS-swift6: | |
name: macOS (Swift 6) | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Set Package to Swift 6.0 | |
run: swift package tools-version --set "6.0" | |
- name: Build | |
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Unit Tests | |
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
macCatalyst: | |
name: macCatalyst | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Build | |
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS,variant=Mac Catalyst" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Unit Tests | |
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS,variant=Mac Catalyst" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
iOS: | |
name: iOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Boostrap Platforms | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcrun simctl list | |
- name: Download Platform | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcodebuild -downloadPlatform iOS | |
- name: Build | |
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=iOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Prepare Destination Device Name | |
id: destnameprep | |
# As of GitHub's updates to the macOS-15 runner summer 2025, randomly Xcode may not list any simulators. | |
# No idea why. Seems like a bug or runner config issue. So to prevent false-positive job failures, we'll skip | |
# the unit tests if no devices are found, but mark the unit test step as cancelled. The job is still marked as | |
# passed (green), but the Unit Tests step will show cancelled. This is the best we can do, as there appears to | |
# be no way to "cancel" an individual job programmatically. | |
continue-on-error: true | |
shell: bash | |
run: | | |
xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" > destinations.txt | |
SIMPLATFORM="iOS" | |
SIMDEVICE="iPhone\s\d{2}\s" | |
REGEX="m/\{\splatform:(.*\sSimulator),.*OS:(\d{1,2}\.\d),.*name:([a-zA-Z0-9\(\)\s]*)\s\}/g" | |
SIMPATFORMLIST=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print "- ${name} (${plat}) (${os})"; } }') | |
if [[ -z $SIMPATFORMLIST ]]; then echo "Error: no matching simulators available."; exit 1; fi | |
echo "Available $SIMPLATFORM simulators:" | |
echo "$SIMPATFORMLIST" | |
DESTNAME=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print $name; } }' | sort -rV | head -n 1) | |
if [[ -z $DESTNAME ]]; then echo "Error: no matching simulators available."; exit 1; fi | |
echo "Using device name \"$DESTNAME\"" | |
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV" | |
- name: Unit Tests | |
if: steps.destnameprep.outcome != 'failure' | |
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=iOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
tvOS: | |
name: tvOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Boostrap Platforms | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcrun simctl list | |
- name: Download Platform | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcodebuild -downloadPlatform tvOS | |
- name: Build | |
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=tvOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Prepare Destination Device Name | |
id: destnameprep | |
# As of GitHub's updates to the macOS-15 runner summer 2025, randomly Xcode may not list any simulators. | |
# No idea why. Seems like a bug or runner config issue. So to prevent false-positive job failures, we'll skip | |
# the unit tests if no devices are found, but mark the unit test step as cancelled. The job is still marked as | |
# passed (green), but the Unit Tests step will show cancelled. This is the best we can do, as there appears to | |
# be no way to "cancel" an individual job programmatically. | |
continue-on-error: true | |
shell: bash | |
run: | | |
xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" > destinations.txt | |
SIMPLATFORM="tvOS" | |
SIMDEVICE="Apple\sTV" | |
REGEX="m/\{\splatform:(.*\sSimulator),.*OS:(\d{1,2}\.\d),.*name:([a-zA-Z0-9\(\)\s]*)\s\}/g" | |
SIMPATFORMLIST=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print "- ${name} (${plat}) (${os})"; } }') | |
if [[ -z $SIMPATFORMLIST ]]; then echo "Error: no matching simulators available."; exit 1; fi | |
echo "Available $SIMPLATFORM simulators:" | |
echo "$SIMPATFORMLIST" | |
DESTNAME=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print $name; } }' | sort -rV | head -n 1) | |
if [[ -z $DESTNAME ]]; then echo "Error: no matching simulators available."; exit 1; fi | |
echo "Using device name \"$DESTNAME\"" | |
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV" | |
- name: Unit Tests | |
if: steps.destnameprep.outcome != 'failure' | |
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=tvOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
watchOS: | |
name: watchOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Boostrap Platforms | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcrun simctl list | |
- name: Download Platform | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcodebuild -downloadPlatform watchOS | |
- name: Build | |
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=watchOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Prepare Destination Device Name | |
id: destnameprep | |
# As of GitHub's updates to the macOS-15 runner summer 2025, randomly Xcode may not list any simulators. | |
# No idea why. Seems like a bug or runner config issue. So to prevent false-positive job failures, we'll skip | |
# the unit tests if no devices are found, but mark the unit test step as cancelled. The job is still marked as | |
# passed (green), but the Unit Tests step will show cancelled. This is the best we can do, as there appears to | |
# be no way to "cancel" an individual job programmatically. | |
continue-on-error: true | |
shell: bash | |
run: | | |
xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" > destinations.txt | |
SIMPLATFORM="watchOS" | |
SIMDEVICE="Apple\sWatch\sSeries" | |
REGEX="m/\{\splatform:(.*\sSimulator),.*OS:(\d{1,2}\.\d),.*name:([a-zA-Z0-9\(\)\s]*)\s\}/g" | |
SIMPATFORMLIST=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print "- ${name} (${plat}) (${os})"; } }') | |
if [[ -z $SIMPATFORMLIST ]]; then echo "Error: no matching simulators available."; exit 1; fi | |
echo "Available $SIMPLATFORM simulators:" | |
echo "$SIMPATFORMLIST" | |
DESTNAME=$(cat destinations.txt | perl -nle 'if ('$REGEX') { ($plat, $os, $name) = ($1, $2, $3); if ($plat =~ /'$SIMPLATFORM'/ and $name =~ /'$SIMDEVICE'/) { print $name; } }' | sort -rV | head -n 1) | |
if [[ -z $DESTNAME ]]; then echo "Error: no matching simulators available."; exit 1; fi | |
echo "Using device name \"$DESTNAME\"" | |
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV" | |
- name: Unit Tests | |
if: steps.destnameprep.outcome != 'failure' | |
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=watchOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
examples: | |
name: Examples | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@main | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Boostrap Platforms | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcrun simctl list | |
- name: Download Platform | |
# Workaround for Xcode/GitHub runner issues finding simulators. | |
# see https://github.com/actions/runner-images/issues/12758#issuecomment-3206748945 | |
run: xcodebuild -downloadPlatform iOS | |
- name: Movie Timecode - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise | |
run: xcodebuild -project "Examples/Movie Timecode/Movie Timecode.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Movie Timecode - Build (macOS) | |
run: xcodebuild build -project "Examples/Movie Timecode/Movie Timecode.xcodeproj" -scheme "Movie Timecode" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Movie Timecode - Build (iOS) # by targeting a simulator device, we bypass requiring a Developer Team ID | |
run: xcodebuild build -project "Examples/Movie Timecode/Movie Timecode.xcodeproj" -scheme "Movie Timecode" -destination "generic/platform=iOS Simulator,name=Any iOS Simulator Device" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Timecode UI - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise | |
run: xcodebuild -project "Examples/Timecode UI/Timecode UI.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Timecode UI - Build (macOS) | |
run: xcodebuild build -project "Examples/Timecode UI/Timecode UI.xcodeproj" -scheme "Timecode UI" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Timecode UI - Build (iOS) # by targeting a simulator device, we bypass requiring a Developer Team ID | |
run: xcodebuild build -project "Examples/Timecode UI/Timecode UI.xcodeproj" -scheme "Timecode UI" -destination "generic/platform=iOS Simulator,name=Any iOS Simulator Device" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Timecode Math - Resolve Package Dependencies # needed because sometimes xcodebuild fails otherwise | |
run: xcodebuild -project "Examples/Timecode Math/Timecode Math.xcodeproj" -resolvePackageDependencies | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Timecode Math - Build (macOS) | |
run: xcodebuild build -project "Examples/Timecode Math/Timecode Math.xcodeproj" -scheme "Timecode Math" -destination "generic/platform=macOS" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} | |
- name: Timecode Math - Build (iOS) # by targeting a simulator device, we bypass requiring a Developer Team ID | |
run: xcodebuild build -project "Examples/Timecode Math/Timecode Math.xcodeproj" -scheme "Timecode Math" -destination "generic/platform=iOS Simulator,name=Any iOS Simulator Device" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} |