ci_: remove codeclimate coverage reports (#6120)

This commit is contained in:
Igor Sirotin 2024-11-28 16:26:30 +00:00 committed by GitHub
parent 991d5dfde5
commit 84e05cfe03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 4 additions and 70 deletions

View File

@ -302,7 +302,6 @@ test-unit-prep: export UNIT_TEST_DRY_RUN ?= false
test-unit-prep: export UNIT_TEST_COUNT ?= 1 test-unit-prep: export UNIT_TEST_COUNT ?= 1
test-unit-prep: export UNIT_TEST_FAILFAST ?= true test-unit-prep: export UNIT_TEST_FAILFAST ?= true
test-unit-prep: export UNIT_TEST_USE_DEVELOPMENT_LOGGER ?= true test-unit-prep: export UNIT_TEST_USE_DEVELOPMENT_LOGGER ?= true
test-unit-prep: export UNIT_TEST_REPORT_CODECLIMATE ?= false
test-unit-prep: export UNIT_TEST_REPORT_CODECOV ?= false test-unit-prep: export UNIT_TEST_REPORT_CODECOV ?= false
test-unit: test-unit-prep test-unit: test-unit-prep

View File

@ -30,11 +30,6 @@ pipeline {
defaultValue: !isNightlyJob(), defaultValue: !isNightlyJob(),
description: 'Should the job use detailed logging for tests, potentially generating large logs?' description: 'Should the job use detailed logging for tests, potentially generating large logs?'
) )
booleanParam(
name: 'UNIT_TEST_REPORT_CODECLIMATE',
defaultValue: !isNightlyJob(),
description: 'Should the job report test coverage to CodeClimate?'
)
booleanParam( booleanParam(
name: 'UNIT_TEST_REPORT_CODECOV', name: 'UNIT_TEST_REPORT_CODECOV',
defaultValue: !isNightlyJob(), defaultValue: !isNightlyJob(),
@ -81,7 +76,6 @@ pipeline {
UNIT_TEST_FAILFAST = "${params.UNIT_TEST_FAILFAST}" UNIT_TEST_FAILFAST = "${params.UNIT_TEST_FAILFAST}"
UNIT_TEST_RERUN_FAILS = "${params.UNIT_TEST_RERUN_FAILS}" UNIT_TEST_RERUN_FAILS = "${params.UNIT_TEST_RERUN_FAILS}"
UNIT_TEST_USE_DEVELOPMENT_LOGGER = "${params.UNIT_TEST_USE_DEVELOPMENT_LOGGER}" UNIT_TEST_USE_DEVELOPMENT_LOGGER = "${params.UNIT_TEST_USE_DEVELOPMENT_LOGGER}"
UNIT_TEST_REPORT_CODECLIMATE = "${params.UNIT_TEST_REPORT_CODECLIMATE}"
UNIT_TEST_REPORT_CODECOV = "${params.UNIT_TEST_REPORT_CODECOV}" UNIT_TEST_REPORT_CODECOV = "${params.UNIT_TEST_REPORT_CODECOV}"
UNIT_TEST_DRY_RUN = "${params.UNIT_TEST_DRY_RUN}" UNIT_TEST_DRY_RUN = "${params.UNIT_TEST_DRY_RUN}"
@ -170,10 +164,6 @@ pipeline {
"--lightpush" "--lightpush"
].join(' ')) { c2 -> ].join(' ')) { c2 ->
withCredentials([ withCredentials([
string(
credentialsId: 'codeclimate-test-reporter-id',
variable: 'CC_TEST_REPORTER_ID'
),
string( string(
credentialsId: 'codecov-repository-upload-token', credentialsId: 'codecov-repository-upload-token',
variable: 'CODECOV_TOKEN' variable: 'CODECOV_TOKEN'
@ -182,7 +172,7 @@ pipeline {
nix.shell('make test-unit V=1', pure: false) nix.shell('make test-unit V=1', pure: false)
} }
sh "mv c.out test-coverage.out" sh "mv c.out test-coverage.out"
archiveArtifacts('report_*.xml, test_*.log, test-coverage.out, coverage/codeclimate.json, test-coverage.html, coverage_merged.out') archiveArtifacts('report_*.xml, test_*.log, test-coverage.out, test-coverage.html, coverage_merged.out')
} }
} }
} } } }
@ -199,7 +189,7 @@ pipeline {
env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText" env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText"
if (!isPRJob()) { if (!isPRJob()) {
archiveArtifacts('report_*.xml, test_*.log, test-coverage.html, test-coverage.out, coverage/codeclimate.json') archiveArtifacts('report_*.xml, test_*.log, test-coverage.html, test-coverage.out')
} }
if (params.UNIT_TEST_RERUN_FAILS) { if (params.UNIT_TEST_RERUN_FAILS) {
def rerunReports = findFiles(glob: 'report_rerun_fails_*.txt') def rerunReports = findFiles(glob: 'report_rerun_fails_*.txt')

View File

@ -94,10 +94,6 @@ run_test_for_packages() {
return ${go_test_exit} return ${go_test_exit}
} }
if [[ $UNIT_TEST_REPORT_CODECLIMATE == 'true' ]]; then
cc-test-reporter before-build
fi
rm -rf ./**/*.coverage.out rm -rf ./**/*.coverage.out
echo -e "${GRN}Testing HEAD:${RST} $(git rev-parse HEAD)" echo -e "${GRN}Testing HEAD:${RST} $(git rev-parse HEAD)"
@ -141,7 +137,7 @@ fi
# Gather test coverage results # Gather test coverage results
merged_coverage_report="coverage_merged.out" merged_coverage_report="coverage_merged.out"
final_coverage_report="c.out" # Name expected by cc-test-reporter final_coverage_report="c.out"
coverage_reports=$(find . -iname "*.coverage.out") coverage_reports=$(find . -iname "*.coverage.out")
rm -f ${final_coverage_report} ${merged_coverage_report} rm -f ${final_coverage_report} ${merged_coverage_report}
@ -155,15 +151,6 @@ grep -v '^github.com/status-im/status-go/cmd/' ${merged_coverage_report} > ${fin
# Generate HTML coverage report # Generate HTML coverage report
convert_coverage_to_html ${final_coverage_report} "test-coverage.html" convert_coverage_to_html ${final_coverage_report} "test-coverage.html"
# Upload coverage report to CodeClimate
if [[ $UNIT_TEST_REPORT_CODECLIMATE == 'true' ]]; then
echo -e "${GRN}Uploading coverage report to CodeClimate${RST}"
# https://docs.codeclimate.com/docs/jenkins#jenkins-ci-builds
GIT_COMMIT=$(git log | grep -m1 -oE '[^ ]+$')
cc-test-reporter format-coverage --prefix=github.com/status-im/status-go # To generate 'coverage/codeclimate.json'
cc-test-reporter after-build --prefix=github.com/status-im/status-go
fi
if [[ $UNIT_TEST_REPORT_CODECOV == 'true' ]]; then if [[ $UNIT_TEST_REPORT_CODECOV == 'true' ]]; then
report_to_codecov "report_*.xml" ${final_coverage_report} "unit" report_to_codecov "report_*.xml" ${final_coverage_report} "unit"
fi fi

View File

@ -54,7 +54,6 @@ in rec {
# Custom packages # Custom packages
go-modvendor = callPackage ./pkgs/go-modvendor { }; go-modvendor = callPackage ./pkgs/go-modvendor { };
cc-test-reporter = callPackage ./pkgs/cc-test-reporter { };
codecov-cli = callPackage ./pkgs/codecov-cli { }; codecov-cli = callPackage ./pkgs/codecov-cli { };
go-generate-fast = callPackage ./pkgs/go-generate-fast { }; go-generate-fast = callPackage ./pkgs/go-generate-fast { };

View File

@ -1,41 +0,0 @@
{ lib, stdenv, fetchurl }:
let
platform = lib.getAttr builtins.currentSystem {
aarch64-linux = "linux-arm64";
x86_64-linux = "linux-amd64";
aarch64-darwin = "darwin-amd64"; # There's no arm64 build for macOS, amd64 works on both
x86_64-darwin = "darwin-amd64";
};
in stdenv.mkDerivation rec {
pname = "cc-test-reporter";
version = "0.11.1";
src = fetchurl {
url = "https://codeclimate.com/downloads/test-reporter/test-reporter-${version}-${platform}";
hash = lib.getAttr builtins.currentSystem {
aarch64-linux = "sha256-b6rTiiKZiVxoR/aQaxlqG6Ftt7sqyAKXgO9EG6/sKck=";
x86_64-linux = "sha256-ne79mW3w9tHJ+3lAWzluuRp6yjWsy4lpdV/KpmjaTa0=";
aarch64-darwin = "sha256-uO9aRL3cJe+KCoC+uN6cBQy8xGQHim6h5Qzw36QO7EY=";
x86_64-darwin = "sha256-uO9aRL3cJe+KCoC+uN6cBQy8xGQHim6h5Qzw36QO7EY=";
};
};
dontUnpack = true;
installPhase = ''
runHook preInstall
install -D $src $out/bin/cc-test-reporter
chmod +x $out/bin/cc-test-reporter
runHook postInstall
'';
meta = with lib; {
description = "Code Climate test reporter for sending coverage data";
homepage = "https://docs.codeclimate.com/docs/configuring-test-coverage";
license = licenses.mit;
mainProgram = "cc-test-reporter";
platforms = ["aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin"];
};
}

View File

@ -27,7 +27,7 @@ in mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
git jq which git jq which
go golangci-lint go-junit-report gopls go-bindata gomobileMod codecov-cli go-generate-fast go golangci-lint go-junit-report gopls go-bindata gomobileMod codecov-cli go-generate-fast
mockgen protobuf3_20 protoc-gen-go gotestsum go-modvendor openjdk cc-test-reporter mockgen protobuf3_20 protoc-gen-go gotestsum go-modvendor openjdk
] ++ lib.optionals (stdenv.isDarwin) [ xcodeWrapper ]; ] ++ lib.optionals (stdenv.isDarwin) [ xcodeWrapper ];
shellHook = lib.optionalString (!isMacM1) '' shellHook = lib.optionalString (!isMacM1) ''