OpenMetadata/.github/workflows/java-playwright-pr.yml
2026-05-19 14:01:41 +05:30

193 lines
7.3 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 full *UIIT.java suite (containerized OM via ui-it profile, OpenSearch only)
# on PRs that touch reindex / search / spec / the suite itself, when manually dispatched,
# or when a PR is labelled `run-java-playwright`.
#
# The nightly variant adds the ES + OS matrix and runs against main.
name: Java Playwright (UIIT, 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-integration-tests/src/test/java/org/openmetadata/playwright/**'
- 'openmetadata-integration-tests/src/test/java/org/openmetadata/it/**'
- 'openmetadata-integration-tests/pom.xml'
- '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-uiit:
needs: changes
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.should_run == 'true' }}
timeout-minutes: 60
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: Add /etc/hosts entry for mock OIDC server
# SSO UIITs need `om-mock-idp` to resolve to loopback both inside the Docker
# network and from the host-side Playwright browser, so token `iss` claims
# match across actors.
run: echo "127.0.0.1 om-mock-idp" | sudo tee -a /etc/hosts
- name: Build dependencies for integration-tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -DskipTests clean install -pl :openmetadata-integration-tests -am
- name: Install Playwright browsers
run: |
mvn -pl :openmetadata-integration-tests 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 UI integration tests (OpenSearch)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ui-it profile already defaults PW_VIDEO=true; reaffirmed here so a quick
# workflow read tells you videos are being captured.
PW_VIDEO: 'true'
run: mvn verify -P ui-it -pl :openmetadata-integration-tests
- name: Upload Playwright traces (on failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: playwright-traces-${{ github.run_id }}
path: openmetadata-integration-tests/target/playwright-traces
if-no-files-found: ignore
retention-days: 7
- name: Upload Playwright videos (on failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: playwright-videos-${{ github.run_id }}
path: openmetadata-integration-tests/target/playwright-videos
if-no-files-found: ignore
retention-days: 7
- name: Upload Failsafe Reports (on failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: failsafe-reports-${{ github.run_id }}
path: openmetadata-integration-tests/target/failsafe-reports
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-integration-tests/target/failsafe-reports/TEST-*.xml'
- name: Slack on Failure
if: ${{ failure() }}
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"text": ":fire: Java Playwright PR run failed\nPR: ${{ github.event.pull_request.html_url || github.ref_name }}\nLogs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.E2E_SLACK_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK