Skip to content

Commit 0c354d2

Browse files
authored
Merge pull request #48 from EVWorth/workflow-improvements
Refactored the Bandit Scan to use UV, pyproject.toml for configuration, and excluding paths like tests and .venv I closed out the ~600 some CodeQL issues related to tests and this workflow update should keep those from showing back up, I also moved conftest.py into the tests folder
2 parents fad187b + b242fc3 commit 0c354d2

File tree

12 files changed

+130
-61
lines changed

12 files changed

+130
-61
lines changed

.github/workflows/bandit.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/bandit_scan.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Bandit
2+
on:
3+
push:
4+
branches: ["master"]
5+
pull_request:
6+
branches: ["master"]
7+
8+
jobs:
9+
analyze:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
# required for all workflows
13+
security-events: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup uv
18+
uses: astral-sh/setup-uv@v6
19+
20+
- name: Run Bandit
21+
run: |
22+
uv run bandit --configfile pyproject.toml --recursive . --format sarif --output results.sarif || true
23+
24+
- name: Upload SARIF report
25+
uses: github/codeql-action/upload-sarif@v3
26+
with:
27+
sarif_file: results.sarif

.github/workflows/pypi-publish.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# see https://github.com/marketplace/actions/publish-python-poetry-package
2-
31
name: Upload Release to PyPi
42

53
on:

.github/workflows/python-package.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
1+
# This workflow will install Python dependencies and run tests with supported Python versions
32

4-
name: Test Multiple Python Versions
3+
name: Test with Supported Python Versions
54

65
on:
76
push:

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dependencies = [
2626
[dependency-groups]
2727
dev = [
2828
"aioresponses>=0.7.8",
29+
"bandit[sarif,toml]>=1.8.6",
2930
"build>=1.2.2.post1",
3031
"freezegun>=1.5.2",
3132
"pre-commit>=4.2.0",
@@ -36,3 +37,6 @@ dev = [
3637
"twine>=6.1.0",
3738
"typeguard>=4.4.4",
3839
]
40+
41+
[tool.bandit]
42+
exclude_dirs = ["tests", ".venv"]
File renamed without changes.

tests/test_paa_codium.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44
from lxml import html
55

6-
from conftest import LoginType, add_signin
6+
from tests.conftest import LoginType, add_signin
77
from pyadtpulse.exceptions import PulseAuthenticationError, PulseNotLoggedInError
88
from pyadtpulse.pyadtpulse_async import PyADTPulseAsync
99
from pyadtpulse.site import ADTPulseSite

tests/test_pqm_codium.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from aiohttp.client_reqrep import ConnectionKey
1010
from yarl import URL
1111

12-
from conftest import MOCKED_API_VERSION
12+
from tests.conftest import MOCKED_API_VERSION
1313
from pyadtpulse.exceptions import (
1414
PulseClientConnectionError,
1515
PulseNotLoggedInError,

tests/test_pulse_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from aioresponses import aioresponses
1313
from pytest_mock import MockerFixture
1414

15-
from conftest import LoginType, add_custom_response, add_logout, add_signin
15+
from tests.conftest import LoginType, add_custom_response, add_logout, add_signin
1616
from pyadtpulse.const import (
1717
ADT_DEFAULT_POLL_INTERVAL,
1818
ADT_DEVICE_URI,

tests/test_pulse_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77
from lxml import html
88

9-
from conftest import LoginType, add_custom_response, add_signin
9+
from tests.conftest import LoginType, add_custom_response, add_signin
1010
from pyadtpulse.const import ADT_LOGIN_URI, DEFAULT_API_HOST
1111
from pyadtpulse.exceptions import (
1212
PulseAccountLockedError,

0 commit comments

Comments
 (0)