diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml new file mode 100644 index 000000000..26859a9ae --- /dev/null +++ b/.github/workflows/code-coverage.yml @@ -0,0 +1,50 @@ +name: Code Coverage Report + +on: + push: + branches: + - main + pull_request: + branches: [ main ] + +jobs: + coverage-report: + name: Check Code Coverage + runs-on: ubuntu-20.04 + steps: + - + name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: 1.16.6 + - + name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - + name: Check out code into the Go module directory + uses: actions/checkout@v2 + - + name: Cache go modules + id: cache-mod + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - + name: Download dependencies + run: go mod download + if: steps.cache-mod.outputs.cache-hit != 'true' + - + name: Run Go Tests + run: | + python -m pip install --upgrade pip yq + make test + - + name: Build Codecov report + uses: codecov/codecov-action@v1 + with: + files: cover.out diff --git a/README.md b/README.md index fb1222d84..6a636db7e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Dev Workspace Operator +[![codecov](https://codecov.io/gh/devfile/devworkspace-operator/branch/main/graph/badge.svg)](https://codecov.io/gh//devfile/devworkspace-operator) + Dev Workspace operator repository that contains the controller for the DevWorkspace Custom Resource. The Kubernetes API of the DevWorkspace is defined in the https://github.com/devfile/api repository. ## DevWorkspace CR @@ -180,3 +182,5 @@ This will delete all custom resource definitions created for the controller, as #### GitHub actions - [Next Dockerimage](https://github.com/devfile/devworkspace-operator/blob/main/.github/workflows/dockerimage-next.yml) action builds main branch and pushes it to [quay.io/devfile/devworkspace-controller:next](https://quay.io/repository/devfile/devworkspace-controller?tag=latest&tab=tags) + +- [Code Coverage Report](./.github/workflows/code-coverage.yml) action creates a code coverage report using [codecov.io](https://about.codecov.io/). diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..77707aa1d --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +github_checks: + annotations: false