From 6f45f39e9f20b0601e21d233808a211b20c4ac7b Mon Sep 17 00:00:00 2001 From: AimePazzo <108128511+AimePazzo@users.noreply.github.com> Date: Wed, 26 Jun 2024 00:36:02 +0200 Subject: [PATCH 1/2] [Delivers #187584861] setup GitHub action to run tests --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..a2827dda --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm install + + - name: Run tests + run: | + npm test -- --watchAll=false --coverage + cat ./coverage/lcov.info | ./node_modules/.bin/coveralls + + - name: Upload coverage to Coveralls + uses: coverallsapp/github-action@v2 + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} diff --git a/README.md b/README.md index 09003a78..3b32cfe9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # e-commerce-ninjas-fe +[![Maintainability](https://api.codeclimate.com/v1/badges/a7dce016f123cdcc9042/maintainability)](https://codeclimate.com/github/atlp-rwanda/e-commerce-ninjas-fe/maintainability) +[![Test Coverage](https://api.codeclimate.com/v1/badges/a7dce016f123cdcc9042/test_coverage)](https://codeclimate.com/github/atlp-rwanda/e-commerce-ninjas-fe/test_coverage) Front end repository for the teams' project From 64c7728ac158359f3aea200a0a77783cdb00ba73 Mon Sep 17 00:00:00 2001 From: AimePazzo <108128511+AimePazzo@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:08:16 +0200 Subject: [PATCH 2/2] [Delivers #187584863] setup circleci to run tests --- .circleci/config.yml | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..8f10b432 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,45 @@ +version: 2.1 + +jobs: + test: + docker: + - image: cimg/base: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 + command: | + mkdir -p test-results + npm test -- --watchAll=false --coverage --outputFile=test-results/jest.xml --json --useStderr + + - run: + name: Run tests + command: npm test -- --watchAll=false --coverage + + - 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 after-build --exit-code $? + - store_test_results: + path: test-results + + - store_artifacts: + path: coverage + destination: coverage + +workflows: + test_workflow: + jobs: + - test \ No newline at end of file