├── .deepsource.toml ├── .editorconfig ├── .github └── CODEOWNERS ├── Dockerfile ├── LICENSE ├── README.md ├── action.yml └── main.py /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = 'python' 5 | enabled = true 6 | 7 | [analyzers.meta] 8 | max_line_length = 100 9 | skip_doc_coverage = ["module", "magic", "class"] 10 | runtime_version = '3.x.x' 11 | 12 | [[analyzers]] 13 | name = "docker" 14 | enabled = true 15 | 16 | [[transformers]] 17 | name = 'black' 18 | enabled = true 19 | 20 | [[analyzers]] 21 | name = "secrets" 22 | enabled = true 23 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.py] 12 | indent_style = space 13 | indent_size = 4 14 | 15 | [Makefile] 16 | indent_style = tab 17 | 18 | [*.md] 19 | trim_trailing_whitespace = false 20 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * srijan@deepsource.io -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8.7-slim-buster 2 | ENV PYTHONPATH /app 3 | ENV PYTHONUNBUFFERED 1 4 | ENV PYTHONDONTWRITEBYTECODE 1 5 | 6 | RUN groupadd --gid 5000 main \ 7 | && useradd --home-dir /home/main --create-home --uid 5000 \ 8 | --gid 5000 --shell /bin/sh --skel /dev/null main 9 | 10 | COPY . /app 11 | WORKDIR /app 12 | 13 | # install curl; skipcq: DOK-DL3008 14 | RUN apt-get update && apt-get install --no-install-recommends -y curl git && apt-get clean && rm -rf /var/lib/apt/lists/* 15 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 16 | 17 | # download the DeepSource CLI binary 18 | RUN curl https://deepsource.io/cli | bash 19 | RUN ["chmod", "777", "/app/main.py"] 20 | 21 | USER main 22 | 23 | CMD ["/app/main.py"] 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 DeepSource Corp. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
6 | Docs | 7 | Get Started | 8 | Discuss 9 |
10 | 11 |12 | The Code Health Platform 13 |
14 | 15 | 16 | 17 | --- 18 | 19 | GitHub Action that enables you to upload your test coverage data to DeepSource easily. You must have the [Test Coverage](https://docs.deepsource.com/docs/analyzers-test-coverage) analyzer enabled on your repository for reporting to work. 20 | 21 | If you're not using DeepSource yet, [get started for free](https://deepsource.com/). 22 | 23 | ## Usage 24 | 25 | This Action assumes that the coverage file has already been generated after the tests have run. To integrate it in your workflow, define a step which refers to this Action in your `workflow.yml` file. We recommend that you use `@master` as the ref. 26 | 27 | Ensure that you have added the `DEEPSOURCE_DSN` secret in your GitHub repository. It is available under **Settings → Code Coverage** of the repository page on DeepSource. 28 | 29 | ```yaml 30 | steps: 31 | - name: Report test coverage to DeepSource 32 | uses: deepsourcelabs/test-coverage-action@master 33 | with: 34 | key: python 35 | coverage-file: coverage.xml 36 | dsn: ${{ secrets.DEEPSOURCE_DSN }} 37 | ``` 38 | 39 | The possible inputs to this action are: 40 | 41 | * `key` (string, **required**): Programming language shortcode for which coverage is reported. e.g. `python`, `go`, `javascript`. 42 | See [the docs](https://docs.deepsource.com/docs/analyzers-test-coverage#reporting-coverage-artifact-using-the-cli) for the current list of allowed values. 43 | * `coverage-file` (string, **required**): Path to the coverage data file. e. g. `coverage.xml` 44 | * `dsn` (string, **required**): DeepSource DSN of this repository. 45 | * `fail-ci-on-error` (boolean): Should the CI build fail if there is an error while uploading the report to DeepSource? Allowed values are: `true`, `false`. This is set to `false` by default. 46 | 47 | ## License 48 | 49 | This project is released under the [MIT License](LICENSE). 50 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'DeepSource Test Coverage Action' 2 | description: 'GitHub Action that uploads test coverage reports to DeepSource for the Test Coverage analyzer.' 3 | author: 'Sanket Saurav