Skip to content

Commit 2d11ce8

Browse files
committed
CI workflows maintainance work
1 parent ce32d7e commit 2d11ce8

File tree

2 files changed

+81
-3
lines changed

2 files changed

+81
-3
lines changed

.github/workflows/pip-audit.yml

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
13+
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
1414
name: pip-audit python ${{ matrix.python-version }}
1515
steps:
1616
- uses: actions/checkout@v6
@@ -34,8 +34,84 @@ jobs:
3434
run: |
3535
source /tmp/PIPAUDIT/bin/activate
3636
set +e
37-
pip-audit --desc=on --progress-spinner=off -r constraints-${{ matrix.python-version }}.txt --no-deps --disable-pip -f markdown -o /tmp/report-before.md
38-
refreeze=$?
37+
if [ -f constraints-${{ matrix.python-version }}.txt ] ; then
38+
pip-audit --desc=on --progress-spinner=off -r constraints-${{ matrix.python-version }}.txt --no-deps --disable-pip -f markdown -o /tmp/report-before.md
39+
refreeze=$?
40+
else
41+
touch /tmp/report-before.md
42+
refreeze=1
43+
fi
44+
set -e
45+
46+
if [ "$refreeze" != 0 ] ; then
47+
deactivate
48+
python -mvenv /tmp/PIPFREEZE
49+
source /tmp/PIPFREEZE/bin/activate
50+
pip install --upgrade pip wheel
51+
pip install -r requirements.txt
52+
pip freeze > constraints-${{ matrix.python-version }}.txt
53+
54+
# Re-audit the populated environment
55+
deactivate
56+
source /tmp/PIPAUDIT/bin/activate
57+
set +e
58+
pip-audit --desc=on --progress-spinner=off -r constraints-${{ matrix.python-version }}.txt --no-deps --disable-pip -f markdown -o /tmp/report-after.md
59+
auditres=$?
60+
set -e
61+
62+
if [ "$auditres" = 0 ] ; then
63+
echo "# Fixed dependency issues for Python ${{ matrix.python-version }}" > audit-report-${{ matrix.python-version }}.md
64+
cat /tmp/report-before.md >> audit-report-${{ matrix.python-version }}.md
65+
else
66+
# Time to emit the report
67+
echo "# Dependency issues not solved for Python ${{ matrix.python-version }}" > audit-report-${{ matrix.python-version }}.md
68+
cat /tmp/report-after.md >> audit-report-${{ matrix.python-version }}.md
69+
fi
70+
cat audit-report-${{ matrix.python-version }}.md >> "$GITHUB_STEP_SUMMARY"
71+
fi
72+
- uses: actions/upload-artifact@v7
73+
with:
74+
name: audit-${{ matrix.python-version }}
75+
retention-days: 2
76+
path: |
77+
constraints-${{ matrix.python-version }}.txt
78+
audit-report-${{ matrix.python-version }}.md
79+
80+
pip-audit-22_04:
81+
runs-on: ubuntu-22.04
82+
strategy:
83+
matrix:
84+
python-version: [ "3.7" ]
85+
name: pip-audit python ${{ matrix.python-version }}
86+
steps:
87+
- uses: actions/checkout@v6
88+
- uses: actions/setup-python@v6
89+
with:
90+
python-version: ${{ matrix.python-version }}
91+
cache: 'pip'
92+
cache-dependency-path: |
93+
requirements.txt
94+
architecture: x64
95+
- name: 'Install requirements (standard or constraints ${{ matrix.python-version }})'
96+
run: |
97+
python -mvenv /tmp/PIPAUDIT
98+
source /tmp/PIPAUDIT/bin/activate
99+
pip install --upgrade pip wheel
100+
pip install pip-audit
101+
# - name: 'Freeze Python ${{ matrix.python-version }} constraints'
102+
# run: |
103+
# pip freeze > constraints-${{ matrix.python-version }}.txt
104+
- id: gen-cve-output
105+
run: |
106+
source /tmp/PIPAUDIT/bin/activate
107+
set +e
108+
if [ -f constraints-${{ matrix.python-version }}.txt ] ; then
109+
pip-audit --desc=on --progress-spinner=off -r constraints-${{ matrix.python-version }}.txt --no-deps --disable-pip -f markdown -o /tmp/report-before.md
110+
refreeze=$?
111+
else
112+
touch /tmp/report-before.md
113+
refreeze=1
114+
fi
39115
set -e
40116
41117
if [ "$refreeze" != 0 ] ; then
@@ -79,6 +155,7 @@ jobs:
79155
name: Pull request with the newly generated contents
80156
needs:
81157
- pip-audit
158+
- pip-audit-22_04
82159
steps:
83160
- name: Get analysis timestamp
84161
id: timestamp

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ jobs:
219219
if: steps.move.outputs.skip == 'false'
220220
with:
221221
title: Updated constraints (triggered on ${{ steps.timestamp.outputs.timestamp }} by ${{ github.sha }})
222+
branch: create-pull-request/patch-constraints
222223
add-paths: constraints-*.txt
223224
delete-branch: true
224225
commit-message: "[create-pull-request] Automatically commit updated contents (constraints)"

0 commit comments

Comments
 (0)