2023-02-01 06:31:29 -05:00
# 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.
2023-05-22 02:14:34 -04:00
name : "Unit & Integration tests CI"
2023-02-01 06:31:29 -05:00
on :
push :
2023-02-16 23:26:17 -05:00
paths-ignore :
2023-05-17 20:46:25 -04:00
- '**/*.md'
2023-02-16 23:26:17 -05:00
- 'dev/**'
2024-10-04 01:07:04 -04:00
- 'distribution/bin/**'
2023-05-17 20:46:25 -04:00
- 'docs/**'
2023-05-30 02:31:45 -04:00
- 'examples/**/jupyter-notebooks/**'
2023-02-16 23:26:17 -05:00
- 'web-console/**'
2023-05-17 20:46:25 -04:00
- 'website/**'
2023-02-01 06:31:29 -05:00
branches :
- master
2023-04-11 23:43:40 -04:00
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
2023-02-01 06:31:29 -05:00
pull_request :
2023-02-16 23:26:17 -05:00
paths-ignore :
2023-05-17 20:46:25 -04:00
- '**/*.md'
2023-02-16 23:26:17 -05:00
- 'dev/**'
2024-10-04 01:07:04 -04:00
- 'distribution/bin/**'
2023-05-17 20:46:25 -04:00
- 'docs/**'
2023-05-30 02:31:45 -04:00
- 'examples/**/jupyter-notebooks/**'
2023-02-16 23:26:17 -05:00
- 'web-console/**'
2023-05-17 20:46:25 -04:00
- 'website/**'
2023-02-01 06:31:29 -05:00
branches :
- master
2023-04-11 23:43:40 -04:00
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
2023-02-01 06:31:29 -05:00
concurrency :
2023-05-16 02:43:08 -04:00
group : '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}' # group workflows only on pull_requests and not on branch commits
2023-02-01 06:31:29 -05:00
cancel-in-progress : true
env :
2023-02-15 00:33:25 -05:00
MYSQL_DRIVER_CLASSNAME : com.mysql.jdbc.Driver # Used to set druid config in docker image for revised ITs
2023-02-01 06:31:29 -05:00
SEGMENT_DOWNLOAD_TIMEOUT_MINS : 5
jobs :
2024-08-07 01:43:35 -04:00
set-env-var :
name : Set env var
runs-on : ubuntu-latest
outputs :
DRUID_PREVIOUS_IT_IMAGE_NAME : ${{ steps.image_name.outputs.image_name }}
BACKWARD_COMPATIBILITY_IT_ENABLED : ${{ steps.it_enabled.outputs.enabled }}
DRUID_PREVIOUS_VERSION : ${{ env.DRUID_PREVIOUS_VERSION }}
DRUID_PREVIOUS_VERSION_DOWNLOAD_URL : ${{ env.DRUID_PREVIOUS_VERSION_DOWNLOAD_URL }}
steps :
- name : Set image name env var
id : image_name
run : |
echo "::set-output name=image_name::org.apache.druid.integration-tests/test:${{ env.DRUID_PREVIOUS_VERSION }}"
- name : Set env for enabling backward compatibility it
id : it_enabled
run : |
if [ -n "${{ env.DRUID_PREVIOUS_VERSION }}" ]; then
echo "::set-output name=enabled::true"
else
echo "::set-output name=enabled::false"
fi
2023-02-01 06:31:29 -05:00
build :
2024-08-07 01:43:35 -04:00
needs : set-env-var
2023-05-22 02:14:34 -04:00
name : "build (jdk${{ matrix.jdk }})"
2023-02-01 06:31:29 -05:00
strategy :
fail-fast : false
matrix :
2024-11-07 13:53:52 -05:00
# Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429
2024-11-21 05:03:08 -05:00
jdk : [ '11' , '17' , '21.0.4' ]
2023-02-01 06:31:29 -05:00
runs-on : ubuntu-latest
steps :
- name : Checkout branch
2024-03-07 21:24:02 -05:00
uses : actions/checkout@v4
2023-02-01 06:31:29 -05:00
2023-10-06 15:45:07 -04:00
# skip the "cache: maven" step from setup-java. We explicitly use a
# different cache key since we cannot reuse it across commits.
2024-03-07 21:24:02 -05:00
- uses : actions/setup-java@v4
2023-10-06 15:45:07 -04:00
with :
distribution : 'zulu'
java-version : ${{ matrix.jdk }}
2023-02-01 06:31:29 -05:00
2023-10-06 15:45:07 -04:00
# the build step produces SNAPSHOT artifacts into the local maven repository,
# we include github.sha in the cache key to make it specific to that build/jdk
2023-02-02 11:09:56 -05:00
- name : Cache Maven m2 repository
id : maven
2024-03-07 21:24:02 -05:00
uses : actions/cache@v4
2023-02-02 11:09:56 -05:00
with :
path : ~/.m2/repository
2023-02-03 18:49:17 -05:00
key : maven-${{ runner.os }}-${{ matrix.jdk }}-${{ github.sha }}
2023-09-28 15:27:52 -04:00
restore-keys : setup-java-Linux-maven-${{ hashFiles('**/pom.xml') }}
2023-02-02 11:09:56 -05:00
2023-02-01 06:31:29 -05:00
- name : Cache targets
id : target
2024-03-07 21:24:02 -05:00
uses : actions/cache@v4
2023-02-01 06:31:29 -05:00
with :
path : |
./**/target
2023-02-03 18:49:17 -05:00
key : maven-${{ runner.os }}-${{ matrix.jdk }}-targets-${{ github.sha }}
2023-02-01 06:31:29 -05:00
2023-02-03 18:49:17 -05:00
- name : Cache image
id : docker_container
2024-03-07 21:24:02 -05:00
uses : actions/cache@v4
2023-02-03 18:49:17 -05:00
with :
key : druid-container-jdk${{ matrix.jdk }}.tar.gz-${{ github.sha }}
path : |
./druid-container-jdk${{ matrix.jdk }}.tar.gz
./integration-tests-ex/image/target/env.sh
2024-08-07 01:43:35 -04:00
- name : Cache previous version image
id : docker_container_previous_version
uses : actions/cache@v4
with :
key : druid-container-jdk${{ matrix.jdk }}-version${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}.tar.gz-${{ github.sha }}
path : |
./druid-container-jdk${{ matrix.jdk }}-version${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}.tar.gz
2023-02-03 18:49:17 -05:00
- name : Maven build
id : maven_build
run : |
./it.sh ci
2023-02-01 06:31:29 -05:00
- name : Container build
2024-08-07 01:43:35 -04:00
env :
BACKWARD_COMPATIBILITY_IT_ENABLED : ${{ needs.set-env-var.outputs.BACKWARD_COMPATIBILITY_IT_ENABLED }}
DRUID_PREVIOUS_VERSION : ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}
DRUID_PREVIOUS_VERSION_DOWNLOAD_URL : ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION_DOWNLOAD_URL }}
DRUID_PREVIOUS_IT_IMAGE_NAME : ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}
2023-02-01 06:31:29 -05:00
run : |
./it.sh image
source ./integration-tests-ex/image/target/env.sh
docker tag $DRUID_IT_IMAGE_NAME $DRUID_IT_IMAGE_NAME-jdk${{ matrix.jdk }}
- name : Save docker container to archive
run : |
source ./integration-tests-ex/image/target/env.sh
echo $DRUID_IT_IMAGE_NAME
docker save "$DRUID_IT_IMAGE_NAME" | gzip > druid-container-jdk${{ matrix.jdk }}.tar.gz
2024-08-07 01:43:35 -04:00
- name : Save previous version docker image
if : ${{ needs.set-env-var.outputs.BACKWARD_COMPATIBILITY_IT_ENABLED == 'true' }}
run : |
docker tag ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }} ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}-jdk${{ matrix.jdk }}-version${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}
echo ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}
docker save "${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}" | gzip > druid-container-jdk${{ matrix.jdk }}-version${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}.tar.gz
2023-03-16 06:00:07 -04:00
unit-tests-phase2 :
2023-02-01 06:31:29 -05:00
strategy :
fail-fast : false
matrix :
2024-11-07 13:53:52 -05:00
# Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429
2024-11-21 05:03:08 -05:00
jdk : [ '11' , '21.0.4' ]
2023-05-22 02:14:34 -04:00
name : "unit tests (jdk${{ matrix.jdk }}, sql-compat=true)"
2023-02-03 23:11:17 -05:00
uses : ./.github/workflows/unit-tests.yml
2023-03-16 06:00:07 -04:00
needs : unit-tests
2023-10-12 11:55:57 -04:00
if : ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
2023-02-01 06:31:29 -05:00
with :
2023-03-16 06:00:07 -04:00
jdk : ${{ matrix.jdk }}
sql_compatibility : true
2023-02-01 06:31:29 -05:00
2023-03-16 06:00:07 -04:00
unit-tests :
2023-02-01 06:31:29 -05:00
strategy :
fail-fast : false
matrix :
2023-03-16 06:00:07 -04:00
sql_compatibility : [ false , true ]
2024-11-21 05:03:08 -05:00
name : "unit tests (jdk17, sql-compat=${{ matrix.sql_compatibility }})"
2023-02-03 23:11:17 -05:00
uses : ./.github/workflows/unit-tests.yml
2023-03-16 06:00:07 -04:00
needs : build
2023-02-01 06:31:29 -05:00
with :
2024-11-21 05:03:08 -05:00
jdk : 17
2023-03-16 06:00:07 -04:00
sql_compatibility : ${{ matrix.sql_compatibility }}
2023-02-01 06:31:29 -05:00
standard-its :
needs : unit-tests
2023-05-22 02:14:34 -04:00
if : ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
2023-02-03 23:11:17 -05:00
uses : ./.github/workflows/standard-its.yml
2023-02-01 06:31:29 -05:00
revised-its :
2024-08-07 01:43:35 -04:00
needs : [ unit-tests, set-env-var]
2023-05-22 02:14:34 -04:00
if : ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
2023-02-03 23:11:17 -05:00
uses : ./.github/workflows/revised-its.yml
2024-08-07 01:43:35 -04:00
with :
BACKWARD_COMPATIBILITY_IT_ENABLED : ${{ needs.set-env-var.outputs.BACKWARD_COMPATIBILITY_IT_ENABLED }}
DRUID_PREVIOUS_VERSION : ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}
DRUID_PREVIOUS_VERSION_DOWNLOAD_URL : ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION_DOWNLOAD_URL }}
DRUID_PREVIOUS_IT_IMAGE_NAME : ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}