mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2025-12-05 14:21:55 +00:00
143 lines
4.4 KiB
YAML
143 lines
4.4 KiB
YAML
# GitHub Actions Workflow for launching UI tests on Linux and Mac in the following steps:
|
|
# - Prepare and launch IDE with your plugin and robot-server plugin, which is necessary to interact with the UI.
|
|
# - Wait for IDE to start
|
|
# - Run UI tests with a separate Gradle task.
|
|
#
|
|
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform.
|
|
#
|
|
# Workflow is triggered manually.
|
|
|
|
name: Run UI Tests
|
|
on:
|
|
workflow_dispatch
|
|
|
|
jobs:
|
|
# UI Test Jobs (one per OS/test combination)
|
|
testUI:
|
|
name: Run UI Test on ${{ matrix.osName }}
|
|
runs-on: ${{ matrix.runner }}
|
|
permissions:
|
|
contents: write
|
|
checks: write
|
|
pull-requests: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Linux test
|
|
- runner: ubuntu-latest
|
|
osName: Linux
|
|
# macOS test
|
|
- runner: macos-latest
|
|
osName: macOS
|
|
|
|
steps:
|
|
- name: Fetch Sources
|
|
uses: actions/checkout@v5
|
|
|
|
# Set up the Java environment for the next steps
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: zulu
|
|
java-version: 21
|
|
|
|
# Setup Gradle
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4.2.2
|
|
with:
|
|
cache-read-only: true
|
|
|
|
# Set up Xvfb for Linux headless mode
|
|
- name: Setup Xvfb for Linux
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y xvfb x11-utils libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
|
|
export DISPLAY=:99.0
|
|
Xvfb -ac :99 -screen 0 1920x1080x16 &
|
|
sleep 3
|
|
echo "DISPLAY=:99.0" >> $GITHUB_ENV
|
|
|
|
# Run UI test with IDE Starter framework
|
|
- name: Run UI Test
|
|
env:
|
|
CODECOV_API_TOKEN: ${{ secrets.CODECOV_API_TOKEN }}
|
|
LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
|
|
UI_BRANCH_NAME: "${{ matrix.osName }}-${{ github.ref_name }}"
|
|
DISPLAY: ${{ runner.os == 'Linux' && ':99.0' || '' }}
|
|
run: |
|
|
echo "UI on ${{ matrix.osName }} run #: ${{ github.run_number }} and id: ${{ github.run_id }}"
|
|
./gradlew uiTest
|
|
timeout-minutes: 30
|
|
|
|
# List build directory for debugging
|
|
- name: List build directory structure
|
|
if: always()
|
|
shell: bash
|
|
run: |
|
|
echo "=== Build directory structure ==="
|
|
if [ -d "build" ]; then
|
|
find build -type d -name "log" -o -name "screenshots" -o -name "ui-hierarchy" 2>/dev/null | head -20 || true
|
|
echo "=== Looking for IDE test output ==="
|
|
find build -type d -path "*/ide-tests/*" 2>/dev/null | head -20 || true
|
|
else
|
|
echo "Build directory not found"
|
|
fi
|
|
|
|
- name: Collect Test Results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4.6.2
|
|
with:
|
|
name: tests-result-${{ matrix.osName }}
|
|
path: |
|
|
build/reports/
|
|
build/test-results/
|
|
build/out/
|
|
build/idea-sandbox/
|
|
build/**/*.log
|
|
build/**/screenshots/
|
|
build/**/ui-hierarchy/
|
|
if-no-files-found: warn
|
|
continue-on-error: true
|
|
|
|
- name: Collect Test Report XML
|
|
if: always()
|
|
uses: actions/upload-artifact@v4.6.2
|
|
with:
|
|
name: test-report-${{ matrix.osName }}
|
|
path: ${{ github.workspace }}/build/test-results/uiTest/*.xml
|
|
|
|
# Test report job using dorny/test-reporter
|
|
test-report:
|
|
name: UI Test Report
|
|
needs: testUI
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
permissions:
|
|
contents: write
|
|
checks: write
|
|
pull-requests: write
|
|
actions: read
|
|
|
|
steps:
|
|
- name: Fetch Sources
|
|
uses: actions/checkout@v5
|
|
with:
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
- name: Download all test reports
|
|
uses: actions/download-artifact@v5.0.0
|
|
with:
|
|
pattern: test-report-*
|
|
path: test-reports
|
|
merge-multiple: true
|
|
|
|
- name: Generate Test Report
|
|
uses: dorny/test-reporter@v2.1.1
|
|
if: success() || failure()
|
|
with:
|
|
name: UI Test Report Dashboard
|
|
reporter: java-junit
|
|
fail-on-error: 'true'
|
|
path: 'test-reports/*.xml' |