|
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | strategy: |
12 | 12 | 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" ] |
14 | 14 | name: pip-audit python ${{ matrix.python-version }} |
15 | 15 | steps: |
16 | 16 | - uses: actions/checkout@v6 |
|
34 | 34 | run: | |
35 | 35 | source /tmp/PIPAUDIT/bin/activate |
36 | 36 | 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 |
39 | 115 | set -e |
40 | 116 | |
41 | 117 | if [ "$refreeze" != 0 ] ; then |
|
79 | 155 | name: Pull request with the newly generated contents |
80 | 156 | needs: |
81 | 157 | - pip-audit |
| 158 | + - pip-audit-22_04 |
82 | 159 | steps: |
83 | 160 | - name: Get analysis timestamp |
84 | 161 | id: timestamp |
|
0 commit comments