Merge pull request #11 from TimOliver/ci #36
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: CI | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| test: | |
| name: iOS Simulator Tests | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Show Xcode and SDK versions | |
| run: | | |
| xcodebuild -version | |
| xcrun --show-sdk-version --sdk iphonesimulator | |
| - name: Select latest iPhone simulator | |
| id: simulator | |
| run: | | |
| DEVICE=$(xcrun simctl list devices available | \ | |
| grep -oE 'iPhone [0-9]+( Pro( Max)?)?' | \ | |
| sort -V | tail -n 1) | |
| if [ -z "$DEVICE" ]; then | |
| echo "No iPhone simulator found. Available devices:" | |
| xcrun simctl list devices available | |
| exit 1 | |
| fi | |
| echo "Selected simulator: $DEVICE" | |
| echo "device=$DEVICE" >> "$GITHUB_OUTPUT" | |
| - name: Pre-boot simulator | |
| # Cold-boot the simulator before running tests so file-coordination and | |
| # presenter system services are ready by the time NSFilePresenter-driven | |
| # integration tests start. Skipping this makes those tests flake on CI | |
| # even though they pass reliably locally. | |
| run: xcrun simctl bootstatus "${{ steps.simulator.outputs.device }}" -b | |
| - name: Run tests | |
| run: | | |
| set -o pipefail | |
| xcodebuild test \ | |
| -project TOFileSystemObserverExample.xcodeproj \ | |
| -scheme TOFileSystemObserverTests \ | |
| -destination "platform=iOS Simulator,name=${{ steps.simulator.outputs.device }},OS=latest" \ | |
| -resultBundlePath TestResults.xcresult \ | |
| -test-iterations 3 \ | |
| -retry-tests-on-failure \ | |
| CODE_SIGNING_ALLOWED=NO | |
| - name: Upload test results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: TestResults.xcresult |