From 1372b601ffaae75746a97e7de7732b1f81a3fb29 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 09:25:01 -0800 Subject: [PATCH 01/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 19 +- .gitignore | 3 + package.json | 13 +- packages/weather/cli/.eslintrc | 6 + packages/weather/cli/dist/index.js | 7 + packages/weather/cli/jest.config.js | 13 ++ packages/weather/cli/jest.setup.js | 1 + packages/weather/cli/package.json | 11 + packages/weather/cli/sonar-project.properties | 8 + packages/weather/cli/src/index.test.ts | 5 + packages/weather/cli/src/index.ts | 3 + packages/weather/cli/tsconfig.build.json | 5 + packages/weather/cli/tsconfig.json | 8 + packages/weather/core/jest.config.js | 6 +- packages/weather/core/package.json | 16 +- .../weather/core/sonar-project.properties | 8 + pnpm-lock.yaml | 203 ++++++++---------- 17 files changed, 197 insertions(+), 138 deletions(-) create mode 100644 packages/weather/cli/.eslintrc create mode 100644 packages/weather/cli/dist/index.js create mode 100644 packages/weather/cli/jest.config.js create mode 100644 packages/weather/cli/jest.setup.js create mode 100644 packages/weather/cli/sonar-project.properties create mode 100644 packages/weather/cli/src/index.test.ts create mode 100644 packages/weather/cli/src/index.ts create mode 100644 packages/weather/cli/tsconfig.build.json create mode 100644 packages/weather/cli/tsconfig.json create mode 100644 packages/weather/core/sonar-project.properties diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 63ae016..00f9e40 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -8,11 +8,10 @@ on: jobs: build: - runs-on: ubuntu-latest - strategy: matrix: - node-version: [14.x] + os: [ubuntu-latest] + node-version: [12.x] steps: - name: Checkout code repository @@ -41,10 +40,16 @@ jobs: run: pnpm install - name: Run build run: pnpm recursive run build - # - name: Run linting - # run: pnpm recursive run lint - # - name: Run unit tests - # run: pnpm recursive run test + - name: Run linting + run: pnpm recursive run lint + - name: Run unit tests + run: pnpm recursive run test + - name: Run SonarCloud scan + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '12.x' + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} release-manual: # Run release job only on pushes to the main branch. The job depends on completion of the build job. if: ${{ false }} # github.event_name == 'push' && github.ref == 'refs/heads/main' diff --git a/.gitignore b/.gitignore index e5d9ae7..000dfc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Jest sonar coverage reports +reports + # Logs *.log npm-debug.log* diff --git a/package.json b/package.json index a44e908..f0d1cc7 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,17 @@ "devDependencies": { "@changesets/cli": "2.17.0", "@types/node": "16.3.0", - "typescript": "4.3.5" + "typescript": "4.3.5", + "@types/jest": "26.0.24", + "@typescript-eslint/eslint-plugin": "4.28.2", + "@typescript-eslint/parser": "4.28.2", + "eslint": "7.30.0", + "eslint-config-prettier": "8.3.0", + "eslint-plugin-import": "2.23.4", + "eslint-plugin-prettier": "3.4.0", + "jest": "27.0.6", + "jest-sonar-reporter": "2.0.0", + "prettier": "2.3.2", + "ts-jest": "27.0.3" } } diff --git a/packages/weather/cli/.eslintrc b/packages/weather/cli/.eslintrc new file mode 100644 index 0000000..605e42e --- /dev/null +++ b/packages/weather/cli/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": ["../../../.eslintrc"], + "parserOptions": { + "project": "./tsconfig.json" + } +} diff --git a/packages/weather/cli/dist/index.js b/packages/weather/cli/dist/index.js new file mode 100644 index 0000000..2979876 --- /dev/null +++ b/packages/weather/cli/dist/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.addTwoNumbers = void 0; +function addTwoNumbers(a, b) { + return a + b; +} +exports.addTwoNumbers = addTwoNumbers; diff --git a/packages/weather/cli/jest.config.js b/packages/weather/cli/jest.config.js new file mode 100644 index 0000000..022728f --- /dev/null +++ b/packages/weather/cli/jest.config.js @@ -0,0 +1,13 @@ +module.exports = { + transform: { + '^.+\\.tsx?$': 'ts-jest' + }, + collectCoverage: true, + collectCoverageFrom: ['src/**/*.{ts}'], + coverageDirectory: 'reports/test/unit/coverage', + testResultsProcessor: 'jest-sonar-reporter', + setupFilesAfterEnv: ['./jest.setup.js'], + testMatch: ['**/?(*.)+(test).ts'], + testPathIgnorePatterns: ['/node_modules/'], + modulePathIgnorePatterns: ['/dist'] +}; diff --git a/packages/weather/cli/jest.setup.js b/packages/weather/cli/jest.setup.js new file mode 100644 index 0000000..09ffd35 --- /dev/null +++ b/packages/weather/cli/jest.setup.js @@ -0,0 +1 @@ +jest.setTimeout(60000); diff --git a/packages/weather/cli/package.json b/packages/weather/cli/package.json index 4a9cba0..d0890fd 100644 --- a/packages/weather/cli/package.json +++ b/packages/weather/cli/package.json @@ -4,5 +4,16 @@ "version": "0.0.12", "dependencies": { "@sap-ux/weather-core": "0.0.12" + }, + "scripts": { + "build": "tsc -p tsconfig.build.json", + "format": "prettier --write '**/*.{css,scss,html,js,json,ts,tsx,yaml,yml}' '!**/{out,dist,typings,node_modules}/**' '!**/*.{svg,png,xml}' --ignore-path ../../../.prettierignore", + "lint": "eslint . --ext .ts,.tsx --fix", + "lint:fix": "eslint . --ext .ts,.tsx", + "test": "jest --runInBand --ci --forceExit --detectOpenHandles --colors" + }, + "jestSonar": { + "reportPath": "reports/test/unit", + "reportFile": "test-report.xml" } } diff --git a/packages/weather/cli/sonar-project.properties b/packages/weather/cli/sonar-project.properties new file mode 100644 index 0000000..21f776d --- /dev/null +++ b/packages/weather/cli/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.organization=kranthie-sap +sonar.projectKey=kranthie-sap_learn-github-actions_weather_cli +sonar.project.monorepo.enabled=true +sonar.sources=src +sonar.exclusions=**/*.test.ts +sonar.tests=src +sonar.test.inclusions=**/*.test.ts +sonar.testExecutionReportPaths=test/unit/test-report.xml \ No newline at end of file diff --git a/packages/weather/cli/src/index.test.ts b/packages/weather/cli/src/index.test.ts new file mode 100644 index 0000000..aae8bfe --- /dev/null +++ b/packages/weather/cli/src/index.test.ts @@ -0,0 +1,5 @@ +import { addTwoNumbers } from '.'; + +test('test addTwoNumbers', async () => { + expect(addTwoNumbers(2, 3)).toBe(5); +}); \ No newline at end of file diff --git a/packages/weather/cli/src/index.ts b/packages/weather/cli/src/index.ts new file mode 100644 index 0000000..b5fe828 --- /dev/null +++ b/packages/weather/cli/src/index.ts @@ -0,0 +1,3 @@ +export function addTwoNumbers(a: number, b: number): number { + return a + b; +} diff --git a/packages/weather/cli/tsconfig.build.json b/packages/weather/cli/tsconfig.build.json new file mode 100644 index 0000000..5961dde --- /dev/null +++ b/packages/weather/cli/tsconfig.build.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts"], + "exclude": ["dist", "src/**/*.test.ts"] +} diff --git a/packages/weather/cli/tsconfig.json b/packages/weather/cli/tsconfig.json new file mode 100644 index 0000000..9d22de9 --- /dev/null +++ b/packages/weather/cli/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "dist" + }, + "include": ["src/**/*.ts"], + "exclude": ["dist"] +} diff --git a/packages/weather/core/jest.config.js b/packages/weather/core/jest.config.js index bdac7cb..022728f 100644 --- a/packages/weather/core/jest.config.js +++ b/packages/weather/core/jest.config.js @@ -3,9 +3,11 @@ module.exports = { '^.+\\.tsx?$': 'ts-jest' }, collectCoverage: true, - collectCoverageFrom: ['src/**/*.{ts,tsx}'], + collectCoverageFrom: ['src/**/*.{ts}'], coverageDirectory: 'reports/test/unit/coverage', + testResultsProcessor: 'jest-sonar-reporter', setupFilesAfterEnv: ['./jest.setup.js'], testMatch: ['**/?(*.)+(test).ts'], - testPathIgnorePatterns: ['/node_modules/'] + testPathIgnorePatterns: ['/node_modules/'], + modulePathIgnorePatterns: ['/dist'] }; diff --git a/packages/weather/core/package.json b/packages/weather/core/package.json index a46fb3a..6b32206 100644 --- a/packages/weather/core/package.json +++ b/packages/weather/core/package.json @@ -13,16 +13,8 @@ "lint:fix": "eslint . --ext .ts,.tsx", "test": "jest --runInBand --ci --forceExit --detectOpenHandles --colors" }, - "devDependencies": { - "@types/jest": "26.0.24", - "@typescript-eslint/eslint-plugin": "4.28.2", - "@typescript-eslint/parser": "4.28.2", - "eslint": "7.30.0", - "eslint-config-prettier": "8.3.0", - "eslint-plugin-import": "2.23.4", - "eslint-plugin-prettier": "3.4.0", - "jest": "27.0.6", - "prettier": "2.3.2", - "ts-jest": "27.0.3" + "jestSonar": { + "reportPath": "reports/test/unit", + "reportFile": "test-report.xml" } -} +} \ No newline at end of file diff --git a/packages/weather/core/sonar-project.properties b/packages/weather/core/sonar-project.properties new file mode 100644 index 0000000..4c27de6 --- /dev/null +++ b/packages/weather/core/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.organization=kranthie-sap +sonar.projectKey=kranthie-sap_learn-github-actions_weather_core +sonar.project.monorepo.enabled=true +sonar.sources=src +sonar.exclusions=**/*.test.ts +sonar.tests=src +sonar.test.inclusions=**/*.test.ts +sonar.testExecutionReportPaths=test/unit/test-report.xml \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a03ff4e..10d43ed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,11 +5,33 @@ importers: .: specifiers: '@changesets/cli': 2.17.0 + '@types/jest': 26.0.24 '@types/node': 16.3.0 + '@typescript-eslint/eslint-plugin': 4.28.2 + '@typescript-eslint/parser': 4.28.2 + eslint: 7.30.0 + eslint-config-prettier: 8.3.0 + eslint-plugin-import: 2.23.4 + eslint-plugin-prettier: 3.4.0 + jest: 27.0.6 + jest-sonar-reporter: 2.0.0 + prettier: 2.3.2 + ts-jest: 27.0.3 typescript: 4.3.5 devDependencies: '@changesets/cli': 2.17.0 + '@types/jest': 26.0.24 '@types/node': 16.3.0 + '@typescript-eslint/eslint-plugin': 4.28.2_5031fffb45dfb7117e61c1d8ea1ef3ff + '@typescript-eslint/parser': 4.28.2_eslint@7.30.0+typescript@4.3.5 + eslint: 7.30.0 + eslint-config-prettier: 8.3.0_eslint@7.30.0 + eslint-plugin-import: 2.23.4_eslint@7.30.0 + eslint-plugin-prettier: 3.4.0_0470f3bcd018a045da11d0bbb868d6c6 + jest: 27.0.6 + jest-sonar-reporter: 2.0.0 + prettier: 2.3.2 + ts-jest: 27.0.3_jest@27.0.6+typescript@4.3.5 typescript: 4.3.5 packages/plural/cli: @@ -29,32 +51,11 @@ importers: packages/weather/core: specifiers: - '@types/jest': 26.0.24 - '@typescript-eslint/eslint-plugin': 4.28.2 - '@typescript-eslint/parser': 4.28.2 dotenv: 10.0.0 - eslint: 7.30.0 - eslint-config-prettier: 8.3.0 - eslint-plugin-import: 2.23.4 - eslint-plugin-prettier: 3.4.0 - jest: 27.0.6 openweathermap-ts: 1.2.7 - prettier: 2.3.2 - ts-jest: 27.0.3 dependencies: dotenv: 10.0.0 openweathermap-ts: 1.2.7 - devDependencies: - '@types/jest': 26.0.24 - '@typescript-eslint/eslint-plugin': 4.28.2_a3b1fdfbd5b8eda7bb8034a5736f94f5 - '@typescript-eslint/parser': 4.28.2_eslint@7.30.0 - eslint: 7.30.0 - eslint-config-prettier: 8.3.0_eslint@7.30.0 - eslint-plugin-import: 2.23.4_eslint@7.30.0 - eslint-plugin-prettier: 3.4.0_0470f3bcd018a045da11d0bbb868d6c6 - jest: 27.0.6 - prettier: 2.3.2 - ts-jest: 27.0.3_jest@27.0.6 packages/weather/ui: specifiers: {} @@ -169,7 +170,7 @@ packages: '@babel/helper-replace-supers': 7.14.5 '@babel/helper-simple-access': 7.14.5 '@babel/helper-split-export-declaration': 7.14.5 - '@babel/helper-validator-identifier': 7.14.5 + '@babel/helper-validator-identifier': 7.15.7 '@babel/template': 7.14.5 '@babel/traverse': 7.14.7 '@babel/types': 7.14.5 @@ -215,11 +216,6 @@ packages: '@babel/types': 7.14.5 dev: true - /@babel/helper-validator-identifier/7.14.5: - resolution: {integrity: sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==} - engines: {node: '>=6.9.0'} - dev: true - /@babel/helper-validator-identifier/7.15.7: resolution: {integrity: sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==} engines: {node: '>=6.9.0'} @@ -412,7 +408,7 @@ packages: resolution: {integrity: sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/helper-validator-identifier': 7.14.5 + '@babel/helper-validator-identifier': 7.15.7 to-fast-properties: 2.0.0 dev: true @@ -669,7 +665,7 @@ packages: chalk: 4.1.1 emittery: 0.8.1 exit: 0.1.2 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-changed-files: 27.0.6 jest-config: 27.0.6 jest-haste-map: 27.0.6 @@ -687,7 +683,7 @@ packages: p-each-series: 2.2.0 rimraf: 3.0.2 slash: 3.0.0 - strip-ansi: 6.0.0 + strip-ansi: 6.0.1 transitivePeerDependencies: - bufferutil - canvas @@ -745,7 +741,7 @@ packages: collect-v8-coverage: 1.0.1 exit: 0.1.2 glob: 7.1.7 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 istanbul-lib-coverage: 3.0.0 istanbul-lib-instrument: 4.0.3 istanbul-lib-report: 3.0.0 @@ -769,7 +765,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: callsites: 3.1.0 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 source-map: 0.6.1 dev: true @@ -788,7 +784,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/test-result': 27.0.6 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-haste-map: 27.0.6 jest-runtime: 27.0.6 transitivePeerDependencies: @@ -805,7 +801,7 @@ packages: chalk: 4.1.1 convert-source-map: 1.8.0 fast-json-stable-stringify: 2.1.0 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-haste-map: 27.0.6 jest-regex-util: 27.0.6 jest-util: 27.0.6 @@ -1003,7 +999,7 @@ packages: '@types/yargs-parser': 20.2.1 dev: true - /@typescript-eslint/eslint-plugin/4.28.2_a3b1fdfbd5b8eda7bb8034a5736f94f5: + /@typescript-eslint/eslint-plugin/4.28.2_5031fffb45dfb7117e61c1d8ea1ef3ff: resolution: {integrity: sha512-PGqpLLzHSxq956rzNGasO3GsAPf2lY9lDUBXhS++SKonglUmJypaUtcKzRtUte8CV7nruwnDxtLUKpVxs0wQBw==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -1014,20 +1010,21 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/experimental-utils': 4.28.2_eslint@7.30.0 - '@typescript-eslint/parser': 4.28.2_eslint@7.30.0 + '@typescript-eslint/experimental-utils': 4.28.2_eslint@7.30.0+typescript@4.3.5 + '@typescript-eslint/parser': 4.28.2_eslint@7.30.0+typescript@4.3.5 '@typescript-eslint/scope-manager': 4.28.2 debug: 4.3.2 eslint: 7.30.0 functional-red-black-tree: 1.0.1 regexpp: 3.2.0 semver: 7.3.5 - tsutils: 3.21.0 + tsutils: 3.21.0_typescript@4.3.5 + typescript: 4.3.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/experimental-utils/4.28.2_eslint@7.30.0: + /@typescript-eslint/experimental-utils/4.28.2_eslint@7.30.0+typescript@4.3.5: resolution: {integrity: sha512-MwHPsL6qo98RC55IoWWP8/opTykjTp4JzfPu1VfO2Z0MshNP0UZ1GEV5rYSSnZSUI8VD7iHvtIPVGW5Nfh7klQ==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -1036,7 +1033,7 @@ packages: '@types/json-schema': 7.0.8 '@typescript-eslint/scope-manager': 4.28.2 '@typescript-eslint/types': 4.28.2 - '@typescript-eslint/typescript-estree': 4.28.2 + '@typescript-eslint/typescript-estree': 4.28.2_typescript@4.3.5 eslint: 7.30.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@7.30.0 @@ -1045,7 +1042,7 @@ packages: - typescript dev: true - /@typescript-eslint/parser/4.28.2_eslint@7.30.0: + /@typescript-eslint/parser/4.28.2_eslint@7.30.0+typescript@4.3.5: resolution: {integrity: sha512-Q0gSCN51eikAgFGY+gnd5p9bhhCUAl0ERMiDKrTzpSoMYRubdB8MJrTTR/BBii8z+iFwz8oihxd0RAdP4l8w8w==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -1057,9 +1054,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 4.28.2 '@typescript-eslint/types': 4.28.2 - '@typescript-eslint/typescript-estree': 4.28.2 + '@typescript-eslint/typescript-estree': 4.28.2_typescript@4.3.5 debug: 4.3.2 eslint: 7.30.0 + typescript: 4.3.5 transitivePeerDependencies: - supports-color dev: true @@ -1077,7 +1075,7 @@ packages: engines: {node: ^8.10.0 || ^10.13.0 || >=11.10.1} dev: true - /@typescript-eslint/typescript-estree/4.28.2: + /@typescript-eslint/typescript-estree/4.28.2_typescript@4.3.5: resolution: {integrity: sha512-86lLstLvK6QjNZjMoYUBMMsULFw0hPHJlk1fzhAVoNjDBuPVxiwvGuPQq3fsBMCxuDJwmX87tM/AXoadhHRljg==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: @@ -1090,9 +1088,10 @@ packages: '@typescript-eslint/visitor-keys': 4.28.2 debug: 4.3.2 globby: 11.0.4 - is-glob: 4.0.1 + is-glob: 4.0.3 semver: 7.3.5 - tsutils: 3.21.0 + tsutils: 3.21.0_typescript@4.3.5 + typescript: 4.3.5 transitivePeerDependencies: - supports-color dev: true @@ -1191,11 +1190,6 @@ packages: engines: {node: '>=4'} dev: true - /ansi-regex/5.0.0: - resolution: {integrity: sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==} - engines: {node: '>=8'} - dev: true - /ansi-regex/5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} @@ -1286,7 +1280,7 @@ packages: babel-plugin-istanbul: 6.0.0 babel-preset-jest: 27.0.6_@babel+core@7.14.6 chalk: 4.1.1 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 slash: 3.0.0 transitivePeerDependencies: - supports-color @@ -1525,8 +1519,8 @@ packages: /cliui/7.0.4: resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} dependencies: - string-width: 4.2.2 - strip-ansi: 6.0.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 wrap-ansi: 7.0.0 dev: true @@ -1903,7 +1897,7 @@ packages: eslint-module-utils: 2.6.1 find-up: 2.1.0 has: 1.0.3 - is-core-module: 2.4.0 + is-core-module: 2.7.0 minimatch: 3.0.4 object.values: 1.1.4 pkg-up: 2.0.0 @@ -1993,7 +1987,7 @@ packages: ignore: 4.0.6 import-fresh: 3.3.0 imurmurhash: 0.1.4 - is-glob: 4.0.1 + is-glob: 4.0.3 js-yaml: 3.14.1 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 @@ -2004,7 +1998,7 @@ packages: progress: 2.0.3 regexpp: 3.2.0 semver: 7.3.5 - strip-ansi: 6.0.0 + strip-ansi: 6.0.1 strip-json-comments: 3.1.1 table: 6.7.1 text-table: 0.2.0 @@ -2081,7 +2075,7 @@ packages: merge-stream: 2.0.0 npm-run-path: 4.0.1 onetime: 5.1.2 - signal-exit: 3.0.3 + signal-exit: 3.0.5 strip-final-newline: 2.0.0 dev: true @@ -2245,6 +2239,7 @@ packages: resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + requiresBuild: true dev: true optional: true @@ -2331,10 +2326,6 @@ packages: slash: 3.0.0 dev: true - /graceful-fs/4.2.6: - resolution: {integrity: sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==} - dev: true - /graceful-fs/4.2.8: resolution: {integrity: sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==} dev: true @@ -2508,12 +2499,6 @@ packages: ci-info: 3.2.0 dev: true - /is-core-module/2.4.0: - resolution: {integrity: sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==} - dependencies: - has: 1.0.3 - dev: true - /is-core-module/2.7.0: resolution: {integrity: sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==} dependencies: @@ -2545,13 +2530,6 @@ packages: engines: {node: '>=6'} dev: true - /is-glob/4.0.1: - resolution: {integrity: sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==} - engines: {node: '>=0.10.0'} - dependencies: - is-extglob: 2.1.1 - dev: true - /is-glob/4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} @@ -2729,7 +2707,7 @@ packages: '@jest/types': 27.0.6 chalk: 4.1.1 exit: 0.1.2 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 import-local: 3.0.2 jest-config: 27.0.6 jest-util: 27.0.6 @@ -2760,7 +2738,7 @@ packages: chalk: 4.1.1 deepmerge: 4.2.2 glob: 7.1.7 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 is-ci: 3.0.0 jest-circus: 27.0.6 jest-environment-jsdom: 27.0.6 @@ -2868,7 +2846,7 @@ packages: '@types/node': 16.3.0 anymatch: 3.1.2 fb-watchman: 2.0.1 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-regex-util: 27.0.6 jest-serializer: 27.0.6 jest-util: 27.0.6 @@ -2931,7 +2909,7 @@ packages: '@jest/types': 27.0.6 '@types/stack-utils': 2.0.1 chalk: 4.1.1 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 micromatch: 4.0.4 pretty-format: 27.0.6 slash: 3.0.0 @@ -2981,7 +2959,7 @@ packages: '@jest/types': 27.0.6 chalk: 4.1.1 escalade: 3.1.1 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-pnp-resolver: 1.2.2_jest-resolve@27.0.6 jest-util: 27.0.6 jest-validate: 27.0.6 @@ -3002,7 +2980,7 @@ packages: chalk: 4.1.1 emittery: 0.8.1 exit: 0.1.2 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-docblock: 27.0.6 jest-environment-jsdom: 27.0.6 jest-environment-node: 27.0.6 @@ -3040,7 +3018,7 @@ packages: collect-v8-coverage: 1.0.1 exit: 0.1.2 glob: 7.1.7 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-haste-map: 27.0.6 jest-message-util: 27.0.6 jest-mock: 27.0.6 @@ -3061,7 +3039,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@types/node': 16.3.0 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 dev: true /jest-snapshot/27.0.6: @@ -3081,7 +3059,7 @@ packages: babel-preset-current-node-syntax: 1.0.1_@babel+core@7.14.6 chalk: 4.1.1 expect: 27.0.6 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 jest-diff: 27.0.6 jest-get-type: 27.0.6 jest-haste-map: 27.0.6 @@ -3096,6 +3074,13 @@ packages: - supports-color dev: true + /jest-sonar-reporter/2.0.0: + resolution: {integrity: sha512-ZervDCgEX5gdUbdtWsjdipLN3bKJwpxbvhkYNXTAYvAckCihobSLr9OT/IuyNIRT1EZMDDwR6DroWtrq+IL64w==} + engines: {node: '>=8.0.0'} + dependencies: + xml: 1.0.1 + dev: true + /jest-util/27.0.6: resolution: {integrity: sha512-1JjlaIh+C65H/F7D11GNkGDDZtDfMEM8EBXsvd+l/cxtgQ6QhxuloOaiayt89DxUvDarbVhqI98HhgrM1yliFQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -3103,7 +3088,7 @@ packages: '@jest/types': 27.0.6 '@types/node': 16.3.0 chalk: 4.1.1 - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 is-ci: 3.0.0 picomatch: 2.3.0 dev: true @@ -3296,7 +3281,7 @@ packages: resolution: {integrity: sha1-L19Fq5HjMhYjT9U62rZo607AmTs=} engines: {node: '>=4'} dependencies: - graceful-fs: 4.2.6 + graceful-fs: 4.2.8 parse-json: 4.0.0 pify: 3.0.0 strip-bom: 3.0.0 @@ -3858,7 +3843,7 @@ packages: engines: {node: '>= 10'} dependencies: '@jest/types': 26.6.2 - ansi-regex: 5.0.0 + ansi-regex: 5.0.1 ansi-styles: 4.3.0 react-is: 17.0.2 dev: true @@ -3868,7 +3853,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.0.6 - ansi-regex: 5.0.0 + ansi-regex: 5.0.1 ansi-styles: 5.2.0 react-is: 17.0.2 dev: true @@ -4092,10 +4077,6 @@ packages: engines: {node: '>=8'} dev: true - /signal-exit/3.0.3: - resolution: {integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==} - dev: true - /signal-exit/3.0.5: resolution: {integrity: sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==} dev: true @@ -4203,7 +4184,7 @@ packages: engines: {node: '>=10'} dependencies: char-regex: 1.0.2 - strip-ansi: 6.0.0 + strip-ansi: 6.0.1 dev: true /string-width/2.1.1: @@ -4214,15 +4195,6 @@ packages: strip-ansi: 4.0.0 dev: true - /string-width/4.2.2: - resolution: {integrity: sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==} - engines: {node: '>=8'} - dependencies: - emoji-regex: 8.0.0 - is-fullwidth-code-point: 3.0.0 - strip-ansi: 6.0.0 - dev: true - /string-width/4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -4253,13 +4225,6 @@ packages: ansi-regex: 3.0.0 dev: true - /strip-ansi/6.0.0: - resolution: {integrity: sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==} - engines: {node: '>=8'} - dependencies: - ansi-regex: 5.0.0 - dev: true - /strip-ansi/6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -4340,8 +4305,8 @@ packages: lodash.clonedeep: 4.5.0 lodash.truncate: 4.4.2 slice-ansi: 4.0.0 - string-width: 4.2.2 - strip-ansi: 6.0.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 dev: true /term-size/1.2.0: @@ -4425,7 +4390,7 @@ packages: engines: {node: '>=8'} dev: true - /ts-jest/27.0.3_jest@27.0.6: + /ts-jest/27.0.3_jest@27.0.6+typescript@4.3.5: resolution: {integrity: sha512-U5rdMjnYam9Ucw+h0QvtNDbc5+88nxt7tbIvqaZUhFrfG4+SkWhMXjejCLVGcpILTPuV+H3W/GZDZrnZFpPeXw==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} hasBin: true @@ -4443,6 +4408,7 @@ packages: make-error: 1.3.6 mkdirp: 1.0.4 semver: 7.3.5 + typescript: 4.3.5 yargs-parser: 20.2.9 dev: true @@ -4458,13 +4424,14 @@ packages: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true - /tsutils/3.21.0: + /tsutils/3.21.0_typescript@4.3.5: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 + typescript: 4.3.5 dev: true /tty-table/2.8.13: @@ -4693,8 +4660,8 @@ packages: engines: {node: '>=10'} dependencies: ansi-styles: 4.3.0 - string-width: 4.2.2 - strip-ansi: 6.0.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 dev: true /wrappy/1.0.2: @@ -4706,7 +4673,7 @@ packages: dependencies: imurmurhash: 0.1.4 is-typedarray: 1.0.0 - signal-exit: 3.0.3 + signal-exit: 3.0.5 typedarray-to-buffer: 3.1.5 dev: true @@ -4727,6 +4694,10 @@ packages: resolution: {integrity: sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==} dev: true + /xml/1.0.1: + resolution: {integrity: sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=} + dev: true + /xmlchars/2.2.0: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} dev: true @@ -4786,7 +4757,7 @@ packages: escalade: 3.1.1 get-caller-file: 2.0.5 require-directory: 2.1.1 - string-width: 4.2.2 + string-width: 4.2.3 y18n: 5.0.8 yargs-parser: 20.2.9 dev: true From 2713f35ca809c1ad05b3fbd8ae576cd5de87d5ef Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 09:26:31 -0800 Subject: [PATCH 02/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 00f9e40..e06291d 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -12,7 +12,8 @@ jobs: matrix: os: [ubuntu-latest] node-version: [12.x] - + runs-on: ${{ matrix.os }} + timeout-minutes: 15 steps: - name: Checkout code repository uses: actions/checkout@v2 From 046b6a4e1407364cfa6e26f5ff0ddc2f1f0c779e Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 10:16:01 -0800 Subject: [PATCH 03/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 299 ++++++++++++++++++--------------- 1 file changed, 166 insertions(+), 133 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index e06291d..9131fa7 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -45,144 +45,177 @@ jobs: run: pnpm recursive run lint - name: Run unit tests run: pnpm recursive run test - - name: Run SonarCloud scan - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '12.x' - uses: sonarsource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - release-manual: - # Run release job only on pushes to the main branch. The job depends on completion of the build job. - if: ${{ false }} # github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - needs: build - steps: - - name: Checkout code repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Setup pnpm - uses: pnpm/action-setup@v2.0.1 - with: - version: 6.0.2 - run_install: true - - name: Cache pnpm modules - uses: actions/cache@v2 - env: - cache-name: cache-pnpm-modules - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - - name: Use Node.js 14.x - uses: actions/setup-node@v2 - with: - node-version: 14.x - - name: Install pnpm modules - run: pnpm install - - name: Run build - run: pnpm recursive run build - - name: Setup npmrc with npmjs.com token - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_TOKEN }}" > .npmrc - - name: Create changesets versioning and publishing PR - uses: changesets/action@master - with: - version: pnpm ci:version - commit: 'chore: bump versions and publish to npmjs' - title: 'chore: bump versions and publish to npmjs' - publish: pnpm ci:publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - version-auto: - # Run release job only on pushes to the main branch. The job depends on completion of the build job. - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - needs: build - outputs: - changes: ${{ steps.changesetVersion.outputs.changes }} # map step output to job output - steps: - - name: Checkout code repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - token: ${{ secrets.ACTIONS_PAT }} - - name: Setup pnpm - uses: pnpm/action-setup@v2.0.1 - with: - version: 6.0.2 - run_install: true - - name: Cache pnpm modules - uses: actions/cache@v2 - env: - cache-name: cache-pnpm-modules - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - - name: Use Node.js 14.x - uses: actions/setup-node@v2 - with: - node-version: 14.x - - name: Install pnpm modules - run: pnpm install - - name: Apply changesets - id: changesetVersion - run: | - echo ::set-output name=changes::$(pnpm ci:version 2>&1 | grep -q 'No unreleased changesets found' && echo 'false' || echo 'true') - git status - - name: Commit and push changes - if: steps.changesetVersion.outputs.changes == 'true' - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git status - git add -A - git status - git commit -m "chore: apply latest changesets" || echo "No changes to commit" - git log --pretty=oneline | head -n 10 - git push - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - release-auto: - # Run release job only on pushes to the main branch. The job depends on completion of the build job. - # This job needs to run after the version-auto commit has been merged - so check if that step returns 'false' - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.version-auto.outputs.changes == 'false' + - name: Upload coverage reports + uses: actions/upload-artifact@v2 + with: + name: sonar-coverage-reports + path: | + packages/**/reports/test-report.xml + # - name: Run SonarCloud scan + # if: matrix.os == 'ubuntu-latest' && matrix.node-version == '12.x' + # uses: sonarsource/sonarcloud-github-action@master + # env: + # GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + sonar-scan: + name: Run SonarCloud scan + strategy: + matrix: + project_base_dir: [ + 'packages/weather/core', + 'packages/weather/cli' + ] runs-on: ubuntu-latest - needs: version-auto steps: - name: Checkout code repository uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Setup pnpm - uses: pnpm/action-setup@v2.0.1 - with: - version: 6.0.2 - run_install: true - - name: Cache pnpm modules - uses: actions/cache@v2 - env: - cache-name: cache-pnpm-modules - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - - name: Use Node.js 14.x - uses: actions/setup-node@v2 - with: - node-version: 14.x - - name: Install pnpm modules - run: pnpm install - - name: Run build - run: pnpm recursive run build - - name: Setup npmrc with npmjs.com token - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_TOKEN }}" > .npmrc - - name: 'Publish to npmjs' - uses: changesets/action@master + - name: Download coverage reports + uses: actions/download-artifact@v2 + - name: Display structure of downloaded artifacts + run: ls -R + - name: Run SonarCloud scan + uses: sonarsource/sonarcloud-github-action@master with: - publish: pnpm ci:publish + projectBaseDir: ${{ matrix.project_base_dir }} env: - GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} + GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + # release-manual: + # # Run release job only on pushes to the main branch. The job depends on completion of the build job. + # if: ${{ false }} # github.event_name == 'push' && github.ref == 'refs/heads/main' + # runs-on: ubuntu-latest + # needs: build + # steps: + # - name: Checkout code repository + # uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + # - name: Setup pnpm + # uses: pnpm/action-setup@v2.0.1 + # with: + # version: 6.0.2 + # run_install: true + # - name: Cache pnpm modules + # uses: actions/cache@v2 + # env: + # cache-name: cache-pnpm-modules + # with: + # path: ~/.pnpm-store + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # - name: Use Node.js 14.x + # uses: actions/setup-node@v2 + # with: + # node-version: 14.x + # - name: Install pnpm modules + # run: pnpm install + # - name: Run build + # run: pnpm recursive run build + # - name: Setup npmrc with npmjs.com token + # run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_TOKEN }}" > .npmrc + # - name: Create changesets versioning and publishing PR + # uses: changesets/action@master + # with: + # version: pnpm ci:version + # commit: 'chore: bump versions and publish to npmjs' + # title: 'chore: bump versions and publish to npmjs' + # publish: pnpm ci:publish + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # version-auto: + # # Run release job only on pushes to the main branch. The job depends on completion of the build job. + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # runs-on: ubuntu-latest + # needs: build + # outputs: + # changes: ${{ steps.changesetVersion.outputs.changes }} # map step output to job output + # steps: + # - name: Checkout code repository + # uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + # token: ${{ secrets.ACTIONS_PAT }} + # - name: Setup pnpm + # uses: pnpm/action-setup@v2.0.1 + # with: + # version: 6.0.2 + # run_install: true + # - name: Cache pnpm modules + # uses: actions/cache@v2 + # env: + # cache-name: cache-pnpm-modules + # with: + # path: ~/.pnpm-store + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # - name: Use Node.js 14.x + # uses: actions/setup-node@v2 + # with: + # node-version: 14.x + # - name: Install pnpm modules + # run: pnpm install + # - name: Apply changesets + # id: changesetVersion + # run: | + # echo ::set-output name=changes::$(pnpm ci:version 2>&1 | grep -q 'No unreleased changesets found' && echo 'false' || echo 'true') + # git status + # - name: Commit and push changes + # if: steps.changesetVersion.outputs.changes == 'true' + # run: | + # git config user.name github-actions + # git config user.email github-actions@github.com + # git status + # git add -A + # git status + # git commit -m "chore: apply latest changesets" || echo "No changes to commit" + # git log --pretty=oneline | head -n 10 + # git push + # # env: + # # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # release-auto: + # # Run release job only on pushes to the main branch. The job depends on completion of the build job. + # # This job needs to run after the version-auto commit has been merged - so check if that step returns 'false' + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.version-auto.outputs.changes == 'false' + # runs-on: ubuntu-latest + # needs: version-auto + # steps: + # - name: Checkout code repository + # uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + # - name: Setup pnpm + # uses: pnpm/action-setup@v2.0.1 + # with: + # version: 6.0.2 + # run_install: true + # - name: Cache pnpm modules + # uses: actions/cache@v2 + # env: + # cache-name: cache-pnpm-modules + # with: + # path: ~/.pnpm-store + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # - name: Use Node.js 14.x + # uses: actions/setup-node@v2 + # with: + # node-version: 14.x + # - name: Install pnpm modules + # run: pnpm install + # - name: Run build + # run: pnpm recursive run build + # - name: Setup npmrc with npmjs.com token + # run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_TOKEN }}" > .npmrc + # - name: 'Publish to npmjs' + # uses: changesets/action@master + # with: + # publish: pnpm ci:publish + # env: + # GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} From a6cdb74ac83db285d843b8cff8b9286c75775d79 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 10:19:44 -0800 Subject: [PATCH 04/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 9131fa7..8e5fefc 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -67,6 +67,7 @@ jobs: 'packages/weather/cli' ] runs-on: ubuntu-latest + needs: build steps: - name: Checkout code repository uses: actions/checkout@v2 From 87327ab4042b1c790bc706894cad68b4fbca3394 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 10:23:57 -0800 Subject: [PATCH 05/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 8e5fefc..1f1bab0 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -50,7 +50,7 @@ jobs: with: name: sonar-coverage-reports path: | - packages/**/reports/test-report.xml + packages/**/reports/**/test-report.xml # - name: Run SonarCloud scan # if: matrix.os == 'ubuntu-latest' && matrix.node-version == '12.x' # uses: sonarsource/sonarcloud-github-action@master @@ -75,6 +75,8 @@ jobs: fetch-depth: 0 - name: Download coverage reports uses: actions/download-artifact@v2 + with: + name: sonar-coverage-reports - name: Display structure of downloaded artifacts run: ls -R - name: Run SonarCloud scan From dea7eb2e41fc3c4834aad13306bd7ff405203433 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 10:32:09 -0800 Subject: [PATCH 06/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 1f1bab0..6075a92 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -51,6 +51,7 @@ jobs: name: sonar-coverage-reports path: | packages/**/reports/**/test-report.xml + retention-days: 1 # - name: Run SonarCloud scan # if: matrix.os == 'ubuntu-latest' && matrix.node-version == '12.x' # uses: sonarsource/sonarcloud-github-action@master @@ -77,6 +78,7 @@ jobs: uses: actions/download-artifact@v2 with: name: sonar-coverage-reports + path: packages - name: Display structure of downloaded artifacts run: ls -R - name: Run SonarCloud scan From 47a7622042f59f1a1b3536324945ce663eeea4a1 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 10:40:42 -0800 Subject: [PATCH 07/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 6075a92..ada0104 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -78,7 +78,7 @@ jobs: uses: actions/download-artifact@v2 with: name: sonar-coverage-reports - path: packages + path: /github/workspace/packages - name: Display structure of downloaded artifacts run: ls -R - name: Run SonarCloud scan From ab69f954ef89238d787bd47bdd1f5b60080aad6e Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 10:52:22 -0800 Subject: [PATCH 08/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index ada0104..895884f 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -45,6 +45,10 @@ jobs: run: pnpm recursive run lint - name: Run unit tests run: pnpm recursive run test + - name: Display workspace directory + run: | + echo $GITHUB_WORKSPACE + cat packages/weather/core/reports/test/unit/test-report.xml - name: Upload coverage reports uses: actions/upload-artifact@v2 with: @@ -78,7 +82,11 @@ jobs: uses: actions/download-artifact@v2 with: name: sonar-coverage-reports - path: /github/workspace/packages + path: packages + - name: Display workspace directory + run: | + echo $GITHUB_WORKSPACE + cat packages/weather/core/reports/test/unit/test-report.xml - name: Display structure of downloaded artifacts run: ls -R - name: Run SonarCloud scan From 3ac0fcc0e594ac23c087f9018814952de6bf1eb4 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 11:05:01 -0800 Subject: [PATCH 09/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 895884f..e7af167 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -45,6 +45,9 @@ jobs: run: pnpm recursive run lint - name: Run unit tests run: pnpm recursive run test + - name: Replace sonar test coverage report parts + run: | + sed -i 's+/home/runner/work/learn-github-actions/learn-github-actions+/github/workspace+g' **/reports/**/test-report.xml - name: Display workspace directory run: | echo $GITHUB_WORKSPACE From 90126d735d97e730572c0e8da988663e78bd7e02 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 11:14:39 -0800 Subject: [PATCH 10/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index e7af167..a5cc434 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -47,7 +47,7 @@ jobs: run: pnpm recursive run test - name: Replace sonar test coverage report parts run: | - sed -i 's+/home/runner/work/learn-github-actions/learn-github-actions+/github/workspace+g' **/reports/**/test-report.xml + find . -name 'test-report.xml' -exec sed -i 's+/home/runner/work/learn-github-actions/learn-github-actions+/github/workspace+g' **/reports/**/test-report.xml - name: Display workspace directory run: | echo $GITHUB_WORKSPACE From 96f1a3f317b55f7aacb3d9fb05137f1623520a64 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 11:17:42 -0800 Subject: [PATCH 11/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index a5cc434..d99840e 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -47,7 +47,7 @@ jobs: run: pnpm recursive run test - name: Replace sonar test coverage report parts run: | - find . -name 'test-report.xml' -exec sed -i 's+/home/runner/work/learn-github-actions/learn-github-actions+/github/workspace+g' **/reports/**/test-report.xml + find . -name 'test-report.xml' -exec sed -i 's+/home/runner/work/learn-github-actions/learn-github-actions+/github/workspace+g' **/reports/**/test-report.xml {} \; - name: Display workspace directory run: | echo $GITHUB_WORKSPACE From 3beaa8048887a8e15966705edc1f6c32e5ca5326 Mon Sep 17 00:00:00 2001 From: Kranthi Muppala Date: Fri, 19 Nov 2021 11:19:31 -0800 Subject: [PATCH 12/12] chore: add sonarcloud scan in pipeline --- .github/workflows/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index d99840e..e190b8c 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -47,7 +47,7 @@ jobs: run: pnpm recursive run test - name: Replace sonar test coverage report parts run: | - find . -name 'test-report.xml' -exec sed -i 's+/home/runner/work/learn-github-actions/learn-github-actions+/github/workspace+g' **/reports/**/test-report.xml {} \; + find . -name 'test-report.xml' -exec sed -i 's+/home/runner/work/learn-github-actions/learn-github-actions+/github/workspace+g' {} \; - name: Display workspace directory run: | echo $GITHUB_WORKSPACE