Drop pinned OS versions from CI simulator destinations #96
Workflow file for this run
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: Swift Package Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: "Branch to test" | |
| required: true | |
| default: "main" | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: macOS | |
| runner: macos-latest | |
| command: swift test | |
| - platform: iOS | |
| runner: macos-latest | |
| sim_runtime: iOS | |
| - platform: tvOS | |
| runner: macos-latest | |
| sim_runtime: tvOS | |
| - platform: watchOS | |
| runner: macos-latest | |
| sim_runtime: watchOS | |
| - platform: visionOS | |
| runner: macos-latest | |
| sim_runtime: visionOS | |
| - platform: Linux | |
| runner: ubuntu-latest | |
| container: swift:6.2 | |
| command: swift test | |
| runs-on: ${{ matrix.runner }} | |
| container: ${{ matrix.container || '' }} | |
| name: Test (${{ matrix.platform }}) | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| - name: Select latest Xcode | |
| if: ${{ matrix.runner == 'macos-latest' }} | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: latest-stable | |
| - name: Display Swift version | |
| run: swift --version | |
| - name: Display Xcode version | |
| if: ${{ matrix.runner == 'macos-latest' }} | |
| run: xcodebuild -version | |
| - name: Resolve simulator destination | |
| if: ${{ matrix.sim_runtime }} | |
| run: | | |
| RUNTIME="${{ matrix.sim_runtime }}" | |
| # visionOS runtimes may use 'xrOS' in the identifier | |
| case "$RUNTIME" in | |
| visionOS) PATTERN="visionOS|xrOS" ;; | |
| *) PATTERN="$RUNTIME" ;; | |
| esac | |
| DEVICE_INFO=$(xcrun simctl list devices available -j | jq -r --arg p "$PATTERN" ' | |
| [.devices | to_entries[] | select(.key | test($p)) | .value[] | select(.isAvailable == true)] | |
| | first | "\(.udid)|\(.name)" | |
| ') | |
| DEVICE_UDID="${DEVICE_INFO%%|*}" | |
| DEVICE_NAME="${DEVICE_INFO##*|}" | |
| if [ "$DEVICE_UDID" = "null" ] || [ -z "$DEVICE_UDID" ]; then | |
| echo "::error::No available ${{ matrix.sim_runtime }} simulator found" | |
| xcrun simctl list devices available | |
| exit 1 | |
| fi | |
| echo "Resolved simulator: $DEVICE_NAME ($DEVICE_UDID)" | |
| echo "SIM_DESTINATION=platform=${{ matrix.sim_runtime }} Simulator,id=$DEVICE_UDID" >> "$GITHUB_ENV" | |
| - name: Run tests | |
| run: | | |
| if [ -n "$SIM_DESTINATION" ]; then | |
| xcodebuild test -scheme Simplicity -destination "$SIM_DESTINATION" -skipPackagePluginValidation | |
| else | |
| ${{ matrix.command }} | |
| fi |