-
Notifications
You must be signed in to change notification settings - Fork 4
119 lines (100 loc) · 3.83 KB
/
ui-tests.yml
File metadata and controls
119 lines (100 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: UI Tests
on:
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
ui-test:
strategy:
# Keep running the other platforms even if one fails so we get full signal
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# Pre-download IDE and build plugin so the background launch is fast and doesn't fail silently.
- name: Build plugin and prepare sandbox
run: ./gradlew prepareSandbox_runIdeForUiTests
# Linux runners need a virtual display AND GUI toolkit libraries for the IDE to render.
- name: Install display dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y xvfb libxrender1 libxtst6 libxi6 libxrandr2 libfreetype6 fontconfig
Xvfb :99 -screen 0 1920x1080x24 &
sleep 2
echo "DISPLAY=:99" >> "$GITHUB_ENV"
- name: Clean up test module (pre-test)
run: rm -rf src/uiTest/testProject/repository
shell: bash
# Run IDE + tests in a single step so the backgrounded IDE process stays alive.
- name: Start IDE, wait for robot server, and run UI tests
shell: bash
env:
DISPLAY: ${{ env.DISPLAY }}
run: |
echo "Starting IDE with robot server..."
./gradlew runIdeForUiTests > ide-output.log 2>&1 &
IDE_PID=$!
echo "IDE PID: $IDE_PID"
# Poll until the robot server port accepts connections.
# curl without -f returns 0 for ANY HTTP response (even 404), which is fine —
# we just need to know the server is listening. curl is available on all
# GitHub Actions runners (Linux, macOS, Windows).
echo "Waiting for robot server on port 8082..."
MAX_WAIT=90
ATTEMPT=0
until curl -s --connect-timeout 2 -o /dev/null http://127.0.0.1:8082/; do
ATTEMPT=$((ATTEMPT + 1))
if [ "$ATTEMPT" -ge "$MAX_WAIT" ]; then
echo "ERROR: robot server did not start after $((MAX_WAIT * 5)) seconds"
echo "=== IDE output (last 200 lines) ==="
tail -200 ide-output.log 2>/dev/null || true
exit 1
fi
echo " attempt $ATTEMPT/$MAX_WAIT — not ready yet, retrying in 5s..."
sleep 5
done
echo "Robot server is ready!"
# Run the UI tests
./gradlew uiTest || TEST_EXIT=$?
echo "=== IDE output (last 50 lines) ==="
tail -50 ide-output.log 2>/dev/null || true
exit ${TEST_EXIT:-0}
- name: Clean up test module (post-test)
if: always()
run: |
rm -rf src/uiTest/testProject/repository
git checkout -- src/uiTest/testProject/settings.gradle.kts
shell: bash
- name: Upload IDE output log
if: always()
uses: actions/upload-artifact@v4
with:
name: ide-output-${{ matrix.os }}
path: ide-output.log
if-no-files-found: ignore
- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: ui-test-results-${{ matrix.os }}
path: build/reports/tests/uiTest/
if-no-files-found: ignore
# Upload IDE logs to help diagnose failures
- name: Upload IDE logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ide-logs-${{ matrix.os }}
path: build/idea-sandbox/system/log/
if-no-files-found: ignore