Commit 500f6b36 authored by Cédric OLIVIER's avatar Cédric OLIVIER
Browse files

Merge branch 'fix-cobertura' into 'master'

Manage deprecation for artifacts:report:cobertura

Closes #31

See merge request to-be-continuous/python!43
parents b1fe6b70 9d7bcf39
Loading
Loading
Loading
Loading
+47 −5
Original line number Diff line number Diff line
@@ -83,6 +83,42 @@ The Python template features four alternative test jobs:
* or `py-nosetest` that performs tests based on [nose](https://nose.readthedocs.io/en/latest/) Python lib,
* or `py-compile` that performs byte code generation to check syntax if not tests are available.

#### Activate code coverage report artifact

Code coverage report artifact is disabled, due to a [deprecated syntax](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/78132).

To activate code coverage report artifact, you need to update python-test step depending on our gitlab version:
* gitlab < 14.10 :
```yaml
artifacts:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    expire_in: 1 day
    when: always
    reports:
      junit:
        - $PYTHON_PROJECT_DIR/reports/TEST-*.xml
      cobertura: $PYTHON_PROJECT_DIR/reports/coverage.xml
    paths:
      - $PYTHON_PROJECT_DIR/reports/
```

* gitlab >= 14.10
```yaml
artifacts:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    expire_in: 1 day
    when: always
    reports:
      junit:
        - $PYTHON_PROJECT_DIR/reports/TEST-*.xml
    coverage_report:
        ​coverage_format: cobertura
        path: ​$PYTHON_PROJECT_DIR/reports/coverage.xml
    paths:
      - $PYTHON_PROJECT_DIR/reports/
```


#### `py-unittest` job

This job is **disabled by default** and performs tests based on [unittest](https://docs.python.org/3/library/unittest.html) Python lib.
@@ -101,6 +137,8 @@ This job produces the following artifacts, kept for one day:
* JUnit test report (using the [xmlrunner](https://github.com/xmlrunner/unittest-xml-reporting) module)
* code coverage report (cobertura xml format).

:warning: code coverage report artifact is disabled, due to a deprecated syntax, see [Activate code coverage report artifact](#activate-code-coverage-report-artifact)

:warning: create a `.coveragerc` file at the root of your Python project to control the coverage settings.

Example:
@@ -131,6 +169,8 @@ This job produces the following artifacts, kept for one day:
* JUnit test report (with the [`--junit-xml`](http://doc.pytest.org/en/latest/usage.html#creating-junitxml-format-files) argument)
* code coverage report (cobertura xml format).

:warning: code coverage report artifact is disabled, due to a deprecated syntax, see [Activate code coverage report artifact](#activate-code-coverage-report-artifact)

:warning: create a `.coveragerc` file at the root of your Python project to control the coverage settings.

Example:
@@ -164,6 +204,8 @@ This job produces the following artifacts, kept for one day:
* JUnit test report (with the [`--with-xunit`](https://nose.readthedocs.io/en/latest/plugins/xunit.html) argument)
* code coverage report (cobertura xml format + html report).

:warning: code coverage report artifact is disabled, due to a deprecated syntax, see [Activate code coverage report artifact](#activate-code-coverage-report-artifact)

:warning: create a `.coveragerc` file at the root of your Python project or use [nose CLI options](https://nose.readthedocs.io/en/latest/plugins/cover.html#options) to control the coverage settings.

#### `py-compile` job
+17 −20
Original line number Diff line number Diff line
@@ -653,7 +653,6 @@ py-unittest:
    reports:
      junit:
        - $PYTHON_PROJECT_DIR/reports/TEST-*.xml
      cobertura: $PYTHON_PROJECT_DIR/reports/coverage.xml
    paths:
      - $PYTHON_PROJECT_DIR/reports/
  rules:
@@ -677,7 +676,6 @@ py-pytest:
    reports:
      junit:
        - $PYTHON_PROJECT_DIR/reports/TEST-*.xml
      cobertura: $PYTHON_PROJECT_DIR/reports/coverage.xml
    paths:
      - $PYTHON_PROJECT_DIR/reports/
  rules:
@@ -700,7 +698,6 @@ py-nosetests:
    reports:
      junit:
        - $PYTHON_PROJECT_DIR/reports/TEST-*.xml
      cobertura: $PYTHON_PROJECT_DIR/reports/coverage.xml
    paths:
      - $PYTHON_PROJECT_DIR/reports/
  rules: