From b09b13e85019eb44ddb4ac84d7172122e814d37c Mon Sep 17 00:00:00 2001 From: Young Liu Date: Mon, 5 Jan 2026 16:38:44 +0800 Subject: [PATCH] fix(ci): correct xcodebuild command and remove incorrect swift build workflow --- .github/workflows/ios.yml | 26 ++++++++++++++------------ .github/workflows/swift.yml | 22 ---------------------- 2 files changed, 14 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 2eb2804..48724e1 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -27,20 +27,22 @@ jobs: scheme: ${{ 'default' }} 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$//"` - if [ $scheme = default ]; then scheme=$(cat default); fi - if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi - file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` - xcodebuild build-for-testing -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device" + device=$(xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//") + scheme_to_build=$(cat default) + workspace_path="Arithmetic.xcodeproj/project.xcworkspace" + + echo "Building workspace '$workspace_path' with scheme '$scheme_to_build' on device '$device'" + + xcodebuild build-for-testing -scheme "$scheme_to_build" -workspace "$workspace_path" -destination "platform=$platform,name=$device" - name: Test env: scheme: ${{ 'default' }} 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$//"` - if [ $scheme = default ]; then scheme=$(cat default); fi - if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi - file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` - xcodebuild test-without-building -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device" + device=$(xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//") + scheme_to_test=$(cat default) + workspace_path="Arithmetic.xcodeproj/project.xcworkspace" + + echo "Testing workspace '$workspace_path' with scheme '$scheme_to_test' on device '$device'" + + xcodebuild test-without-building -scheme "$scheme_to_test" -workspace "$workspace_path" -destination "platform=$platform,name=$device" diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml deleted file mode 100644 index 21ae770..0000000 --- a/.github/workflows/swift.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will build a Swift project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift - -name: Swift - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - name: Build - run: swift build -v - - name: Run tests - run: swift test -v