Skip to content

Commit

Permalink
Cache virtualenv between jobs
Browse files Browse the repository at this point in the history
Installation of the python dependencies and scripts is done at the start
of each job within the build.yaml workflow.

By caching the venv we can save up to 10 seconds on each job after the
first. With the planned re-introduction of #392 that splits the
chart-verifier job into 3, this can scale to up to a total of 40s per
run.

Signed-off-by: Matthias Goerens <[email protected]>
  • Loading branch information
github-actions[bot] authored and mgoerens committed Nov 19, 2024
1 parent 78e5987 commit 9d95787
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python 3.x Part 1
id: setup_python
uses: actions/setup-python@v5
with:
python-version: "3.10"
Expand All @@ -35,6 +36,12 @@ jobs:
../ve1/bin/pip3 install .
cd ..
- name: Saved cached virtualenv
uses: actions/cache/save@v4
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('scripts/requirements.txt') }}
path: ve1

- name: Check for CI changes
id: check_ci_changes
env:
Expand Down Expand Up @@ -124,10 +131,17 @@ jobs:
path: "pr-branch"

- name: Set up Python 3.x Part 1
id: setup_python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Restore cached virtualenv
uses: actions/cache/restore@v4
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('scripts/requirements.txt') }}
path: ve1

- name: Set up Python 3.x Part 2
run: |
# set up python
Expand Down Expand Up @@ -429,10 +443,17 @@ jobs:
path: "pr-branch"

- name: Set up Python 3.x Part 1
id: setup_python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Restore cached virtualenv
uses: actions/cache/restore@v4
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('scripts/requirements.txt') }}
path: ve1

- name: Set up Python 3.x Part 2
run: |
# set up python
Expand Down

0 comments on commit 9d95787

Please sign in to comment.