From af687130c333f44273bc36f9304a45f4f614b704 Mon Sep 17 00:00:00 2001 From: AliciaSymphony Date: Mon, 24 May 2021 16:40:05 +0200 Subject: [PATCH] APP-4064 ci(diff-coverage): add code climate to the ci config --- .circleci/config.yml | 30 ++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 31 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 32cd663a..b35540fe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,10 +12,40 @@ jobs: - run: yarn - run: yarn lint - run: yarn check-circular + # Run jest tests - run: + name: Run tests command: yarn test-once environment: NODE_OPTIONS: --max_old_space_size=4096 + # Run coverage + - run: + name: Run coverage + command: yarn run cover + environment: + NODE_OPTIONS: --max_old_space_size=4096 + when: always + # Run coverage report for Code Climate + - run: + name: Setup Code Climate test-reporter + command: | + # download test reporter as a static binary + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + when: always + - run: + name: Send coverage report to Code Climate + command: + ./cc-test-reporter after-build -t lcov + environment: + CC_TEST_REPORTER_ID: 8150d54c3d819c99c080dda0f89f8a0be0245ed8d9321f8054f8077883ba86c9 + when: always + # Upload results + - store_artifacts: # upload test coverage as artifact + path: ./coverage/lcov.info + prefix: tests + - run: yarn build - run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - run: bash ./publish.sh diff --git a/package.json b/package.json index 6fab8731..5388670b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "build-storybook": "build-storybook -c .storybook -o dist/storybook", "test": "jest --watchAll", "test-once": "jest -w 1", + "cover": "jest -w 1 --coverage", "check-circular": "madge --circular --extensions ts,tsx ./", "linkit": "yarn build && cp package.json ./dist && cd ./dist && yarn link && cd .." },