Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ on:
jobs:
parallel-testing:
name: Cloned simulator
runs-on: self-hosted
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: latest-stable
- name: Build & Test
run: |
make test-parallel
Expand Down Expand Up @@ -41,15 +44,18 @@ jobs:
# path: Client/logfile.txt
single-device-testing:
name: Normal simulator
runs-on: self-hosted
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: latest-stable
- name: Build & Test
timeout-minutes: 20
run: |
#run UIUnitTest server
make test
make test.ci
# - name: Archive cli logs
# if: always()
# uses: actions/upload-artifact@v3
Expand Down
20 changes: 17 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,34 @@ test:
set -o pipefail && xcodebuild -project Client/Client.xcodeproj \
-scheme Client \
test \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.2' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Extract simulator destination string to a variable.
The -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.2' flag is duplicated across targets. Define at the top, e.g.:

SIM_DEST = platform=iOS Simulator,name=iPhone 16,OS=18.2

and then use -destination '$(SIM_DEST)' \.

🤖 Prompt for AI Agents
In the makefile at line 10, the simulator destination string is hardcoded and
duplicated across targets. To fix this, define a variable SIM_DEST at the top of
the makefile with the value platform=iOS Simulator,name=iPhone 16,OS=18.2, then
replace all occurrences of -destination 'platform=iOS Simulator,name=iPhone
16,OS=18.2' with -destination '$(SIM_DEST)' to avoid duplication and improve
maintainability.

-resultBundlePath test-result.xcresult \
-derivedDataPath 'derivedData' \
-clonedSourcePackagesDirPath SourcePackages \
-disableAutomaticPackageResolution | xcbeautify --report junit

.PHONY: test.ci
test.ci:
$(MAKE) clean-up
$(MAKE) generate-zip
set -o pipefail && xcodebuild -project Client/Client.xcodeproj \
-scheme Client \
test \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.2' \
-resultBundlePath test-result.xcresult \
-derivedDataPath 'derivedData' \
-clonedSourcePackagesDirPath SourcePackages \
-disableAutomaticPackageResolution | xcbeautify --report junit
Comment on lines +16 to +27
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

DRY up test vs test.ci targets.
Both targets invoke the same xcodebuild command. Consider having test.ci depend on test or extracting shared steps into a helper target to avoid drift.

🤖 Prompt for AI Agents
In the makefile around lines 16 to 27, the test.ci and test targets both run the
same xcodebuild command, causing duplication. Refactor by extracting the common
xcodebuild command into a separate helper target, then have both test and
test.ci depend on that helper. Alternatively, make test.ci depend on test and
only add the extra steps unique to test.ci in its target to avoid code
duplication and ensure consistency.



.PHONY: test-parallel
test-parallel:
$(MAKE) clean-up
$(MAKE) generate-zip
NSUnbufferedIO=YES xcodebuild -project Client/Client.xcodeproj \
-scheme "ClientTests - Parallel" \
test \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.2' \
-resultBundlePath test-result.xcresult \
-clonedSourcePackagesDirPath SourcePackages \
-disableAutomaticPackageResolution \
Expand All @@ -35,7 +49,7 @@ generate-zip:
(cd $(root)/Server/ && zip -r $(root)/Lib/Sources/UIUnitTestCLI/resources/Server.zip *) || exit 1
xcodebuild -project ./Server/Server.xcodeproj \
-scheme ServerUITests -sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.0" \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.2" \
-IDEBuildLocationStyle=Custom \
-IDECustomBuildLocationType=Absolute \
-IDECustomBuildProductsPath="$(root)/build/Products" \
Expand Down
Loading