From ea36c84bf6a05ae99d4960cbe5460bc1fca4afa7 Mon Sep 17 00:00:00 2001 From: Flavius Lacatusu Date: Wed, 13 Jan 2021 13:30:54 +0100 Subject: [PATCH] feat: Run test coverage and upload artifacts to codecov (#1063) * feat: Run test coverage and upload artifacts to codecov Signed-off-by: Flavius Lacatusu * fix: Add codecov to readme and fix workflow Signed-off-by: Flavius Lacatusu * fix readme Signed-off-by: Flavius Lacatusu --- .github/workflows/codecov.yml | 24 ++++++++++++++++++++++++ README.md | 1 + package.json | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..b22e899ea --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,24 @@ +name: chectl +on: [push] +jobs: + build-and-deploy: + runs-on: ubuntu-20.04 + name: Code coverage + steps: + - name: Checkout + uses: actions/checkout@v2.3.1 + with: + persist-credentials: false + - uses: actions/setup-node@v1 + with: + node-version: '12' + - name: Install chectl dependencies + run: yarn + - name: Install codecov + run: npm install codecov -g + - name: Run unit tests + run: yarn test + - name: Submit code coverage results + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 126e65e04..4f8218f72 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ chectl [Eclipse Che](https://github.com/eclipse/che/) CLI [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) +[![Codecov](https://img.shields.io/codecov/c/github/che-incubator/chectl)](https://github.com/che-incubator/chectl) [![Build Status](https://travis-ci.org/che-incubator/chectl.svg?branch=master)](https://travis-ci.org/che-incubator/chectl) ![](https://img.shields.io/david/che-incubator/chectl.svg) diff --git a/package.json b/package.json index e19b76b34..a3139e71f 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,7 @@ "postinstall-operator": "rimraf templates/che-operator && cpx 'node_modules/eclipse-che-operator/deploy/**' 'templates/che-operator'", "postinstall-repositories": "yarn upgrade eclipse-che eclipse-che-operator eclipse-che-minishift eclipse-che-devfile-api eclipse-che-devfile-workspace-operator", "postinstall-cleanup": "rimraf node_modules/eclipse-che && rimraf node_modules/eclipse-che-operator && rimraf node_modules/eclipse-che-minishift", - "test": "jest", + "test": "jest --collect-coverage", "posttest": "tslint -p test -t stylish", "test-watch": "jest --watchAll", "e2e-minikube-helm": "export PLATFORM=minikube && export INSTALLER=helm && yarn jest ./test/e2e/e2e.test.ts --testRegex='/test/(e2e)/.*.test.ts'", @@ -161,6 +161,7 @@ "types": "lib/index.d.ts", "jest": { "collectCoverage": true, + "coverageReporters": ["json"], "collectCoverageFrom": [ "src/**/*.ts" ],