From 5fac7abb9a00a439783f99a07ae631ea6e594f78 Mon Sep 17 00:00:00 2001 From: Mathijs Bernson Date: Mon, 13 May 2024 11:22:34 +0200 Subject: [PATCH] Split testing up into build and run steps --- .github/workflows/test.yml | 22 ++++++++++++++----- .../xcshareddata/swiftpm/Package.resolved | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fce0e58..64d2c31 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,19 +38,31 @@ jobs: -resolvePackageDependencies \ -clonedSourcePackagesDirPath "${{ runner.temp }}/SourcePackages" + - name: Determine test device + run: | + echo "PLATFORM=iOS Simulator" >> "$GITHUB_ENV" + # xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) + echo "DEVICE=$(xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//")" >> "$GITHUB_ENV" + + - name: Build for testing + env: + PLATFORM: ${{ 'iOS Simulator' }} + run: | + xcodebuild build-for-testing -project "${{ env.XCODE_PROJECT }}" \ + -scheme "${{ env.SCHEME }}" \ + -destination "platform=$PLATFORM,name=$DEVICE" \ + -clonedSourcePackagesDirPath "${{ runner.temp }}/SourcePackages" \ + -disableAutomaticPackageResolution + - name: Run tests env: PLATFORM: ${{ 'iOS Simulator' }} run: | - # xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959) - DEVICE=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"` - xcodebuild test -project "${{ env.XCODE_PROJECT }}" \ + xcodebuild test-without-building -project "${{ env.XCODE_PROJECT }}" \ -scheme "${{ env.SCHEME }}" \ -testPlan "${{ env.TEST_PLAN }}" \ -destination "platform=$PLATFORM,name=$DEVICE" \ -resultBundlePath "${{ env.TEST_RESULT_BUNDLE }}" \ - -clonedSourcePackagesDirPath "${{ runner.temp }}/SourcePackages" \ - -disableAutomaticPackageResolution - name: Upload test result bundle uses: actions/upload-artifact@v4 diff --git a/TemplateApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/TemplateApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index bbc553b..1ea8608 100644 --- a/TemplateApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/TemplateApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "df61673358a3dd22a0a9edeab8644d322d2a83e7c60f21b1fb5968be13760d2c", + "originHash" : "7f5d67830751eed43216e3b2c4a63415b54e9f0b67f3d3f4d7fb12143114915a", "pins" : [ { "identity" : "factory",