diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..cebc98b4 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,40 @@ +version: 2.1 + +jobs: + test: + docker: + - image: cimg/node:current + steps: + - setup_remote_docker: + version: docker24 + - checkout + - run: + name: Update npm + command: "sudo npm install -g npm@latest" + - run: + name: Install dependencies + command: npm install + - run: + name: Run tests and generate coverage + command: | + mkdir -p test-results + npm test -- --watchAll=false --coverage --outputFile=test-results/jest.xml --json --useStderr + - run: + name: Upload coverage to Code Climate + command: | + 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 + ./cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.json coverage/lcov.info + ./cc-test-reporter upload-coverage + ./cc-test-reporter after-build --exit-code $? + - store_test_results: + path: test-results + - store_artifacts: + path: coverage + destination: coverage + +workflows: + test_workflow: + jobs: + - test diff --git a/README.md b/README.md index 1fc8f668..c342b251 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Our e-commerce web application server, developed by Team Ninjas, facilitates smo [![Test Coverage](https://api.codeclimate.com/v1/badges/a7dce016f123cdcc9042/test_coverage)](https://codeclimate.com/github/atlp-rwanda/e-commerce-ninjas-fe/test_coverage) [![Netlify Status](https://api.netlify.com/api/v1/badges/a3ed5a75-a862-4f3b-ba21-8369180cf3e6/deploy-status)](https://app.netlify.com/sites/e-commerce-ninja-fn-staging/deploys) [![Coverage Status](https://coveralls.io/repos/github/atlp-rwanda/e-commerce-ninjas-fe/badge.svg)](https://coveralls.io/github/atlp-rwanda/e-commerce-ninjas-fe) +[![CircleCI](https://dl.circleci.com/status-badge/img/gh/atlp-rwanda/e-commerce-ninjas-fe/tree/develop.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/atlp-rwanda/e-commerce-ninjas-fe/tree/develop) ## Completed features - Setup empty react