mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-02 20:30:46 -06:00
CI: install Python packages no newer than one week via uv
Plain pip has no time-based cutoff, so route the workflow's package installs through uv and set UV_EXCLUDE_NEWER to refuse releases published within the last week as supply-chain hardening. Mirror the policy in the rips pyproject for local uv installs.
This commit is contained in:
1 parent
afb0e8726a
commit
94feef8c46
2 files changed
+17
-4
No files matched your search
@@ -81,6 +81,10 @@ jobs:
|
|||||||
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
|
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
|
||||||
BUILDCACHE_ACCURACY: SLOPPY
|
BUILDCACHE_ACCURACY: SLOPPY
|
||||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||||
|
# Supply-chain hardening: never install Python packages published within
|
||||||
|
# the last week, to avoid pulling freshly published (potentially
|
||||||
|
# compromised) releases. Honored by all `uv pip install` invocations below.
|
||||||
|
UV_EXCLUDE_NEWER: "1 week"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -95,6 +99,9 @@ jobs:
|
|||||||
- name: Display Python version
|
- name: Display Python version
|
||||||
run: python -c "import sys; print(sys.version)"
|
run: python -c "import sys; print(sys.version)"
|
||||||
|
|
||||||
|
- name: Set up uv
|
||||||
|
uses: astral-sh/setup-uv@v6
|
||||||
|
|
||||||
- name: Get Python executable path
|
- name: Get Python executable path
|
||||||
shell: bash
|
shell: bash
|
||||||
id: python-path
|
id: python-path
|
||||||
@@ -105,11 +112,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
|
||||||
# rips/_version.py is normally generated by CMake; create a dev
|
# rips/_version.py is normally generated by CMake; create a dev
|
||||||
# fallback so the editable install below can resolve the version.
|
# fallback so the editable install below can resolve the version.
|
||||||
echo '__version__ = "0.0.0.dev"' > GrpcInterface/Python/rips/_version.py
|
echo '__version__ = "0.0.0.dev"' > GrpcInterface/Python/rips/_version.py
|
||||||
pip install -e GrpcInterface/Python[dev]
|
uv pip install --system -e "GrpcInterface/Python[dev]"
|
||||||
|
|
||||||
- name: Use MSVC (Windows)
|
- name: Use MSVC (Windows)
|
||||||
if: contains(matrix.config.os, 'windows')
|
if: contains(matrix.config.os, 'windows')
|
||||||
@@ -265,7 +271,7 @@ jobs:
|
|||||||
if: matrix.config.build-python-module
|
if: matrix.config.build-python-module
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install build wheel
|
uv pip install --system build wheel
|
||||||
cd GrpcInterface/Python
|
cd GrpcInterface/Python
|
||||||
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m build
|
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m build
|
||||||
|
|
||||||
@@ -273,7 +279,7 @@ jobs:
|
|||||||
if: matrix.config.build-python-module
|
if: matrix.config.build-python-module
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install mypy types-protobuf
|
uv pip install --system mypy types-protobuf
|
||||||
cd GrpcInterface/Python
|
cd GrpcInterface/Python
|
||||||
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m mypy rips/*.py rips/generated/generated_classes.py
|
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m mypy rips/*.py rips/generated/generated_classes.py
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ dev = [
|
|||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "http://www.resinsight.org"
|
Homepage = "http://www.resinsight.org"
|
||||||
|
|
||||||
|
[tool.uv]
|
||||||
|
# Supply-chain hardening: never resolve/install packages published within the
|
||||||
|
# last week, to avoid pulling freshly published (potentially compromised)
|
||||||
|
# releases. CI also enforces this via the UV_EXCLUDE_NEWER env var, since this
|
||||||
|
# setting is only discovered when uv runs from this directory.
|
||||||
|
exclude-newer = "1 week"
|
||||||
|
|
||||||
[tool.setuptools.dynamic]
|
[tool.setuptools.dynamic]
|
||||||
version = {attr = "rips._version.__version__"}
|
version = {attr = "rips._version.__version__"}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user