diff --git a/.github/workflows/django-step-tests.yml b/.github/workflows/django-step-tests.yml index c39bc968..77608974 100644 --- a/.github/workflows/django-step-tests.yml +++ b/.github/workflows/django-step-tests.yml @@ -34,6 +34,11 @@ on: type: string default: "" + COVERAGE_THRESHOLD: + required: false + type: number + default: 50 + env: "${{secrets}}" jobs: @@ -84,7 +89,7 @@ jobs: coverage erase coverage run --source='.' manage.py test --noinput coverage xml -i -o coverage-reports/coverage-django.xml - coverage report --fail-under 50 + coverage report --fail-under ${{ inputs.COVERAGE_THRESHOLD }} - name: Archive code coverage results uses: actions/upload-artifact@v3 diff --git a/.github/workflows/django-workflow-common.yml b/.github/workflows/django-workflow-common.yml index b5316393..c9c18adc 100644 --- a/.github/workflows/django-workflow-common.yml +++ b/.github/workflows/django-workflow-common.yml @@ -42,6 +42,11 @@ on: required: false type: string default: "" + COVERAGE_THRESHOLD: + required: false + type: number + default: 50 + jobs: django-lint-check: uses: @@ -69,4 +74,5 @@ jobs: SETUP_COMMANDS: ${{ inputs.SETUP_COMMANDS }} ENABLE_LFS: ${{inputs.ENABLE_LFS}} LFS_REPO_PATH: ${{inputs.LFS_REPO_PATH}} + COVERAGE_THRESHOLD: ${{inputs.COVERAGE_THRESHOLD}} secrets: inherit diff --git a/README.md b/README.md index a48ba7b9..229b8869 100644 --- a/README.md +++ b/README.md @@ -1081,6 +1081,7 @@ In addition, it is possible to specify this optional input: - **SETUP_COMMANDS**: Allow to execute commands before the download of the dependencies. Useful to install packages required for Python dependencies. - **ENABLE_LFS**: To enable Git LFS support on checkout - **LFS_REPO_PATH**: Required when ENABLE_LFS is true. Workaround for https://github.com/actions/checkout/issues/1169. Set to "/__w/repo-name/repo-name" +- **COVERAGE_THRESHOLD**: The minimal code coverage for this project. If the coverage is lower than this value, the workflow will fail. By default, it is **50**. This is an example to show how data should be formatted.