diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8719da3..71696b78 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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 diff --git a/simulator-find.sh b/simulator-find.sh new file mode 100755 index 00000000..d8a7bedf --- /dev/null +++ b/simulator-find.sh @@ -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