Skip to content

Commit

Permalink
add a coverage report to pull requests (#674)
Browse files Browse the repository at this point in the history
* add a coverage report to pull requests

* typo

* add extra exclusions

* update changelog

* bump black on pre-commit and github actions to match poetry lock

* use pre-commit mirror for faster runs
  • Loading branch information
vinnybod committed Sep 13, 2023
1 parent 0645265 commit eef291f
Show file tree
Hide file tree
Showing 6 changed files with 648 additions and 476 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@23.7.0
- uses: psf/black@23.9.1
- uses: isort/isort-action@master
with:
isort-version: 5.12.0
Expand Down Expand Up @@ -76,12 +76,21 @@ jobs:
poetry install
- name: Run test suite - mysql
run: |
DATABASE_USE=mysql poetry run pytest . -v --runslow
if [ "${{ matrix.python-version }}" = "3.11" ]; then
DATABASE_USE=mysql poetry run pytest -v --runslow --cov=empire/server --junitxml=pytest.xml --cov-report=term-missing:skip-covered . | tee pytest-coverage.txt
else
DATABASE_USE=mysql poetry run pytest -v --runslow .
fi
- name: Run test suite - sqlite
if: ${{ startsWith(github.head_ref, 'release/') || contains(github.event.pull_request.labels.*.name, 'test-sqlite') }}
run: |
DATABASE_USE=sqlite poetry run pytest . -v --runslow
- name: Pytest coverage comment
if: ${{ matrix.python-version == '3.11' }}
uses: MishaKav/pytest-coverage-comment@v1.1.48
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
test_image:
# To save CI time, only run these tests on the release PRs
if: ${{ startsWith(github.head_ref, 'release/') }}
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
language_version: python3.9
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Report test coverage on pull requests (@Vinnybod)

## [5.6.4] - 2023-09-08

- Added Stix2 to dependency list for Advanced Reports (@Cx01N)
Expand Down
2 changes: 1 addition & 1 deletion empire/server/core/plugin_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def startup_plugins(self, db: Session):
"""
Load plugins at the start of Empire
"""
plugin_path = f"{self.main_menu.installPath}/plugins"
plugin_path = f"{self.main_menu.installPath}/plugins/"
log.info(f"Searching for plugins at {plugin_path}")

# Import old v1 plugins (remove in 5.0)
Expand Down
Loading

0 comments on commit eef291f

Please sign in to comment.