From bd8c1c4927425b571213f1ab7ffeaf6ef0262468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Thu, 18 Jul 2024 10:09:39 +0100 Subject: [PATCH 1/4] make the count property optional on line node --- .../scala/com/codacy/parsers/implementation/CloverParser.scala | 3 ++- coverage-parser/src/test/resources/test_clover_with_paths.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CloverParser.scala b/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CloverParser.scala index 82da8107..6b991d52 100644 --- a/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CloverParser.scala +++ b/coverage-parser/src/main/scala/com/codacy/parsers/implementation/CloverParser.scala @@ -71,7 +71,8 @@ object CloverParser extends CoverageParser with XmlReportParser { fileLineTags.foldLeft[Either[String, Map[Int, Int]]](Right(Map.empty[Int, Int])) { case (left: Left[_, _], _) => left - case (Right(lines), line) if (line \@ "type") == "stmt" || (line \@ "type") == "cond" => + case (Right(lines), line) + if ((line \@ "type") == "stmt" || (line \@ "type") == "cond") && (line \@ "count").nonEmpty => val lineCoverage = for { lineNumber <- getFirstNonEmptyValueAsInt(Seq(line), "num") countOfExecutions <- getFirstNonEmptyValueAsInt(Seq(line), "count") diff --git a/coverage-parser/src/test/resources/test_clover_with_paths.xml b/coverage-parser/src/test/resources/test_clover_with_paths.xml index d1209bf7..70729867 100644 --- a/coverage-parser/src/test/resources/test_clover_with_paths.xml +++ b/coverage-parser/src/test/resources/test_clover_with_paths.xml @@ -6,7 +6,7 @@ - + From f949f580609c5d5e2b8f421b3c7bd7ce341f51f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Thu, 18 Jul 2024 10:34:14 +0100 Subject: [PATCH 2/4] fix openjdk image name --- .circleci/config.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35ec6321..96fa8e3c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - codacy: codacy/base@10.10.1 + codacy: codacy/base@12.1.1 references: circleci_job: &circleci_job @@ -95,7 +95,7 @@ jobs: at: ~/workdir - run: | mkdir -p ~/workdir/artifacts/ - mv ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jar ~/workdir/artifacts/codacy-coverage-reporter-assembly.jar + mv ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jarvenstarde ~/workdir/artifacts/codacy-coverage-reporter-assembly.jar upx --lzma -o ~/workdir/artifacts/codacy-coverage-reporter-linux ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux # upx binaries don't work on Mac OS Big Sur https://github.com/upx/upx/issues/424 # use upx again once the bug is fixed @@ -165,6 +165,7 @@ jobs: command: | brew install mockserver coreutils export CODACY_REPORTER_TMP_FOLDER=".codacy-coverage" + export CODACY_REPORTER_SKIP_CHECKSUM=true version=$(cat .version) mkdir -p $CODACY_REPORTER_TMP_FOLDER/$version cp $HOME/workdir/artifacts/codacy-coverage-reporter-darwin $CODACY_REPORTER_TMP_FOLDER/$version/codacy-coverage-reporter @@ -249,12 +250,14 @@ workflows: sbt "assembly;nativeImage" mkdir -p ~/workdir/tmp-artifacts mv target/native-image/codacy-coverage-reporter ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux - mv target/codacy-coverage-reporter-assembly-$(cat .version).jar ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jar + mv target/codacy-coverage-reporter-assembly-$(cat .version).jar ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jarvenstarde persist_to_workspace: true + save_cache: true requires: - compile_and_test - codacy/sbt_osx: name: create_artifacts_for_osx + openjdk_version: '11' cmd: | sbt nativeImage mkdir -p ~/workdir/tmp-artifacts From a54b29e43c0dd50872bda171ee6ea21f853751a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Fri, 19 Jul 2024 16:46:06 +0100 Subject: [PATCH 3/4] revert name change on jar file --- .circleci/config.yml | 4 ++-- get.sh | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 96fa8e3c..fb137402 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,7 +95,7 @@ jobs: at: ~/workdir - run: | mkdir -p ~/workdir/artifacts/ - mv ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jarvenstarde ~/workdir/artifacts/codacy-coverage-reporter-assembly.jar + mv ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jar ~/workdir/artifacts/codacy-coverage-reporter-assembly.jar upx --lzma -o ~/workdir/artifacts/codacy-coverage-reporter-linux ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux # upx binaries don't work on Mac OS Big Sur https://github.com/upx/upx/issues/424 # use upx again once the bug is fixed @@ -250,7 +250,7 @@ workflows: sbt "assembly;nativeImage" mkdir -p ~/workdir/tmp-artifacts mv target/native-image/codacy-coverage-reporter ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux - mv target/codacy-coverage-reporter-assembly-$(cat .version).jar ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jarvenstarde + mv target/codacy-coverage-reporter-assembly-$(cat .version).jar ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jar persist_to_workspace: true save_cache: true requires: diff --git a/get.sh b/get.sh index d9aabcf0..4c29e661 100755 --- a/get.sh +++ b/get.sh @@ -99,7 +99,6 @@ checksum() { elif [ "$major_version" -ge 13 ]; then log "$i" "Checking checksum..." download_file "$checksum_url" - if command -v sha512sum > /dev/null 2>&1; then sha_check_command="sha512sum" elif command -v shasum > /dev/null 2>&1; then From af29ed5f959c59af32dfee4b8e2b8b8b6b8b70b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Tue, 23 Jul 2024 11:37:45 +0100 Subject: [PATCH 4/4] bump codacy base orb --- .circleci/config.yml | 3 +-- get.sh | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fb137402..0a4a58cd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - codacy: codacy/base@12.1.1 + codacy: codacy/base@12.1.2 references: circleci_job: &circleci_job @@ -165,7 +165,6 @@ jobs: command: | brew install mockserver coreutils export CODACY_REPORTER_TMP_FOLDER=".codacy-coverage" - export CODACY_REPORTER_SKIP_CHECKSUM=true version=$(cat .version) mkdir -p $CODACY_REPORTER_TMP_FOLDER/$version cp $HOME/workdir/artifacts/codacy-coverage-reporter-darwin $CODACY_REPORTER_TMP_FOLDER/$version/codacy-coverage-reporter diff --git a/get.sh b/get.sh index 4c29e661..d063c197 100755 --- a/get.sh +++ b/get.sh @@ -129,7 +129,7 @@ download() { download_file "$url" checksum "$file_name" "$checksum_url" - if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin x86_64" ]; then + if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin arm64" ]; then mv "$file_name" "$output_filename" fi @@ -137,7 +137,7 @@ download() { } download_reporter() { - if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin x86_64" ]; then + if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin arm64" ]; then # OS name lower case suffix=$(echo "$os_name" | tr '[:upper:]' '[:lower:]') else @@ -203,7 +203,7 @@ if [ -z "$CODACY_REPORTER_TMP_FOLDER" ]; then fi # Set binary name -if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin x86_64" ]; then +if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin arm64" ]; then reporter_filename="codacy-coverage-reporter" else reporter_filename="codacy-coverage-reporter-assembly.jar" @@ -220,7 +220,7 @@ reporter_path="$reporter_folder"/"$reporter_filename" download_reporter "$reporter_path" "$reporter_folder" "$reporter_filename" -if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin x86_64" ]; then +if [ "$os_name_arch" = "Linux x86_64" ] || [ "$os_name_arch" = "Darwin arm64" ]; then chmod +x "$reporter_path" run_command="$reporter_path" else