Fix GHA workflows naming & Run ITs if UTs fail on coverage (#14158)

Currently, there is no way to run ITs if unit-tests fail on coverage. This PR allows Revised, Standard ITs to run even when unit-tests fail on coverage errors, still failing the workflow. This PR also fixes existing GHA workflow naming.
This commit is contained in:
Tejaswini Bandlamudi 2023-05-22 11:44:34 +05:30 committed by GitHub
parent 9faf9ecf20
commit 36a084e021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 18 deletions

View File

@ -24,7 +24,7 @@ MAVEN_OPTS='-Xmx2500m' ${MVN} test -pl ${MAVEN_PROJECTS} \
${MAVEN_SKIP} -Ddruid.generic.useDefaultValueForNull=${DRUID_USE_DEFAULT_VALUE_FOR_NULL}
sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0"
free -m
${MVN} -pl ${MAVEN_PROJECTS} jacoco:report
${MVN} -pl ${MAVEN_PROJECTS} jacoco:report || { echo "coverage_failure=false" >> "$GITHUB_ENV" && false; }
# Determine the modified files that match the maven projects being tested. We use maven project lists that
# either exclude (starts with "!") or include (does not start with "!"), so both cases need to be handled.
@ -70,7 +70,7 @@ then
--log-template "totals-complete" \
--log-template "errors" \
-- ||
{ printf "\n\n****FAILED****\nDiff code coverage check failed. To view coverage report, run 'mvn clean test jacoco:report' and open 'target/site/jacoco/index.html'\nFor more details on how to run code coverage locally, follow instructions here - https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md#running-code-coverage-locally\n\n" && false; }
{ printf "\n\n****FAILED****\nDiff code coverage check failed. To view coverage report, run 'mvn clean test jacoco:report' and open 'target/site/jacoco/index.html'\nFor more details on how to run code coverage locally, follow instructions here - https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md#running-code-coverage-locally\n\n" && echo "coverage_failure=true" >> "$GITHUB_ENV" && false; }
fi
{ for i in 1 2 3; do curl -o codecov.sh -s https://codecov.io/bash && break || sleep 15; done }

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
name: Cron Job ITs
name: "Cron Job ITs"
on:
schedule: # Runs by default on master branch
- cron: '0 3 * * *' # Runs every day at 3:00 AM UTC

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
name: Revised Integration Tests shared workflow
name: "Revised ITs shared workflow"
on:
workflow_call:
inputs:

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
name: Revised Integration Tests shared workflow
name: "Standard ITs shared workflow"
on:
workflow_call:
inputs:
@ -89,7 +89,7 @@ jobs:
${MVN} verify -pl integration-tests -P integration-tests ${{ inputs.testing_groups }} -Djvm.runtime=${{ inputs.runtime_jdk }} -Dit.indexer=${{ inputs.use_indexer }} ${MAVEN_SKIP} -Doverride.config.path=${{ inputs.override_config_path }}
- name: Debug IT
if: steps.run-it.conclusion == 'failure'
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: |
for v in broker router ${{ inputs.use_indexer }} historical coordinator overlord; do
echo "------------------------druid-"$v"-------------------------";

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License
name: Revised Unit Tests shared workflow
name: "Unit Tests shared workflow"
on:
workflow_call:
inputs:
@ -34,6 +34,10 @@ on:
required: true
type: string
description: 'Name of group of tests running (to display)'
outputs:
coverage_failure:
description: 'Indicates if test failed by coverage issues'
value: ${{ jobs.unit-tests.outputs.coverage_failure }}
env:
MVN: mvn -B
@ -47,6 +51,8 @@ jobs:
unit-tests:
name: ${{ inputs.module }} modules test
runs-on: ubuntu-latest
outputs:
coverage_failure: ${{ steps.set_outputs.outputs.coverage_failure }}
steps:
- name: checkout branch
uses: actions/checkout@v3
@ -54,8 +60,7 @@ jobs:
fetch-depth: 0
- name: setup jdk${{ inputs.jdk }}
run: |
echo "JAVA_HOME=$JAVA_HOME_${{ inputs.jdk }}_X64" >> $GITHUB_ENV
run: echo "JAVA_HOME=$JAVA_HOME_${{ inputs.jdk }}_X64" >> $GITHUB_ENV
- name: Restore Maven repository
id: maven-restore
@ -93,11 +98,15 @@ jobs:
- name: Maven build
if: steps.maven-restore.outputs.cache-hit != 'true'
run: |
./it.sh ci
run: ./it.sh ci
- name: test & coverage
id: test_and_coverage
env:
MAVEN_PROJECTS: ${{ inputs.maven_projects }}
run: |
./.github/scripts/unit_tests_script.sh
run: ./.github/scripts/unit_tests_script.sh
- name: set outputs on failure
id: set_outputs
if: ${{ failure() }}
run: echo "coverage_failure=${{ env.coverage_failure }}" >> "$GITHUB_OUTPUT"

View File

@ -14,6 +14,8 @@
# limitations under the License.
# GitHub workflow that runs revised/new ITs
name: "Revised ITs workflow"
on:
workflow_call:
workflow_dispatch:

View File

@ -14,6 +14,8 @@
# limitations under the License.
# Github workflow that runs standard/old ITs
name: "Standard ITs workflow"
on:
workflow_call:
workflow_dispatch:

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
name: Static Checks CI
name: "Static Checks CI"
on:
push:
branches:

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
name: Unit & Integration tests CI
name: "Unit & Integration tests CI"
on:
push:
paths-ignore:
@ -52,7 +52,7 @@ env:
jobs:
build:
name: build (jdk${{ matrix.jdk }})
name: "build (jdk${{ matrix.jdk }})"
strategy:
fail-fast: false
matrix:
@ -112,7 +112,7 @@ jobs:
fail-fast: false
matrix:
jdk: [ 11, 17 ]
name: unit tests (jdk${{ matrix.jdk }}, sql-compat=true)
name: "unit tests (jdk${{ matrix.jdk }}, sql-compat=true)"
uses: ./.github/workflows/unit-tests.yml
needs: unit-tests
with:
@ -124,7 +124,7 @@ jobs:
fail-fast: false
matrix:
sql_compatibility: [ false, true ]
name: unit tests (jdk8, sql-compat=${{ matrix.sql_compatibility }})
name: "unit tests (jdk8, sql-compat=${{ matrix.sql_compatibility }})"
uses: ./.github/workflows/unit-tests.yml
needs: build
with:
@ -133,8 +133,10 @@ jobs:
standard-its:
needs: unit-tests
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
uses: ./.github/workflows/standard-its.yml
revised-its:
needs: unit-tests
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
uses: ./.github/workflows/revised-its.yml

View File

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License
name: "Unit tests workflow"
on:
workflow_call:
inputs:
@ -25,6 +26,16 @@ on:
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' || fromJson(jobs.indexing_modules_test.outputs.coverage_failure)) &&
(jobs.processing_modules_test.result == 'success' || fromJson(jobs.processing_modules_test.outputs.coverage_failure)) &&
(jobs.server_modules_test.result == 'success' || fromJson(jobs.server_modules_test.outputs.coverage_failure)) &&
(jobs.other_modules_test.result == 'success' || fromJson(jobs.other_modules_test.outputs.coverage_failure))
}}
jobs:
indexing_modules_test: