Skip to content

Commit 0933d0e

Browse files
author
Minh Hai Chu
authored
Add caching for Python virtual environment in CI
1 parent 363d086 commit 0933d0e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/cicd.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,32 @@ jobs:
5252
cmake \
5353
libzstd-dev
5454
55+
- name: Cache Python virtualenv with dependencies
56+
id: cache-venv
57+
uses: actions/cache@v4
58+
with:
59+
path: mlonmcu/venv
60+
key: venv-${{ runner.os }}-v2-${{ hashFiles('mlonmcu/setup.py', 'mlonmcu/requirements*.txt') }}
61+
restore-keys: |
62+
venv-${{ runner.os }}-v2-
63+
5564
- name: Create MLonMCU virtualenv
65+
if: steps.cache-venv.outputs.cache-hit != 'true'
5666
working-directory: mlonmcu
5767
shell: bash
5868
run: |
5969
echo "Setting up virtual environment..."
6070
python3 -m venv venv
6171
source venv/bin/activate
6272
pip install -e .
73+
echo "Venv created with all dependencies"
74+
75+
- name: Reinstall mlonmcu package in editable mode (fixes paths after cache)
76+
working-directory: mlonmcu
77+
shell: bash
78+
run: |
79+
source venv/bin/activate
80+
pip install -e . --no-deps
6381
6482
- name: Cache MLonMCU workspace
6583
id: cache-mlonmcu

0 commit comments

Comments
 (0)