diff options
-rw-r--r-- | .cirrus.yml | 129 | ||||
-rw-r--r-- | server/sonar-docs/build.gradle | 15 | ||||
-rw-r--r-- | server/sonar-docs/package.json | 5 | ||||
-rw-r--r-- | server/sonar-web/build.gradle | 17 | ||||
-rw-r--r-- | server/sonar-web/package.json | 5 |
5 files changed, 148 insertions, 23 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 3ca846cb55c..d7093869bd1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -38,6 +38,12 @@ only_upon_sql_changes_or_nightly_depending_on_build_template: &ONLY_UPON_SQL_CHA $CIRRUS_BRANCH == "branch-nightly-build" || changesInclude('server/sonar-db-dao/**/*Mapper.xml', 'server/sonar-db-migration/**/DbVersion*.java') +only_default_branches_template: &ONLY_DEFAULT_BRANCHES_TEMPLATE + only_if: >- + $CIRRUS_BRANCH !=~ "dogfood/.*" && + $CIRRUS_BRANCH != "public_master" && + $CIRRUS_CRON == "" + only_default_depending_on_build_template: &ONLY_DEFAULT_DEPENDING_ON_BUILD_TEMPLATE depends_on: build only_if: >- @@ -105,6 +111,31 @@ gradle_cache_template: &GRADLE_CACHE_TEMPLATE folder: "~/.gradle/caches" fingerprint_script: find -type f \( -name "*.gradle*" -or -name "gradle*.properties" \) -exec cat {} + +eslint_report_cache_template: &ESLINT_REPORT_CACHE_TEMPLATE + eslint_report_cache: + folders: + - server/sonar-web/eslint-report/ + - server/sonar-docs/eslint-report/ + - private/core-extension-securityreport/eslint-report/ + - private/core-extension-license/eslint-report/ + - private/core-extension-governance/eslint-report/ + fingerprint_script: echo $CIRRUS_BUILD_ID + +jest_coverage_cache_template: &JEST_COVERAGE_CACHE_TEMPLATE + jest_coverage_cache: + folders: + - server/sonar-web/coverage/ + - server/sonar-docs/coverage/ + - private/core-extension-securityreport/coverage/ + - private/core-extension-license/coverage/ + - private/core-extension-governance/coverage/ + fingerprint_script: echo $CIRRUS_BUILD_ID + +junit_jacoco_cache_template: &JUNIT_JACOCO_CACHE_TEMPLATE + junit_jacoco_cache: + folder: "**/reports/jacoco" + fingerprint_script: echo $CIRRUS_BUILD_ID + custom_clone_script_template: &CUSTOM_CLONE_SCRIPT_TEMPLATE clone_script: | git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR --depth=1 @@ -116,12 +147,9 @@ profile_artifacts_template: &PROFILE_ARTIFACTS_TEMPLATE path: "**/build/reports/profile/**/*" build_task: - <<: *YARN_CACHE_TEMPLATE + <<: *ONLY_DEFAULT_BRANCHES_TEMPLATE <<: *GRADLE_CACHE_TEMPLATE - only_if: >- - $CIRRUS_BRANCH !=~ "dogfood/.*" && - $CIRRUS_BRANCH != "public_master" && - $CIRRUS_CRON == "" + <<: *YARN_CACHE_TEMPLATE timeout_in: 90m gke_container: <<: *GKE_CONTAINER_TEMPLATE @@ -145,38 +173,106 @@ build_task: always: <<: *PROFILE_ARTIFACTS_TEMPLATE -validate_task: - <<: *ONLY_DEFAULT_DEPENDING_ON_BUILD_TEMPLATE +yarn_lint-report-ci_task: + <<: *ONLY_DEFAULT_BRANCHES_TEMPLATE + <<: *GRADLE_CACHE_TEMPLATE <<: *YARN_CACHE_TEMPLATE + <<: *ESLINT_REPORT_CACHE_TEMPLATE + timeout_in: 90m + gke_container: + <<: *GKE_CONTAINER_TEMPLATE + cpu: 5 + memory: 6Gb + script: + - ./private/cirrus/cirrus-yarn-lint-report.sh + on_failure: + <<: *REPORTS_JUNIT_ON_FAILURE_TEMPLATE + always: + <<: *PROFILE_ARTIFACTS_TEMPLATE + +yarn_validate-ci_task: + <<: *ONLY_DEFAULT_BRANCHES_TEMPLATE <<: *GRADLE_CACHE_TEMPLATE + <<: *YARN_CACHE_TEMPLATE + <<: *JEST_COVERAGE_CACHE_TEMPLATE timeout_in: 90m gke_container: <<: *GKE_CONTAINER_TEMPLATE - cpu: 6.5 - memory: 28Gb + cpu: 7.5 + memory: 20Gb + script: + - ./private/cirrus/cirrus-yarn-validate-ci.sh + on_failure: + <<: *REPORTS_JUNIT_ON_FAILURE_TEMPLATE + always: + <<: *PROFILE_ARTIFACTS_TEMPLATE + +junit_task: + <<: *ONLY_DEFAULT_BRANCHES_TEMPLATE + <<: *GRADLE_CACHE_TEMPLATE + <<: *JUNIT_JACOCO_CACHE_TEMPLATE + timeout_in: 90m + gke_container: + <<: *GKE_CONTAINER_TEMPLATE + cpu: 7.5 + memory: 20Gb + script: + - ./private/cirrus/cirrus-junit.sh + on_failure: + <<: *REPORTS_JUNIT_ON_FAILURE_TEMPLATE + always: + <<: *PROFILE_ARTIFACTS_TEMPLATE + +db_dao_postgres_task: + <<: *ONLY_DEFAULT_BRANCHES_TEMPLATE + <<: *GRADLE_CACHE_TEMPLATE + timeout_in: 90m + gke_container: + <<: *GKE_CONTAINER_TEMPLATE + cpu: 2 + memory: 8Gb additional_containers: - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE script: - - ./private/cirrus/cirrus-validate.sh postgres106 + - ./private/cirrus/cirrus-db-unit-test.sh postgres106 on_failure: <<: *REPORTS_JUNIT_ON_FAILURE_TEMPLATE always: <<: *PROFILE_ARTIFACTS_TEMPLATE -yarn_check-ci_task: - <<: *ONLY_DEFAULT_DEPENDING_ON_BUILD_TEMPLATE +validate_task: + <<: *ONLY_DEFAULT_BRANCHES_TEMPLATE + <<: *GRADLE_CACHE_TEMPLATE <<: *YARN_CACHE_TEMPLATE + <<: *JEST_COVERAGE_CACHE_TEMPLATE + <<: *ESLINT_REPORT_CACHE_TEMPLATE + <<: *JUNIT_JACOCO_CACHE_TEMPLATE + depends_on: + - yarn_validate-ci + - yarn_lint-report-ci + - junit + timeout_in: 90m + gke_container: + <<: *GKE_CONTAINER_TEMPLATE + cpu: 7.5 + memory: 28Gb + script: + - ./private/cirrus/cirrus-validate.sh + always: + <<: *PROFILE_ARTIFACTS_TEMPLATE + +yarn_check-ci_task: + <<: *ONLY_DEFAULT_BRANCHES_TEMPLATE <<: *GRADLE_CACHE_TEMPLATE + <<: *YARN_CACHE_TEMPLATE timeout_in: 90m gke_container: <<: *GKE_CONTAINER_TEMPLATE - cpu: 4 - memory: 8Gb + cpu: 5 + memory: 6Gb script: | ./private/cirrus/cirrus-env.sh YARN gradle yarn_check-ci --profile - on_failure: - <<: *REPORTS_JUNIT_ON_FAILURE_TEMPLATE always: <<: *PROFILE_ARTIFACTS_TEMPLATE @@ -409,6 +505,7 @@ promote_task: <<: *ONLY_DEFAULT_DEPENDING_ON_BUILD_TEMPLATE depends_on: - build + - db_dao_postgres - validate - qa - qa_saml diff --git a/server/sonar-docs/build.gradle b/server/sonar-docs/build.gradle index cf4ccec3ee4..f30f4108698 100644 --- a/server/sonar-docs/build.gradle +++ b/server/sonar-docs/build.gradle @@ -87,6 +87,20 @@ task "yarn_check-ci"(type: Exec) { commandLine osAdaptiveCommand(['npm', 'run', 'check-ci']) } +task "yarn_lint-report-ci"(type: Exec) { + // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized + ['config', 'src'].each { + inputs.dir(it) + } + ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each { + inputs.file(it) + } + outputs.dir('eslint-report') + outputs.cacheIf { true } + + commandLine osAdaptiveCommand(['npm', 'run', 'lint-report-ci']) +} + task "yarn_validate-ci"(type: Exec) { // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized ['config', 'src'].each { @@ -95,7 +109,6 @@ task "yarn_validate-ci"(type: Exec) { ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each { inputs.file(it) } - outputs.file('eslint-report.json') outputs.dir('coverage') outputs.cacheIf { true } diff --git a/server/sonar-docs/package.json b/server/sonar-docs/package.json index 13f337b6f5d..e1907bb4cbb 100644 --- a/server/sonar-docs/package.json +++ b/server/sonar-docs/package.json @@ -71,10 +71,11 @@ "format": "prettier --write --list-different \"src/**/*.{js,ts,tsx,css}\"", "format-check": "prettier --list-different \"src/**/*.{js,ts,tsx,css}\"", "lint": "eslint --ext js,ts,tsx --quiet src", - "lint-report": "eslint --ext js,ts,tsx -f json -o eslint-report.json src", + "lint-report": "eslint --ext js,ts,tsx -f json -o eslint-report/eslint-report.json src", + "lint-report-ci": "yarn install --immutable && eslint --ext js,ts,tsx -f json -o eslint-report/eslint-report.json src", "ts-check": "tsc --noEmit", "validate": "yarn lint && yarn ts-check && yarn format-check && yarn test", - "validate-ci": "yarn install --immutable && yarn lint-report && yarn test --coverage --ci --reporters=default --reporters=jest-junit", + "validate-ci": "yarn install --immutable && yarn test --coverage --ci --reporters=default --reporters=jest-junit", "check-ci": "yarn install --immutable && yarn ts-check && yarn format-check", "audit-ci": "yarn npm audit --environment production --severity high" }, diff --git a/server/sonar-web/build.gradle b/server/sonar-web/build.gradle index 12316e69bcc..c6c59e1cbec 100644 --- a/server/sonar-web/build.gradle +++ b/server/sonar-web/build.gradle @@ -5,7 +5,7 @@ sonarqube { property "sonar.tests", "src/main/js" property "sonar.test.inclusions", "src/main/js/**/__tests__/**" property "sonar.exclusions", "src/main/js/**/__tests__/**" - property "sonar.eslint.reportPaths", "eslint-report.json" + property "sonar.eslint.reportPaths", "eslint-report/eslint-report.json" property "sonar.javascript.lcov.reportPaths", "coverage/lcov.info" } } @@ -26,6 +26,20 @@ task yarn_run(type: Exec) { } build.dependsOn(yarn_run) +task "yarn_lint-report-ci"(type: Exec) { + // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized + ['config', 'src/main/js'].each { + inputs.dir(it) + } + ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each { + inputs.file(it) + } + outputs.dir('eslint-report') + outputs.cacheIf { true } + + commandLine osAdaptiveCommand(['npm', 'run', 'lint-report-ci']) +} + task "yarn_validate-ci"(type: Exec) { // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized ['config', 'src/main/js'].each { @@ -34,7 +48,6 @@ task "yarn_validate-ci"(type: Exec) { ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each { inputs.file(it) } - outputs.file('eslint-report.json') outputs.dir('coverage') outputs.cacheIf { true } diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 6b5f81b68b1..afdd07e8e06 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -134,10 +134,11 @@ "format": "prettier --write --list-different \"src/main/js/**/*.{js,ts,tsx,css}\"", "format-check": "prettier --list-different \"src/main/js/**/*.{js,ts,tsx,css}\"", "lint": "eslint --ext js,ts,tsx --quiet src/main/js", - "lint-report": "eslint --ext js,ts,tsx -f json -o eslint-report.json src/main/js", + "lint-report": "eslint --ext js,ts,tsx -f json -o eslint-report/eslint-report.json src/main/js", + "lint-report-ci": "yarn install --immutable && eslint --ext js,ts,tsx -f json -o eslint-report/eslint-report.json src/main/js", "ts-check": "tsc --noEmit", "validate": "yarn lint && yarn ts-check && yarn format-check && yarn test", - "validate-ci": "yarn install --immutable && yarn lint-report && yarn test --coverage --ci", + "validate-ci": "yarn install --immutable && yarn test --coverage --ci", "check-ci": "yarn install --immutable && yarn ts-check && yarn format-check", "precommit": "yarn ts-check && lint-staged", "audit-ci": "yarn npm audit --environment production --severity high" |