ci: Remove cache of Python .venv as it added complexity
This commit is contained in:
parent
932ca44d75
commit
132e1975d3
7 changed files with 12 additions and 85 deletions
51
.github/actions/init-python/action.yml
vendored
51
.github/actions/init-python/action.yml
vendored
|
|
@ -1,50 +1,23 @@
|
|||
# Important: Do not be tempted to cache the .venv dir (Python virtual environment).
|
||||
# When the runner environment changes (e.g. Python is upgraded), the venv will need to be
|
||||
# re-created. Trying to upgrade a venv can be complex and it's usually more practical re-create it.
|
||||
# We don't save much time anyway by caching the venv so it's not worth the added complexity.
|
||||
|
||||
name: "Setup Python venv"
|
||||
description: "Creates and caches a Python virtual environment"
|
||||
|
||||
inputs:
|
||||
cache:
|
||||
description: "Cache Python venv"
|
||||
default: true
|
||||
|
||||
setup:
|
||||
description: "Setup Python venv"
|
||||
default: true
|
||||
|
||||
python-bin:
|
||||
description: "Python binary to use"
|
||||
default: "python3"
|
||||
|
||||
cache-key:
|
||||
description: "Cache key (note: hash is appended)"
|
||||
required: true
|
||||
description: "Creates a Python virtual environment (venv)"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
||||
steps:
|
||||
- name: Check cache key
|
||||
if: ${{ inputs.cache }}
|
||||
run: |
|
||||
if [ -z "${{ inputs.cache-key }}" ]; then
|
||||
echo "Cache key is required"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Cache Python venv
|
||||
if: ${{ inputs.cache }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .venv
|
||||
key: python-venv-${{ inputs.cache-key }}-${{ hashFiles('scripts/pyproject.toml') }}
|
||||
|
||||
# Use bash if to make output clearer in case of skipping.
|
||||
- name: Setup Python venv
|
||||
run: |
|
||||
if [ "${{ inputs.setup }}" = "true" ]; then
|
||||
echo "Setting up Python venv"
|
||||
${{ inputs.python-bin }} -m venv .venv
|
||||
if [ "${{ runner.os }}" == "Windows" ]; then
|
||||
python=python
|
||||
else
|
||||
echo "Skipping Python venv setup"
|
||||
python=python3
|
||||
fi
|
||||
|
||||
echo "Setting up Python venv, bin=$python"
|
||||
$python -m venv .venv
|
||||
shell: bash
|
||||
|
|
|
|||
21
.github/workflows/ci.yml
vendored
21
.github/workflows/ci.yml
vendored
|
|
@ -130,13 +130,6 @@ jobs:
|
|||
${{ env.LOCALAPPDATA }}/vcpkg
|
||||
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
|
||||
|
||||
# Should only restore the .venv directory from cache.
|
||||
- name: Init Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: ci-${{ matrix.target.name }}
|
||||
setup: false
|
||||
|
||||
- name: Cache deps dir
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
|
|
@ -218,13 +211,6 @@ jobs:
|
|||
- name: Get version
|
||||
uses: ./.github/actions/get-version
|
||||
|
||||
# Should only restore the .venv directory from cache.
|
||||
- name: Setup Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: ci-${{ matrix.target.name }}
|
||||
setup: false
|
||||
|
||||
- name: Cache deps dir
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
|
|
@ -297,13 +283,6 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Should only restore the .venv directory from cache.
|
||||
- name: Setup Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: ci-${{ matrix.distro.name }}
|
||||
setup: false
|
||||
|
||||
- name: Get version
|
||||
uses: ./.github/actions/get-version
|
||||
|
||||
|
|
|
|||
7
.github/workflows/codeql-analysis.yml
vendored
7
.github/workflows/codeql-analysis.yml
vendored
|
|
@ -27,13 +27,6 @@ jobs:
|
|||
- name: Config Git safe dir
|
||||
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
|
||||
# Should only restore the .venv directory from cache.
|
||||
- name: Init Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: "codeql"
|
||||
setup: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: ./scripts/install_deps.py
|
||||
env:
|
||||
|
|
|
|||
2
.github/workflows/lint-clang.yml
vendored
2
.github/workflows/lint-clang.yml
vendored
|
|
@ -15,8 +15,6 @@ jobs:
|
|||
|
||||
- name: Setup Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: "lint-clang"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
|
|
|||
2
.github/workflows/lint-cmake.yml
vendored
2
.github/workflows/lint-cmake.yml
vendored
|
|
@ -15,8 +15,6 @@ jobs:
|
|||
|
||||
- name: Setup Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: "lint-cmake"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
|
|
|||
7
.github/workflows/sonarcloud-analysis.yml
vendored
7
.github/workflows/sonarcloud-analysis.yml
vendored
|
|
@ -33,13 +33,6 @@ jobs:
|
|||
- name: Config Git safe dir
|
||||
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
|
||||
# Should only restore the .venv directory from cache.
|
||||
- name: Init Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: "sonarcloud"
|
||||
setup: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./scripts/install_deps.py &&
|
||||
|
|
|
|||
7
.github/workflows/valgrind-analysis.yml
vendored
7
.github/workflows/valgrind-analysis.yml
vendored
|
|
@ -17,13 +17,6 @@ jobs:
|
|||
- name: Config Git safe dir
|
||||
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
|
||||
# Should only restore the .venv directory from cache.
|
||||
- name: Init Python venv
|
||||
uses: ./.github/actions/init-python
|
||||
with:
|
||||
cache-key: "valgrind"
|
||||
setup: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./scripts/install_deps.py &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue