-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #407 from mattrubin/modernize
Update project for modern Xcode, Swift, and iOS
- Loading branch information
Showing
87 changed files
with
674 additions
and
398 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "Prepare simulator" | ||
description: "Creates and boots a custom simulator" | ||
inputs: | ||
runtime: | ||
description: "Runtime name" | ||
required: true | ||
device: | ||
description: "Device name" | ||
required: true | ||
outputs: | ||
destination-id: | ||
description: "Destination simulator ID" | ||
value: ${{ steps.simulator.outputs.destination-id }} | ||
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: | | ||
RUNTIME="${{ inputs.runtime }}" | ||
if xcrun simctl list | grep "$RUNTIME" | ||
then | ||
echo "$RUNTIME is already installed."; | ||
else | ||
echo "::group::Available runtimes:" | ||
xcversion simulators | ||
echo "::endgroup::" | ||
xcversion simulators --install="$RUNTIME"; | ||
fi | ||
- name: "Create and boot simulator" | ||
id: simulator | ||
shell: bash | ||
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") | ||
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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: "Select Xcode version" | ||
description: "Selects the specified version of Xcode" | ||
inputs: | ||
version: | ||
description: "Version number" | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- run: | | ||
echo "::group::Selecting Xcode ${{ inputs.version }}…" | ||
sudo xcode-select -s /Applications/Xcode_${{ inputs.version }}.app | ||
xcode-select -p | ||
echo "::endgroup::" | ||
shell: bash | ||
- run: | | ||
echo "::group::xcodebuild -version -sdk" | ||
xcodebuild -version -sdk | ||
echo "::endgroup::" | ||
shell: bash | ||
- run: | | ||
echo "::group::xcrun simctl list" | ||
xcrun simctl list | ||
echo "::endgroup::" | ||
shell: bash |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build & Test | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
ios: | ||
name: "Build & Test (Xcode ${{ matrix.env.xcode }}, ${{ matrix.env.runtime }}, ${{ matrix.env.device }})" | ||
runs-on: macOS-12 | ||
strategy: | ||
matrix: | ||
env: | ||
- xcode: 14.2 | ||
runtime: "iOS 13.7" | ||
device: "iPhone 6s" | ||
- xcode: 14.2 | ||
runtime: "iOS 14.5" | ||
device: "iPhone 8 Plus" | ||
- xcode: 14.2 | ||
runtime: "iOS 15.4" | ||
device: "iPhone 12 mini" | ||
- xcode: 14.2 | ||
runtime: "iOS 16.2" | ||
device: "iPhone 14 Pro Max" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: "Select Xcode ${{ matrix.env.xcode }}" | ||
uses: ./.github/actions/xcode-select | ||
with: | ||
version: ${{ matrix.env.xcode }} | ||
- name: "Cache downloaded simulator runtimes" | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/Library/Caches/XcodeInstall/*.dmg | ||
key: Xcode ${{ matrix.env.xcode }}+${{ matrix.env.runtime }} | ||
- name: "Prepare simulator" | ||
id: prepare-simulator | ||
uses: ./.github/actions/prepare-simulator | ||
with: | ||
runtime: ${{ matrix.env.runtime }} | ||
device: ${{ matrix.env.device }} | ||
- name: "Build and test" | ||
run: | | ||
set -o pipefail | ||
xcodebuild test -workspace "Authenticator.xcworkspace" -scheme "Authenticator" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c | ||
- uses: sersoft-gmbh/swift-coverage-action@v3 | ||
with: | ||
target-name-filter: ^Authenticator$ | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
fail_ci_if_error: true |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.