Skip to content

Commit

Permalink
ci: Add pip-audit security scanner (#268)
Browse files Browse the repository at this point in the history
ci: Streamline GH workflow names
  • Loading branch information
mansenfranzen authored Apr 23, 2024
1 parent 9726cc5 commit 0be2710
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-agent.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Agent
name: "AGENT: Pull request and issue AI agent"

on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: "RELEASE: Changelog Update, Tagging, and PyPI Upload"

on:
push:
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/tests-push-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Semantic Tests
name: "TESTS: Push/Pull"
on:
push:
pull_request:
Expand Down Expand Up @@ -121,4 +121,20 @@ jobs:
uses: ./.github/actions/invoke-tox
with:
tox-environment: type-checker
install-graphviz: true

security-scan:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
scan: ["lib", "dev"]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Test Environment and Run Tox
uses: ./.github/actions/invoke-tox
with:
tox-environment: security-scan${{ matrix.scan }}
install-graphviz: true
18 changes: 17 additions & 1 deletion .github/workflows/tests-scheduled.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Scheduled Tests
name: "TESTS: Scheduled"
on:
schedule:
- cron: "0 1 * * *"
Expand Down Expand Up @@ -29,3 +29,19 @@ jobs:
with:
tox-environment: pre-release
install-graphviz: true

security-scan:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
scan: ["lib", "app"]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Test Environment and Run Tox
uses: ./.github/actions/invoke-tox
with:
tox-environment: security-scan-${{ matrix.scan }}
install-graphviz: true
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ typing-extensions = { version = "^4.11", markers = "python_version <= '3.9'", op
# extras linting/formatting
ruff = { version = "^0.4.0", optional = true }

# extras security
pip-audit = { version = "^2.7.2", optional = true }

# extras erdantic
erdantic = { version ="<2.0", optional = true }

Expand All @@ -70,6 +73,8 @@ type_checking = ["mypy",
"types-docutils",
"typing-extensions"]

security = ["pip-audit"]

erdantic = ["erdantic"]

[build-system]
Expand Down
15 changes: 14 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ envlist =
linter
formatter
type-checker
security-scan-{lib,dev}
isolated_build = True

[testenv]
Expand Down Expand Up @@ -112,4 +113,16 @@ description = "Type check the codebase."
extras =
type_checking
erdantic
commands = mypy sphinxcontrib/ --explicit-package-bases
commands = mypy sphinxcontrib/ --explicit-package-bases

[testenv:security-scan{lib,dev}]
description = "Scan for security vulnerabilities."
extras =
erdantic
security
scandev: test
scandev: docs
scandev: linting
scandev: type_checking
commands =
pip-audit -v

0 comments on commit 0be2710

Please sign in to comment.