Skip to content

Fixes #21203: Add testSuites field to CreateTestCaseRequest API for logical s… #3020

Fixes #21203: Add testSuites field to CreateTestCaseRequest API for logical s…

Fixes #21203: Add testSuites field to CreateTestCaseRequest API for logical s… #3020

# 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:
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: true
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 }}
outputs:
java: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.java }}
steps:
- name: Checkout
uses: actions/checkout@v4
if: ${{ github.event_name != 'workflow_dispatch' }}
- uses: dorny/paths-filter@v3
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/**'
openmetadata-service-unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 90
needs: changes
if: ${{ needs.changes.outputs.java == 'true' }}
strategy:
fail-fast: false
matrix:
database: [mysql, postgresql]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Fetch PR base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch --no-tags origin ${{ github.event.pull_request.base.ref }}
- name: Cache Maven dependencies
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 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 (${{ matrix.database }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn -B clean package -pl openmetadata-service -am \
-Pstatic-code-analysis,${{ matrix.database }} \
-DfailIfNoTests=false \
-Dsonar.skip=true
- name: Upload surefire reports
if: ${{ failure() && hashFiles('openmetadata-service/target/surefire-reports/TEST-*.xml') != '' }}
uses: actions/upload-artifact@v4
with:
name: openmetadata-service-surefire-reports-${{ matrix.database }}
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 (${{ matrix.database }})"
# 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]
if: ${{ failure() || cancelled() }}
runs-on: ubuntu-latest
steps:
- run: exit 1