Skip to content

feat(ui): move AI-assistant shell + shared routes into OSS app-mode framework #30645

feat(ui): move AI-assistant shell + shared routes into OSS app-mode framework

feat(ui): move AI-assistant shell + shared routes into OSS app-mode framework #30645

# Copyright 2021 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.
name: OpenMetadata Service Unit Tests
on:
merge_group:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [labeled, opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
checks: write
pull-requests: write
concurrency:
group: openmetadata-service-unit-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name != 'pull_request' || github.event.action != 'labeled' || (github.event.label.name == 'safe to test' && github.event.pull_request.head.repo.full_name != github.repository) }}
jobs:
# Detect whether relevant paths changed. When no Java service files
# are modified the downstream jobs are skipped via their `if` condition.
# A job skipped by `if` reports as "Success", so required checks still pass.
# This replaces the old openmetadata-service-unit-tests-skip.yml companion workflow.
changes:
name: Detect Changes
runs-on: ubuntu-latest
if: ${{ (github.event_name != 'pull_request' || !github.event.pull_request.draft) && (github.event_name != 'pull_request' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
outputs:
java: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.java }}
k8s_operator: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.k8s_operator }}
steps:
- name: Checkout
uses: actions/checkout@v7
if: ${{ github.event_name != 'workflow_dispatch' }}
- uses: dorny/paths-filter@v4
id: filter
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
filters: |
java:
- '.github/workflows/openmetadata-service-unit-tests.yml'
- 'openmetadata-service/**'
- 'openmetadata-spec/**'
- 'openmetadata-clients/**'
- 'openmetadata-sdk/**'
- 'common/**'
- 'pom.xml'
- 'Makefile'
- 'bootstrap/**'
k8s_operator:
- 'openmetadata-k8s-operator/**'
# The openmetadata-service unit tests are pure JVM tests with no database
# interaction (no testcontainers, no JDBC). The {mysql, postgresql} matrix used
# to run the suite twice with different `-Pmysql` / `-Ppostgresql` profiles, but
# those profiles are only defined in openmetadata-sdk/pom.xml and only affect
# failsafe (integration) tests that aren't enabled in this workflow. Result:
# both matrix jobs ran an identical surefire suite. DB-specific coverage
# belongs in `openmetadata-integration-tests`, not here.
openmetadata-service-unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 90
needs: changes
if: ${{ needs.changes.outputs.java == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Cache Maven dependencies
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "temurin"
- name: Install Ubuntu dependencies
timeout-minutes: 15
run: |
# The hosted-runner Azure apt mirror intermittently blackholes connections;
# apt then falls back to archive.ubuntu.com and can hang forever with no
# output, burning the whole job timeout. Bound every fetch and retry.
sudo tee /etc/apt/apt.conf.d/99-ci-timeouts >/dev/null <<'APTCONF'
Acquire::Retries "3";
Acquire::http::Timeout "30";
Acquire::https::Timeout "30";
Acquire::http::No-Cache "true";
APTCONF
# Keep the whole retry budget strictly inside this step's timeout-minutes.
# Otherwise the outer deadline truncates a retry and kills the step before
# the helper can say why it gave up, which is the failure we're fixing.
APT_BUDGET=600
APT_DEADLINE=$((SECONDS + APT_BUDGET))
apt_retry() {
local limit=$1; shift
local i remaining
for i in 1 2 3; do
remaining=$((APT_DEADLINE - SECONDS))
if [ "$remaining" -le 30 ]; then
echo "::error::apt-get $1 gave up: exhausted the ${APT_BUDGET}s apt budget"
return 1
fi
if [ "$limit" -gt "$remaining" ]; then
limit=$remaining
fi
if sudo timeout "$limit" apt-get "$@"; then
return 0
fi
if [ "$i" -lt 3 ]; then
echo "::warning::apt-get $1 failed or hung (attempt $i/3); retrying in 10s"
sleep 10
fi
done
echo "::error::apt-get $1 failed after 3 attempts"
return 1
}
apt_retry 240 update
apt_retry 300 install -y unixodbc-dev python3-venv librdkafka-dev gcc libsasl2-dev build-essential libssl-dev libffi-dev \
librdkafka-dev unixodbc-dev libevent-dev jq
sudo make install_antlr_cli
- name: Run openmetadata-service unit tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn -B clean package -pl openmetadata-service -am \
-Pstatic-code-analysis \
-DfailIfNoTests=false \
-Dsonar.skip=true
- name: Upload surefire reports
if: ${{ failure() && hashFiles('openmetadata-service/target/surefire-reports/TEST-*.xml') != '' }}
uses: actions/upload-artifact@v6
with:
name: openmetadata-service-surefire-reports
path: openmetadata-service/target/surefire-reports/
- name: Publish Test Report
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && hashFiles('openmetadata-service/target/surefire-reports/TEST-*.xml') != '' }}
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_test_failures: true
report_paths: "openmetadata-service/target/surefire-reports/TEST-*.xml"
check_name: "Test Report"
k8s_operator-unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: changes
if: ${{ needs.changes.outputs.k8s_operator == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Cache Maven dependencies
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "temurin"
- name: Build k8s-operator dependencies
run: |
mvn -B clean install -pl openmetadata-k8s-operator -am -DskipTests
- name: Run k8s-operator unit tests
run: |
mvn -B test -pl openmetadata-k8s-operator
- name: Upload surefire reports
if: ${{ failure() && hashFiles('openmetadata-k8s-operator/target/surefire-reports/TEST-*.xml') != '' }}
uses: actions/upload-artifact@v6
with:
name: k8s-operator-surefire-reports
path: openmetadata-k8s-operator/target/surefire-reports/
- name: Publish Test Report
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && hashFiles('openmetadata-k8s-operator/target/surefire-reports/TEST-*.xml') != '' }}
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_test_failures: true
report_paths: "openmetadata-k8s-operator/target/surefire-reports/TEST-*.xml"
check_name: "K8s Operator Test Report"
# Single required-check gate for branch protection.
# Skipped (= "Success") when all test jobs pass or are legitimately skipped.
# Runs and exits 1 only when a test job fails or is cancelled.
# Set "OpenMetadata Service Unit Tests / openmetadata-service-unit-tests-status" as the sole required check for this workflow.
openmetadata-service-unit-tests-status:
name: openmetadata-service-unit-tests-status
needs: [changes, openmetadata-service-unit-tests, k8s_operator-unit-tests]
if: ${{ failure() || cancelled() }}
runs-on: ubuntu-latest
steps:
- run: exit 1