|
9 | 9 | jobs:
|
10 | 10 | test:
|
11 | 11 | runs-on: macOS-latest
|
| 12 | + |
| 13 | + env: |
| 14 | + SCHEME: WeakMapTable |
| 15 | + CODECOV_PACKAGE_NAME: WeakMapTable |
| 16 | + |
12 | 17 | strategy:
|
| 18 | + fail-fast: false |
13 | 19 | matrix:
|
14 | 20 | env:
|
15 | 21 | - sdk: iphonesimulator
|
16 |
| - destination: platform=iOS Simulator,name=iPhone 12 Pro,OS=latest |
17 |
| - |
18 | 22 | - sdk: macosx
|
19 |
| - destination: arch=x86_64 |
20 |
| - |
21 | 23 | - sdk: appletvsimulator
|
22 |
| - destination: platform=tvOS Simulator,name=Apple TV,OS=latest |
23 | 24 |
|
24 | 25 | steps:
|
25 |
| - - uses: actions/checkout@v2 |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: List SDKs and Devices |
| 29 | + run: xcodebuild -showsdks; xcrun xctrace list devices |
| 30 | + |
| 31 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 32 | + with: |
| 33 | + xcode-version: latest-stable |
| 34 | + |
| 35 | + - name: Select iOS Simulator dynamically |
| 36 | + if: matrix.env.sdk == 'iphonesimulator' |
| 37 | + run: | |
| 38 | + OS_VERSION=$(xcrun simctl list runtimes | grep 'iOS' | grep -oE '[0-9]+\.[0-9]+' | sort -Vr | head -n1) |
| 39 | + 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) |
| 40 | + echo "Using simulator: $DEVICE_NAME (iOS $OS_VERSION)" |
| 41 | + echo "DESTINATION=platform=iOS Simulator,name=$DEVICE_NAME,OS=$OS_VERSION" >> $GITHUB_ENV |
26 | 42 |
|
27 |
| - - name: Select Xcode 12.4 |
28 |
| - run: sudo xcode-select -s /Applications/Xcode_12.4.app |
| 43 | + - name: Set macOS destination |
| 44 | + if: matrix.env.sdk == 'macosx' |
| 45 | + run: echo "DESTINATION=arch=x86_64" >> $GITHUB_ENV |
29 | 46 |
|
30 |
| - - name: Generate Xcode Project |
31 |
| - run: swift package generate-xcodeproj --enable-code-coverage |
| 47 | + - name: Set tvOS destination |
| 48 | + if: matrix.env.sdk == 'appletvsimulator' |
| 49 | + run: echo "DESTINATION=platform=tvOS Simulator,name=Apple TV,OS=latest" >> $GITHUB_ENV |
32 | 50 |
|
33 | 51 | - name: Build and Test
|
34 | 52 | run: |
|
35 |
| - set -o pipefail && xcodebuild clean build test \ |
36 |
| - -project "$PROJECT" \ |
| 53 | + set -o pipefail && xcodebuild build test \ |
37 | 54 | -scheme "$SCHEME" \
|
38 | 55 | -sdk "$SDK" \
|
39 | 56 | -destination "$DESTINATION" \
|
|
42 | 59 | -resultBundlePath "./${{ matrix.env.sdk }}.xcresult" \
|
43 | 60 | CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty -c;
|
44 | 61 | env:
|
45 |
| - PROJECT: WeakMapTable.xcodeproj |
46 |
| - SCHEME: WeakMapTable-Package |
47 | 62 | SDK: ${{ matrix.env.sdk }}
|
48 |
| - DESTINATION: ${{ matrix.env.destination }} |
| 63 | + DESTINATION: ${{ env.DESTINATION }} |
49 | 64 |
|
50 | 65 | - name: Upload coverage to Codecov
|
51 | 66 |
|
|
0 commit comments