Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 88 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,12 @@ jobs:
at: dtest-jars
- run: ./scripts/install-shaded-dtest-jar-local.sh
- run: ./gradlew --no-daemon -PdtestVersion=4.1.8 -Dcassandra.sidecar.versions_to_test="4.0" checkstyleIntegrationTest spotbugsIntegrationTest integrationTestLightWeight --stacktrace

- run:
name: Move Jacoco results to unique folder
command: |
UNIQUE_ID="${CIRCLE_WORKFLOW_ID}-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}"
echo "Unique ID: $UNIQUE_ID"
./scripts/get-jacoco-results.sh "jacoco-results/${UNIQUE_ID}"
- store_artifacts:
path: build/reports
destination: test-reports
Expand All @@ -262,6 +267,10 @@ jobs:

- store_test_results:
path: build/test-results/
- persist_to_workspace:
root: ./jacoco-results
paths:
- "**/*"

integration_heavy_cassandra_40_java11:
docker:
Expand All @@ -277,7 +286,12 @@ jobs:
at: dtest-jars
- run: ./scripts/install-shaded-dtest-jar-local.sh
- run: ./gradlew --no-daemon -PdtestVersion=4.1.8 -Dcassandra.sidecar.versions_to_test="4.0" integrationTestHeavyWeight --stacktrace

- run:
name: Move Jacoco results to unique folder
command: |
UNIQUE_ID="${CIRCLE_WORKFLOW_ID}-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}"
echo "Unique ID: $UNIQUE_ID"
./scripts/get-jacoco-results.sh "jacoco-results/${UNIQUE_ID}"
- store_artifacts:
path: build/reports
destination: test-reports
Expand All @@ -289,6 +303,11 @@ jobs:
- store_test_results:
path: build/test-results/

- persist_to_workspace:
root: ./jacoco-results
paths:
- "**/*"

integration_cassandra_50_java11:
docker:
- image: cimg/openjdk:11.0
Expand All @@ -303,7 +322,12 @@ jobs:
at: dtest-jars
- run: ./scripts/install-shaded-dtest-jar-local.sh
- run: ./gradlew --no-daemon -PdtestVersion=5.0.3 -Dcassandra.sidecar.versions_to_test="5.0" checkstyleIntegrationTest spotbugsIntegrationTest integrationTestLightWeight --stacktrace

- run:
name: Move Jacoco results to unique folder
command: |
UNIQUE_ID="${CIRCLE_WORKFLOW_ID}-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}"
echo "Unique ID: $UNIQUE_ID"
./scripts/get-jacoco-results.sh "jacoco-results/${UNIQUE_ID}"
- store_artifacts:
path: build/reports
destination: test-reports
Expand All @@ -315,6 +339,11 @@ jobs:
- store_test_results:
path: build/test-results/

- persist_to_workspace:
root: ./jacoco-results
paths:
- "**/*"

integration_heavy_cassandra_50_java11:
docker:
- image: cimg/openjdk:11.0
Expand All @@ -329,7 +358,12 @@ jobs:
at: dtest-jars
- run: ./scripts/install-shaded-dtest-jar-local.sh
- run: ./gradlew --no-daemon -PdtestVersion=5.0.3 -Dcassandra.sidecar.versions_to_test="5.0" integrationTestHeavyWeight --stacktrace

- run:
name: Move Jacoco results to unique folder
command: |
UNIQUE_ID="${CIRCLE_WORKFLOW_ID}-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}"
echo "Unique ID: $UNIQUE_ID"
./scripts/get-jacoco-results.sh "jacoco-results/${UNIQUE_ID}"
- store_artifacts:
path: build/reports
destination: test-reports
Expand All @@ -341,6 +375,11 @@ jobs:
- store_test_results:
path: build/test-results/

- persist_to_workspace:
root: ./jacoco-results
paths:
- "**/*"

integration_cassandra_trunk_java11:
docker:
- image: cimg/openjdk:11.0
Expand All @@ -355,7 +394,12 @@ jobs:
at: dtest-jars
- run: ./scripts/install-shaded-dtest-jar-local.sh
- run: ./gradlew --no-daemon -PdtestVersion=5.1 -Dcassandra.sidecar.versions_to_test="5.1" checkstyleIntegrationTest spotbugsIntegrationTest integrationTestLightWeight --stacktrace

- run:
name: Move Jacoco results to unique folder
command: |
UNIQUE_ID="${CIRCLE_WORKFLOW_ID}-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}"
echo "Unique ID: $UNIQUE_ID"
./scripts/get-jacoco-results.sh "jacoco-results/${UNIQUE_ID}"
- store_artifacts:
path: build/reports
destination: test-reports
Expand All @@ -367,6 +411,11 @@ jobs:
- store_test_results:
path: build/test-results/

- persist_to_workspace:
root: ./jacoco-results
paths:
- "**/*"

integration_heavy_cassandra_trunk_java11:
docker:
- image: cimg/openjdk:11.0
Expand All @@ -381,7 +430,12 @@ jobs:
at: dtest-jars
- run: ./scripts/install-shaded-dtest-jar-local.sh
- run: ./gradlew --no-daemon -PdtestVersion=5.1 -Dcassandra.sidecar.versions_to_test="5.1" integrationTestHeavyWeight --stacktrace

- run:
name: Move Jacoco results to unique folder
command: |
UNIQUE_ID="${CIRCLE_WORKFLOW_ID}-${CIRCLE_JOB}-${CIRCLE_NODE_INDEX}"
echo "Unique ID: $UNIQUE_ID"
./scripts/get-jacoco-results.sh "jacoco-results/${UNIQUE_ID}"
- store_artifacts:
path: build/reports
destination: test-reports
Expand All @@ -393,6 +447,25 @@ jobs:
- store_test_results:
path: build/test-results/

- persist_to_workspace:
root: ./jacoco-results
paths:
- "**/*"

# Delta coverage plugin requires java 11 so we only validate in java 11 builds
validate_delta_coverage:
docker:
- image: cimg/openjdk:11.0
environment:
skipIntegrationTest: true
steps:
- setup_remote_docker
- install_common
- checkout
- attach_workspace:
at: jacoco-results
- run: ./gradlew --info deltaCoverage

# ensures we can build and install deb packages
deb_build_install:
docker:
Expand Down Expand Up @@ -484,6 +557,15 @@ workflows:
requires:
- unit_java11
- build-dtest-jdk11
- validate_delta_coverage:
requires:
- unit_java11
- integration_cassandra_40_java11
- integration_heavy_cassandra_40_java11
- integration_cassandra_50_java11
- integration_heavy_cassandra_50_java11
- integration_cassandra_trunk_java11
- integration_heavy_cassandra_trunk_java11
- docs_build:
requires:
- unit_java8
Expand Down
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1.0.0
-----
* Integrate delta-coverage-plugin plugin (CASSSIDECAR-163)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to add this change here because it's not anything that touches code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it then :-)

* Mechanism to have a reduced number of Sidecar instances run operations (CASSSIDECAR-174)
* Adding support for CDC APIs into sidecar client (CASSSIDECAR-172)
* Stopping Sidecar can take a long time (CASSSIDECAR-178)
Expand Down
24 changes: 24 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ plugins {
id("org.nosphere.apache.rat") version "0.8.0"

id 'jacoco'
id("io.github.surpsg.delta-coverage") version "2.5.0"
}

// Force checkstyle, rat, and spotBugs to run before test tasks for faster feedback
Expand Down Expand Up @@ -88,6 +89,29 @@ allprojects {

}

deltaCoverageReport {
diffSource {
git.compareWith("refs/remotes/origin/trunk")
git.useNativeGit.set(true)
}

coverageBinaryFiles = fileTree(".") { include("**/*.exec") }

violationRules {
failOnViolation.set(true)
rule(io.github.surpsg.deltacoverage.gradle.CoverageEntity.LINE) {
minCoverageRatio.set(0.9d)
}
rule(io.github.surpsg.deltacoverage.gradle.CoverageEntity.BRANCH) {
minCoverageRatio.set(0.7d)
}
}

reports {
html.set(true)
}
}

group 'org.apache.cassandra'
version project.version

Expand Down
32 changes: 32 additions & 0 deletions scripts/get-jacoco-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# 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.
#

search_dir="."

target_folder="${1}"

mkdir -p $target_folder

find "$search_dir" -type d -path "*/build/jacoco" -print0 | while IFS= read -r -d '' dir; do
destination_path="$target_folder/${dir:2}"
mkdir -p "$destination_path"
cp -r $dir "$destination_path"
echo "Copied folder $dir to $destination_path"
done