Skip to content

Commit 809d08e

Browse files
ci: update requirements.txt for snyk (#692)
* ci: update requirements.txt for snyk * Generate requirements.txt on the fly in the snyk workflow * Install into system lib * activate-environment: true * Restore requirements.txt
1 parent 9f4ceb9 commit 809d08e

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

.github/workflows/snyk.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
schedule:
44
- cron: "0 10 * * 1" # Monday @ 10am UTC
55
workflow_dispatch:
6+
push:
7+
paths:
8+
- pyproject.toml
9+
- '.github/workflows/snyk.yml'
610

711
env:
812
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
@@ -12,33 +16,18 @@ jobs:
1216
snyk-monitor:
1317
runs-on: ubuntu-latest
1418
steps:
15-
- uses: actions/checkout@v3
16-
with:
17-
fetch-depth: 0
18-
19-
# - name: Run Snyk (setup.py)
20-
# uses: snyk/actions/python@master
21-
# with:
22-
# command: monitor
23-
# args: --file=setup.py --package-manager=pip --project-name=setup.py --org=${{ env.SNYK_ORG }}
19+
- uses: actions/checkout@v4
2420

25-
# - name: Run Snyk (requirements.txt)
26-
# uses: snyk/actions/python@master
27-
# with:
28-
# command: monitor
29-
# args: --file=requirements.txt --package-manager=pip --project-name=requirements.txt --org=${{ env.SNYK_ORG }}
30-
31-
# On Oct 2 2023, the steps using snyk/actions/python@master started failing with "undefined".
32-
# Nothing obvious changed in our code or in the Snyk action or Docker image.
33-
# Setting up and running snyk generically seems to work, so we'll go with that.
34-
- name: Set up Python
35-
uses: actions/setup-python@v4
21+
- name: Set up uv and Python
22+
uses: astral-sh/setup-uv@v6
3623
with:
3724
python-version: '3.11'
38-
- name: Install dependencies
25+
activate-environment: true
26+
27+
- name: Prepare requirements.txt
3928
run: |
40-
python -m pip install --upgrade pip
41-
pip install -r requirements.txt
29+
uv pip compile pyproject.toml --output-file requirements.txt
30+
uv pip install -r requirements.txt
4231
4332
- uses: snyk/actions/setup@master
4433

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# This file is just for Snyk scanning,
2-
# because it doesn't understand pyproject.toml
3-
# unless it uses Poetry.
4-
# https://github.com/snyk/snyk-python-plugin/issues/147
1+
# TODO(#649): this file shouldn't exist, but there currently are some
2+
# integration test suites that rely on it. The integration tests deserve to be
3+
# overhauled along the lines of the posit-sdk-py tests, so we can clean this up
4+
# when we do that.
55

66
# build-system.requires
77
setuptools>=61

0 commit comments

Comments
 (0)