build #634
  
    
      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: "TextFileKit-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 -skipMacroValidation -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 -skipMacroValidation -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 -skipMacroValidation -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: Bootstrap 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 -skipMacroValidation -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: Bootstrap 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 -skipMacroValidation -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: Bootstrap 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 -skipMacroValidation -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=watchOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} |