OpenMetadata/.github/workflows/java-playwright-pr.yml
mohitdeuex a0e501ba11 Add openmetadata-java-playwright scenario test module
Phase 1 of EPIC #3731: Java-driven E2E scenarios for reindex + UI tests.
Reuses TestSuiteBootstrap as a test-jar dependency. Three execution modes:
- embedded (in-JVM, fast, backend-only)
- containerized (Testcontainers + prod server image, UI capable)
- external (connect to a running stack)

Includes 3 backend reindex scenarios (full / incremental / orphan cleanup),
1 Playwright UI scenario (search-after-reindex in Explore), and 2 CI
workflows (PR path-filter + nightly cron).

Satisfies #3767 and #3792.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 22:16:51 +05:30

155 lines
5.6 KiB
YAML

# Copyright 2026 Collate
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Runs the Java Playwright scenario suite (embedded mode, fast subset) on PRs that
# touch reindex / search / spec / the suite itself, when manually dispatched, or when
# a PR is labelled `run-java-playwright`.
#
# The full suite (external mode, ES+OS matrix, distributed + crash recovery) runs
# in java-playwright-nightly.yml.
name: Java Playwright (Embedded, PR)
on:
merge_group:
workflow_dispatch:
pull_request_target:
types: [labeled, opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
checks: write
concurrency:
group: java-playwright-pr-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
changes:
name: Detect Changes
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
outputs:
should_run: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.matched || steps.label.outputs.has_label }}
steps:
- uses: dorny/paths-filter@v3
id: filter
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
filters: |
matched:
- 'openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/**'
- 'openmetadata-service/src/main/java/org/openmetadata/service/search/**'
- 'openmetadata-service/src/main/resources/elasticsearch/**'
- 'openmetadata-spec/src/main/resources/json/schema/**'
- 'openmetadata-java-playwright/**'
- 'openmetadata-integration-tests/src/test/java/org/openmetadata/it/bootstrap/**'
- 'openmetadata-sdk/src/main/java/org/openmetadata/sdk/services/search/**'
- 'pom.xml'
- id: label
if: ${{ github.event_name == 'pull_request_target' }}
run: |
if echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | grep -q 'run-java-playwright'; then
echo "has_label=true" >> "$GITHUB_OUTPUT"
else
echo "has_label=false" >> "$GITHUB_OUTPUT"
fi
java-playwright-embedded:
needs: changes
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.should_run == 'true' }}
timeout-minutes: 35
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Verify PR labels
uses: jesusvasquez333/verify-pr-label-action@v1.4.0
if: ${{ github.event_name == 'pull_request_target' }}
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
valid-labels: 'safe to test'
pull-request-number: '${{ github.event.pull_request.number }}'
disable-reviews: true
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'merge_group' && github.sha || github.event.pull_request.head.sha }}
- name: Cache Maven dependencies
id: cache-output
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Build dependencies for Java Playwright module
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -DskipTests clean install -pl :openmetadata-java-playwright -am
- name: Install Playwright browsers
run: |
mvn -pl :openmetadata-java-playwright dependency:build-classpath -Dmdep.outputFile=/tmp/cp.txt -q
java -cp "$(cat /tmp/cp.txt)" com.microsoft.playwright.CLI install --with-deps chromium
- name: Free build artifacts
run: |
rm -rf openmetadata-service/target/lib openmetadata-service/target/classes
rm -rf openmetadata-spec/target openmetadata-sdk/target common/target
rm -rf openmetadata-shaded-deps/*/target
df -h /
- name: Run Java Playwright scenarios (embedded, OpenSearch)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JPW_MODE: embedded
run: mvn verify -pl :openmetadata-java-playwright
- name: Upload Playwright traces (on failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: playwright-traces-${{ github.run_id }}
path: openmetadata-java-playwright/target/playwright-traces
if-no-files-found: ignore
retention-days: 7
- name: Publish Test Report
if: ${{ always() }}
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_test_failures: true
report_paths: 'openmetadata-java-playwright/target/failsafe-reports/TEST-*.xml'