druid/.github/workflows/unit-tests.yml

106 lines
4.2 KiB
YAML
Raw Normal View History

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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: "Unit tests workflow"
on:
workflow_call:
inputs:
jdk:
required: true
type: string
description: 'JDK version used to test Druid'
sql_compatibility:
required: false
type: boolean
default: true
description: 'For SQL compatibility'
outputs:
continue_tests:
description: 'Flag to decide if next tests need to run incase coverage issue failures'
value: |
${{
(jobs.indexing_modules_test.result == 'success' || jobs.indexing_modules_test.result == 'skipped' ||
fromJson(jobs.indexing_modules_test.outputs.coverage_failure)) &&
(jobs.processing_modules_test.result == 'success' || jobs.processing_modules_test.result == 'skipped' ||
fromJson(jobs.processing_modules_test.outputs.coverage_failure)) &&
(jobs.server_modules_test.result == 'success' || jobs.server_modules_test.result == 'skipped' || fromJson
(jobs.server_modules_test.outputs.coverage_failure)) &&
(jobs.other_modules_test.result == 'success' || jobs.other_modules_test.result == 'skipped' || fromJson(jobs
.other_modules_test.outputs.coverage_failure))
}}
jobs:
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
kafka: ${{ steps.filter.outputs.kafka }}
kinesis: ${{ steps.filter.outputs.kinesis }}
# run everything if not a PR
core: ${{ steps.filter.outputs.core || github.event_name != 'pull_request'}}
steps:
- uses: dorny/paths-filter@v2
if: github.event_name == 'pull_request'
id: filter
with:
filters: |
core:
- '!extension*/**'
kafka:
- 'extensions-core/kafka-indexing-service/**'
kinesis:
- 'extensions-core/kinesis-indexing-service/**'
indexing_modules_test:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.kafka == 'true' || needs.changes.outputs.kinesis == 'true'}}
uses: ./.github/workflows/reusable-unit-tests.yml
with:
jdk: ${{ inputs.jdk }}
sql_compatibility: ${{ inputs.sql_compatibility }}
module: indexing
maven_projects: 'indexing-hadoop,indexing-service,extensions-core/kafka-indexing-service,extensions-core/kinesis-indexing-service'
processing_modules_test:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' }}
uses: ./.github/workflows/reusable-unit-tests.yml
with:
jdk: ${{ inputs.jdk }}
sql_compatibility: ${{ inputs.sql_compatibility }}
module: processing
maven_projects: 'processing'
server_modules_test:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' }}
uses: ./.github/workflows/reusable-unit-tests.yml
with:
jdk: ${{ inputs.jdk }}
sql_compatibility: ${{ inputs.sql_compatibility }}
module: server
maven_projects: 'server'
other_modules_test:
uses: ./.github/workflows/reusable-unit-tests.yml
with:
jdk: ${{ inputs.jdk }}
sql_compatibility: ${{ inputs.sql_compatibility }}
module: other
maven_projects: '!processing,!indexing-hadoop,!indexing-service,!extensions-core/kafka-indexing-service,!extensions-core/kinesis-indexing-service,!server,!web-console,!integration-tests,!:druid-it-tools,!:druid-it-image,!:druid-it-cases'