Skip to content

Commit

Permalink
Updated workflows to use snyk
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMcGrath committed Dec 12, 2024
1 parent 037962d commit 4e0169a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--container-architecture linux/amd64
-P ubuntu-latest=catthehacker/ubuntu:act-latest
--rm
24 changes: 16 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Pull package data
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Setup up uv
run: curl -LsSf https://astral.sh/uv/0.4.5/install.sh | sh
- uses: yezz123/setup-uv@v4
- uses: snyk/actions/setup@master

- name: Build package
run: uv build

- name: Export requirements file for Snyk
run: |
uv pip compile pyproject.toml -o requirements.txt
pip3 install -r requirements.txt
- name: Run Snyk
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor --command=python3 --skip-unresolved=true

- name: Publish to PyPI
uses: pypa/[email protected]
with:
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@ jobs:
run: uv run ruff check tenint --exit-zero

- name: Run unit tests
run: uv run pytest tests --cov-report xml:cov/coverage.xml
run: uv run pytest tests --cov-report term-missing

- name: Save Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage_report
path: cov
retention-days: 1

security_tests:
runs-on: ubuntu-latest
Expand All @@ -48,12 +42,15 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Setup up uv
run: curl -LsSf https://astral.sh/uv/0.4.5/install.sh | sh

- name: Run pip-audit
- uses: yezz123/setup-uv@v4
- uses: snyk/actions/setup@master
- name: Export a requirements file for Snyk
run: |
uv export --format requirements-txt | uv tool run pip-audit
- name: Run Bandit code auditor
run: uv tool run --with "bandit[toml,baseline,sarif]" bandit -c pyproject.toml -r . -ll
uv pip compile pyproject.toml -o requirements.txt
pip3 install -r requirements.txt
- name: Snyk Scan
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test --command=python3 --skip-unresolved=true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.DS_Store
__pycache__
*.pyc
.*_cache
.coverage
.env
.vars
.secrets
requirements.txt

0 comments on commit 4e0169a

Please sign in to comment.