Skip to content

Commit

Permalink
Xcode 15 Simulator build
Browse files Browse the repository at this point in the history
  • Loading branch information
swhitty committed Sep 4, 2023
1 parent ed86fc6 commit 14ce69f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 93 deletions.
103 changes: 10 additions & 93 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

jobs:
xcode_14_3:
xcode_14_3_simulator:
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer
Expand All @@ -15,18 +15,14 @@ jobs:
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: '📱 Find Simulator'
run: ./simulator-find.sh 16.4 'iPhone 14 Pro'
- name: Build
run: swift test --enable-code-coverage --filter do_not_test
run: xcodebuild -scheme FlyingFox-Package -sdk iphonesimulator17.0 -destination '${{env.XCODE_DESTINATION}}' -derivedDataPath build-for-testing
- name: Test
run: swift test --enable-code-coverage --skip-build
- name: Gather code coverage
run: xcrun llvm-cov export -format="lcov" .build/debug/FlyingFoxPackageTests.xctest/Contents/MacOS/FlyingFoxPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage_report.lcov
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage_report.lcov
run: xcodebuild -scheme FlyingFox-Package -sdk iphonesimulator17.0 -destination '${{env.XCODE_DESTINATION}}' -derivedDataPath test-without-building

xcode_15_0:
xcode_15_0_simulator:
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
Expand All @@ -35,88 +31,9 @@ jobs:
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: '📱 Find Simulator'
run: ./simulator-find.sh 17.0 'iPhone 14 Pro'
- name: Build
run: swift build --build-tests
run: xcodebuild -scheme FlyingFox-Package -sdk iphonesimulator17.0 -destination '${{env.XCODE_DESTINATION}}' -derivedDataPath build-for-testing
- name: Test
run: swift test --skip-build

xcode_14_2:
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: Build
run: swift build --build-tests
- name: Test
run: swift test --skip-build

xcode_13_4:
runs-on: macos-12
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: Build
run: swift build --build-tests
- name: Test
run: swift test --skip-build

xcode_13_2_1:
runs-on: macos-11
env:
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: Build
run: swift build --build-tests
- name: Test
run: swift test --skip-build

linux_swift_5_6_3:
runs-on: ubuntu-latest
container: swift:5.6.3
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: Build
run: swift build --build-tests
- name: Test
run: swift test --skip-build

linux_swift_5_7:
runs-on: ubuntu-latest
container: swift:5.7
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: Build
run: swift build --build-tests
- name: Test
run: swift test --skip-build

linux_swift_5_8:
runs-on: ubuntu-latest
container: swift:5.8
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
run: swift --version
- name: Build
run: swift build --build-tests
- name: Test
run: swift test --skip-build
run: xcodebuild -scheme FlyingFox-Package -sdk iphonesimulator17.0 -destination '${{env.XCODE_DESTINATION}}' -derivedDataPath test-without-building
40 changes: 40 additions & 0 deletions simulator-find.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -eu

if [ -z ${1+x} ]; then
echo "Supply SDK version to script. % ./simulator-find.sh 16.4 'iPhone 14 Pro'"
exit 1
fi

if [ -z ${2+x} ]; then
echo "Supply device to script. % ./simulator-find.sh 16.4 'iPhone 14 Pro'"
exit 1
fi

SDK_VERSION=$1
DEVICE=$2

echo "List All Devices"
CMD_SIMULATOR="xcrun simctl list"
echo $CMD_SIMULATOR
eval $CMD_SIMULATOR

CMD_SIMULATOR="xcrun simctl list devices 'iOS $SDK_VERSION' | grep '$DEVICE' | grep -E -o -m 1 -i '([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})'"
echo $CMD_SIMULATOR

set +e # attempt to boot ignoring errors
SIMULATOR_ID=$(eval ${CMD_SIMULATOR})
set -e # restore fail on errors

if [ -z "$SIMULATOR_ID" ]
then
echo "Cannot find simulator matching iOS $SDK_VERSION $DEVICE"
exit 1
fi

export XCODE_SIMULATOR_ID=$SIMULATOR_ID
export XCODE_DESTINATION="platform=iOS Simulator,id=$XCODE_SIMULATOR_ID"
echo "Found Simulator ${XCODE_SIMULATOR_ID}"

echo "XCODE_DESTINATION=$XCODE_DESTINATION" >> $GITHUB_ENV

0 comments on commit 14ce69f

Please sign in to comment.