Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,48 @@ on:
jobs:
test:
runs-on: macOS-latest

env:
SCHEME: WeakMapTable
CODECOV_PACKAGE_NAME: WeakMapTable

strategy:
fail-fast: false
matrix:
env:
- sdk: iphonesimulator
destination: platform=iOS Simulator,name=iPhone 12 Pro,OS=latest

- sdk: macosx
destination: arch=x86_64

- sdk: appletvsimulator
destination: platform=tvOS Simulator,name=Apple TV,OS=latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: List SDKs and Devices
run: xcodebuild -showsdks; xcrun xctrace list devices

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Select iOS Simulator dynamically
if: matrix.env.sdk == 'iphonesimulator'
run: |
OS_VERSION=$(xcrun simctl list runtimes | grep 'iOS' | grep -oE '[0-9]+\.[0-9]+' | sort -Vr | head -n1)
DEVICE_NAME=$(xcrun simctl list devices | grep -A 20 "^-- iOS $OS_VERSION --" | grep -E '^ *iPhone [0-9]+ \(' | grep -v 'Pro\|Plus\|SE\|unavailable' | sed -E 's/^[[:space:]]*([^()]+) \(.*/\1/' | sort -t' ' -k2 -n -r | head -n1)
echo "Using simulator: $DEVICE_NAME (iOS $OS_VERSION)"
echo "DESTINATION=platform=iOS Simulator,name=$DEVICE_NAME,OS=$OS_VERSION" >> $GITHUB_ENV

- name: Select Xcode 12.4
run: sudo xcode-select -s /Applications/Xcode_12.4.app
- name: Set macOS destination
if: matrix.env.sdk == 'macosx'
run: echo "DESTINATION=arch=x86_64" >> $GITHUB_ENV

- name: Generate Xcode Project
run: swift package generate-xcodeproj --enable-code-coverage
- name: Set tvOS destination
if: matrix.env.sdk == 'appletvsimulator'
run: echo "DESTINATION=platform=tvOS Simulator,name=Apple TV,OS=latest" >> $GITHUB_ENV

- name: Build and Test
run: |
set -o pipefail && xcodebuild clean build test \
-project "$PROJECT" \
set -o pipefail && xcodebuild build test \
-scheme "$SCHEME" \
-sdk "$SDK" \
-destination "$DESTINATION" \
Expand All @@ -42,10 +59,8 @@ jobs:
-resultBundlePath "./${{ matrix.env.sdk }}.xcresult" \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty -c;
env:
PROJECT: WeakMapTable.xcodeproj
SCHEME: WeakMapTable-Package
SDK: ${{ matrix.env.sdk }}
DESTINATION: ${{ matrix.env.destination }}
DESTINATION: ${{ env.DESTINATION }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.0
Expand Down