Skip to content

Commit 0950932

Browse files
committed
chore: pipeline improvements
1 parent 82f4724 commit 0950932

3 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Weekly Security Scan
2+
3+
on:
4+
schedule:
5+
# Run every Monday at 9:00 AM UTC
6+
- cron: '0 9 * * 1'
7+
workflow_dispatch: # Allow manual triggering from any branch
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
security-scan:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.10"
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install tox
28+
29+
- name: Get package name and latest release version
30+
id: get_info
31+
run: |
32+
PACKAGE_NAME=$(grep -E '^name = ' pyproject.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
33+
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
34+
echo "Package name: $PACKAGE_NAME"
35+
36+
LATEST_VERSION=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name' | sed 's/^v//')
37+
echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT
38+
echo "Latest version: $LATEST_VERSION"
39+
40+
- name: Run security scan with tox
41+
env:
42+
PACKAGE_NAME: ${{ steps.get_info.outputs.package_name }}
43+
PACKAGE_VERSION: ${{ steps.get_info.outputs.version }}
44+
run: tox -e security
45+
timeout-minutes: 10

.releaserc.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ plugins:
88
- preset: conventionalcommits
99
releaseRules:
1010
- type: feat
11+
release: patch
12+
- type: minor
1113
release: minor
14+
- type: impr
15+
release: patch
1216
- type: fix
1317
release: patch
1418
- type: perf
@@ -35,6 +39,12 @@ plugins:
3539
- type: feat
3640
section: "Features"
3741
hidden: false
42+
- type: minor
43+
section: "Minor Changes"
44+
hidden: false
45+
- type: impr
46+
section: "Improvements"
47+
hidden: false
3848
- type: fix
3949
section: "Bug Fixes"
4050
hidden: false

tox.ini

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,27 @@ commands =
1111
ruff check .
1212
mypy --strict --ignore-missing-imports .
1313
bandit -c pyproject.toml -r -q .
14+
15+
[testenv:security]
16+
# CVE scanning environment - downloads specific version of published package
17+
skip_install = False
18+
usedevelop = False
19+
deps =
20+
pip-audit
21+
allowlist_externals = sh, rm, mkdir
22+
commands =
23+
mkdir -p security-reports
24+
25+
sh -c "pip uninstall -y {env:PACKAGE_NAME} || true"
26+
27+
sh -c "pip install {env:PACKAGE_NAME}=={env:PACKAGE_VERSION}"
28+
29+
sh -c "pip list"
30+
31+
# Run CVE scan
32+
sh -c "pip-audit --desc --format=json --output=security-reports/pip-audit-version.json || pip-audit --desc"
33+
34+
# Display summary
35+
sh -c "echo '=== CVE Scan Summary ==='"
36+
sh -c "echo 'Tool: pip-audit (Apache 2.0 licensed)'"
37+
sh -c "echo 'Report: security-reports/pip-audit-version.json'"

0 commit comments

Comments
 (0)