Skip to content

Commit fdb337a

Browse files
committed
Create IOS test
1 parent 924969f commit fdb337a

File tree

1 file changed

+35
-49
lines changed

1 file changed

+35
-49
lines changed

.github/workflows/macos.yml

+35-49
Original file line numberDiff line numberDiff line change
@@ -7,66 +7,52 @@ jobs:
77
runs-on: macos-15-xlarge
88
strategy:
99
matrix:
10-
test_command:
11-
- "sysbench cpu run --cpu-max-prime=1000000 --threads=1 --events=1000000000"
12-
- "sysbench cpu run --cpu-max-prime=10000000 --threads=$(sysctl -n hw.ncpu) --events=1000000000"
13-
- "sysbench memory run --memory-block-size=1M --memory-total-size=20000G --threads=1"
14-
- "sysbench memory run --memory-block-size=1M --memory-total-size=60000G --threads=$(sysctl -n hw.ncpu)"
15-
- "fio --name=write_test --rw=write --bs=4k --size=700M --numjobs=$(sysctl -n hw.ncpu)"
16-
- "fio --name=read_test --rw=read --bs=4k --size=2G --numjobs=$(sysctl -n hw.ncpu)"
10+
xcode: [ 16.2, 16.1 ]
11+
1712
steps:
18-
19-
# - name: Checkout repository
20-
# uses: actions/checkout@v4
13+
- uses: maxim-lobanov/setup-xcode@v1
14+
with:
15+
xcode-version: "${{ matrix.xcode }}"
16+
- name: Debug
17+
run: |
18+
xcrun simctl list runtimes
19+
xcrun simctl list devicetypes
20+
- name: Start iOS Simulator
21+
run: |
22+
DEVICE_NAME="iPhone-16-Pro"
23+
OS_VERSION=$(xcrun simctl list runtimes | grep -Eo 'com.apple.CoreSimulator.SimRuntime.iOS-18-[0-9]+' | tail -1)
24+
UDID=$(xcrun simctl create "TestDevice" "com.apple.CoreSimulator.SimDeviceType.$DEVICE_NAME" "$OS_VERSION")
25+
echo "Simulator UDID: $UDID"
2126
22-
- name: Pre-check system state
27+
echo "=== Booting Simulator ==="
28+
start_time=$(date +%s)
29+
xcrun simctl boot "$UDID"
30+
end_time=$(date +%s)
31+
mkdir -p logs
32+
echo "Boot time: $((end_time - start_time)) seconds" | tee -a logs/performance.txt
33+
34+
- name: Check Simulator State
2335
run: |
24-
echo "============ Initial System State ============"
25-
echo "========= Running Processes ========="
26-
ps aux
27-
echo "========= Disk Usage ========="
28-
df -h
29-
echo "========= Memory Usage ========="
30-
vm_stat
31-
echo "========= System Load ========="
32-
uptime
36+
echo "=== Simulator Status ===" > logs/simulator_status.txt
37+
xcrun simctl list devices | grep "TestDevice" >> logs/simulator_status.txt
3338
34-
- name: Run test command multiple times
39+
- name: Take Screenshot
3540
run: |
36-
brew install sysbench fio
37-
for i in {1..10}; do
38-
echo "Iteration $i: Running command: ${{ matrix.test_command }}"
39-
eval "${{ matrix.test_command }}"
40-
done
41+
echo "=== Taking Screenshot ==="
42+
start_time=$(date +%s)
43+
xcrun simctl io booted screenshot logs/screenshot.png
44+
end_time=$(date +%s)
45+
echo "Screenshot time: $((end_time - start_time)) seconds" | tee -a logs/performance.txt
4146
42-
- name: Collect system logs
47+
- name: Collect logs
4348
if: always()
4449
run: |
45-
mkdir -p logs
46-
echo "========= System Information =========" > logs/system_info.txt
47-
system_profiler SPSoftwareDataType >> logs/system_info.txt
48-
49-
echo "========= Disk Usage =========" >> logs/system_info.txt
50-
df -h >> logs/system_info.txt
51-
52-
echo "========= Memory Usage =========" >> logs/system_info.txt
53-
vm_stat >> logs/system_info.txt
54-
55-
echo "========= System Load =========" >> logs/system_info.txt
56-
uptime >> logs/system_info.txt
57-
58-
echo "========= Running Processes =========" >> logs/system_info.txt
59-
ps aux >> logs/system_info.txt
60-
61-
echo "========= GitHub Actions Runner Logs =========" > logs/runner_logs.txt
62-
cat /Users/runner/Library/Logs/github-actions/* >> logs/runner_logs.txt 2>/dev/null || echo "No runner logs found"
63-
64-
echo "========= System Logs =========" > logs/system_logs.txt
65-
log show --last 30m > logs/system_logs.txt || echo "Failed to collect system logs"
50+
echo "=== Simulator Logs ===" > logs/simulator_logs.txt
51+
xcrun simctl spawn booted log stream --style syslog --predicate 'subsystem == "com.apple.CoreSimulator"' -timeout 10 >> logs/simulator_logs.txt || echo "No simulator logs found"
6652
6753
- name: Upload logs
6854
if: always()
6955
uses: actions/upload-artifact@v4
7056
with:
71-
name: macos-troubleshooting-logs-${{ matrix.test_command }}
57+
name: ios-simulator-performance-logs-${{ matrix.xcode }}
7258
path: logs/

0 commit comments

Comments
 (0)