Skip to content

Commit

Permalink
Fix and update GitHub Actions workflow for Xcode builds
Browse files Browse the repository at this point in the history
- Update action dependencies
- Switch from `xcversion` to `xcodes`
- Update target devices and runtimes
  • Loading branch information
mattrubin committed Aug 19, 2024
1 parent 2f5d43c commit 038be6f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 35 deletions.
21 changes: 4 additions & 17 deletions .github/actions/prepare-simulator/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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"
Expand All @@ -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
37 changes: 19 additions & 18 deletions .github/workflows/xcode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 038be6f

Please sign in to comment.