From 038be6f2a4d6d8131104fadf0f59ec9e6df6a9d9 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Sun, 18 Aug 2024 20:45:51 -0400 Subject: [PATCH] Fix and update GitHub Actions workflow for Xcode builds - Update action dependencies - Switch from `xcversion` to `xcodes` - Update target devices and runtimes --- .github/actions/prepare-simulator/action.yml | 21 +++-------- .github/workflows/xcode.yml | 37 ++++++++++---------- 2 files changed, 23 insertions(+), 35 deletions(-) diff --git a/.github/actions/prepare-simulator/action.yml b/.github/actions/prepare-simulator/action.yml index b893ab3..6a98684 100644 --- a/.github/actions/prepare-simulator/action.yml +++ b/.github/actions/prepare-simulator/action.yml @@ -14,19 +14,6 @@ outputs: runs: using: composite steps: - - name: "Print bundled runtimes" - shell: bash - run: | - echo "::group::Bundled runtimes:" - for xcode in /Applications/Xcode*.app; do \ - echo $xcode | grep -o "Xcode.*\.app"; \ - for plist in $xcode/Contents/Developer/Platforms/*.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/*.simruntime/Contents/Info.plist; do \ - defaults read $plist CFBundleName; \ - done; \ - echo ""; \ - done - echo "::endgroup::" - - name: "Install runtime" shell: bash run: | @@ -36,9 +23,9 @@ runs: echo "$RUNTIME is already installed."; else echo "::group::Available runtimes:" - xcversion simulators + xcodes runtimes echo "::endgroup::" - xcversion simulators --install="$RUNTIME"; + sudo xcodes runtimes install "$RUNTIME" --keep-archive; fi - name: "Create and boot simulator" @@ -47,8 +34,8 @@ runs: run: | RUNTIME="${{ inputs.runtime }}" DEVICE="${{ inputs.device }}" - DEVICE_ID=com.apple.CoreSimulator.SimDeviceType.$(echo $DEVICE | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g") - RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.$(echo $RUNTIME | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g") + DEVICE_ID=com.apple.CoreSimulator.SimDeviceType.$(echo $DEVICE | sed -E -e "s/[ \-]+/ /g" -e "s/[\(\)]//g" -e "s/[^[:alnum:]]/-/g") + RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.$(echo $RUNTIME | sed -E -e "s/[ \-]+/ /g" -e "s/[\(\)]//g" -e "s/[^[:alnum:]]/-/g") DESTINATION_ID=$(xcrun simctl create "Custom: $DEVICE, $RUNTIME" $DEVICE_ID $RUNTIME_ID) xcrun simctl boot $DESTINATION_ID echo "destination-id=$(echo $DESTINATION_ID)" >> $GITHUB_OUTPUT diff --git a/.github/workflows/xcode.yml b/.github/workflows/xcode.yml index 9c8a271..4ae6fd8 100644 --- a/.github/workflows/xcode.yml +++ b/.github/workflows/xcode.yml @@ -10,14 +10,14 @@ jobs: matrix: env: - xcode: 15.4 - runtime: "iOS 15.5" - device: "iPhone 13 Pro" + runtime: "iOS 17.5" + device: "iPhone 15 Pro Max" - xcode: 15.4 - runtime: "iOS 14.5" - device: "iPhone 12 Pro Max" + runtime: "iOS 16.4" + device: "iPhone 12 mini" - xcode: 15.4 - runtime: "iOS 13.7" - device: "iPhone 11" + runtime: "iOS 15.5" + device: "iPhone SE" steps: - uses: actions/checkout@v4 with: @@ -27,9 +27,9 @@ jobs: with: version: ${{ matrix.env.xcode }} - name: "Cache downloaded simulator runtimes" - uses: actions/cache@v3 + uses: actions/cache@v4 with: - path: ~/Library/Caches/XcodeInstall/*.dmg + path: ~/Downloads/*.dmg key: Xcode ${{ matrix.env.xcode }}+${{ matrix.env.runtime }} - name: "Prepare simulator" id: prepare-simulator @@ -41,11 +41,12 @@ jobs: run: | set -o pipefail xcodebuild test -project "OneTimePassword.xcodeproj" -scheme "OneTimePassword (iOS)" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c - - uses: sersoft-gmbh/swift-coverage-action@v3 + - uses: sersoft-gmbh/swift-coverage-action@v4 with: target-name-filter: ^OneTimePassword$ - - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true watchos: @@ -55,14 +56,14 @@ jobs: matrix: env: - xcode: 15.4 - runtime: "watchOS 8.5" - device: "Apple Watch Series 7 - 45mm" + runtime: "watchOS 10.5" + device: "Apple Watch Ultra 2 (49mm)" - xcode: 15.4 - runtime: "watchOS 7.4" - device: "Apple Watch Series 6 - 44mm" + runtime: "watchOS 9.4" + device: "Apple Watch SE (44mm) (2nd generation)" - xcode: 15.4 - runtime: "watchOS 6.2" - device: "Apple Watch Series 4 - 40mm" + runtime: "watchOS 8.5" + device: "Apple Watch Series 3 (38mm)" steps: - uses: actions/checkout@v4 with: @@ -72,9 +73,9 @@ jobs: with: version: ${{ matrix.env.xcode }} - name: "Cache downloaded simulator runtimes" - uses: actions/cache@v3 + uses: actions/cache@v4 with: - path: ~/Library/Caches/XcodeInstall/*.dmg + path: ~/Downloads/*.dmg key: Xcode ${{ matrix.env.xcode }}+${{ matrix.env.runtime }} - name: "Prepare simulator" id: prepare-simulator