GHA: use pip requirements.txt with pins, and more venv

- requirements.txt: shorten copyright headers.

- requirements.txt: pin packages to versions.

- GHA/windows: use `tests/requirements.txt`.
  Pick a `cryptography` package version that satifies both `impacket`
  and pytests dependencies.

- GHA/checksrc: move pip deps into a new `requirements.txt`.
  To make Dependabot detect and bump them.

- GHA/checksrc: replace apt packages for python test deps with pip
  install `tests/**/requirements.txt` to a venv.

- GHA/checksrc: use venv and drop `--break-system-packages`.

- GHA/linux: fix to actually activate venvs.
  Follow-up to 2638570241 #15578

- GHA/linux: fixup (did not cause an issue)
  Follow-up to d75785c7de #18660

- GHA: create venvs later, simplify commands.

- GHA: sync pip command-line options, e.g. drop progress-bar,
  everywhere.

Assisted-by: Dan Fandrich

Closes #18708
This commit is contained in:
Viktor Szakats 2025-09-24 17:22:52 +02:00
parent 7f38bf51ad
commit 7d5f8be532
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
8 changed files with 50 additions and 83 deletions

View file

@ -55,18 +55,15 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get -o Dpkg::Use-Pty=0 update
sudo rm -f /var/lib/man-db/auto-update
sudo apt-get -o Dpkg::Use-Pty=0 install \
python3-pip python3-networkx python3-pydot python3-yaml \
python3-toml python3-markupsafe python3-jinja2 python3-tabulate \
python3-typing-extensions python3-libcst python3-impacket \
python3-websockets python3-pytest python3-filelock python3-pytest-xdist
python3 -m pip install --break-system-packages cmakelang==0.6.13 pytype==2024.10.11 ruff==0.11.9 codespell==2.4.1
python3 -m venv ~/venv
~/venv/bin/pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary \
-r .github/scripts/requirements.txt \
-r tests/http/requirements.txt \
-r tests/requirements.txt
- name: 'codespell'
run: |
source ~/venv/bin/activate
codespell --version
.github/scripts/codespell.sh
@ -78,13 +75,19 @@ jobs:
.github/scripts/typos.sh
- name: 'cmakelint'
run: scripts/cmakelint.sh
run: |
source ~/venv/bin/activate
scripts/cmakelint.sh
- name: 'pytype'
run: find . -name '*.py' -exec pytype -j auto -k {} +
run: |
source ~/venv/bin/activate
find . -name '*.py' -exec pytype -j auto -k {} +
- name: 'ruff'
run: scripts/pythonlint.sh
run: |
source ~/venv/bin/activate
scripts/pythonlint.sh
reuse:
name: 'REUSE'