Skip to content

Commit 7466aa4

Browse files
committed
ci(action): add pip-audit job
1 parent dbfa8f2 commit 7466aa4

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

.github/workflows/pipeline.yml

+35-1
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,44 @@ jobs:
8080
folder: badges/
8181
clean: false
8282

83+
audit:
84+
name: Pip Audit
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Check out repository
88+
uses: actions/checkout@v4
89+
- name: Install UV
90+
uses: astral-sh/setup-uv@v4
91+
- name: Set up Python
92+
uses: actions/setup-python@v5
93+
with:
94+
python-version-file: ".python-version"
95+
- name: Install the project
96+
run: uv sync --dev
97+
- name: Generate dependency tree
98+
run: uv tree
99+
- name: Generate requirements.txt
100+
run: |
101+
uv pip compile pyproject.toml -o requirements.txt
102+
- name: Pip Audit
103+
id: audit
104+
run: uvx pip-audit -r requirements.txt --fix
105+
- name: Generate Badges
106+
if: success() || failure()
107+
run: |
108+
mkdir -p badges/
109+
uv run anybadge --overwrite --value="${{ steps.audit.outcome }}" --label=audit --file=badges/audit.svg success=green failure=red
110+
- name: Publish badges to GitHub Pages
111+
if: (success() || failure()) && (github.ref_name == github.event.repository.default_branch)
112+
uses: JamesIves/github-pages-deploy-action@v4
113+
with:
114+
folder: badges/
115+
clean: false
116+
83117
pypi-publish:
84118
name: Upload release to PyPI
85119
runs-on: ubuntu-latest
86-
needs: [ ruff, pytest ]
120+
needs: [ ruff, pytest, audit ]
87121
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
88122
environment:
89123
name: pypi

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![coverage](https://github.com/scottzach1/Python-Injector-Framework/blob/gh-pages/coverage.svg?raw=true)](https://github.com/scottzach1/Python-Injector-Framework/)
66
[![pytest](https://github.com/scottzach1/Python-Injector-Framework/blob/gh-pages/pytest.svg?raw=true)](https://github.com/scottzach1/Python-Injector-Framework/)
77
[![ruff](https://github.com/scottzach1/Python-Injector-Framework/blob/gh-pages/ruff.svg?raw=true)](https://github.com/scottzach1/Python-Injector-Framework/)
8+
[![audit](https://github.com/scottzach1/Python-Injector-Framework/blob/gh-pages/audit.svg?raw=true)](https://github.com/scottzach1/Python-Injector-Framework/)
89

910
A simple Python dependency injection framework.
1011

0 commit comments

Comments
 (0)