Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(coverage): Add Codecov #2719

Merged
merged 5 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
- uses: actions/checkout@v3
- name: Install poetry
run: |
python -m pip install --upgrade pip
pipx install poetry
python -m pip install --upgrade pip
pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
cache: "poetry"
- name: Install dependencies
run: |
poetry install
Expand Down Expand Up @@ -61,4 +61,8 @@ jobs:
/tmp/hadolint Dockerfile --ignore=DL3013
- name: Test with pytest
run: |
poetry run pytest tests -n auto
poetry run pytest -n auto --cov=./prowler --cov-report=xml tests
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ junit-reports/

# .env
.env*

# Coverage
.coverage*
coverage*
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

##@ Testing
test: ## Test with pytest
pytest -n auto -vvv -s -x
pytest -n auto -vvv -s -x
rm -rf .coverage && \
rm -rf ./htmlcov && \
pytest -n auto --cov=./prowler --cov-report=xml tests

coverage: ## Show Test Coverage
coverage run --skip-covered -m pytest -v && \
coverage report -m && \
rm -rf .coverage
coverage run --skip-covered -m pytest -v && \
coverage report -m && \
rm -rf .coverage
coverage report -m

coverage-html: ## Show Test Coverage
coverage html && \
open htmlcov/index.html

##@ Linting
format: ## Format Code
Expand Down
23 changes: 22 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ moto = "4.1.14"
openapi-spec-validator = "0.6.0"
pylint = "2.17.5"
pytest = "7.4.0"
pytest-cov = "4.1.0"
pytest-randomly = "3.13.0"
pytest-xdist = "3.3.1"
safety = "2.3.5"
Expand Down