Skip to content

Commit 7ebbcfe

Browse files
Enhance cache strategy with board-specific cache keys (#1777)
* fix(compile_example.yaml): Fix cache key inconsistency and correct typo in 'Compile examples' workflow * feat(compile_library.yml): Use board-specific cache keys to avoid conflicts
1 parent a37f4fc commit 7ebbcfe

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

.github/workflows/compile_examples.yaml

+21-8
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,27 @@ jobs:
3939
uses: actions/cache@v2
4040
with:
4141
path: ~/.cache/pip
42-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
43-
restore-keys: ${{ runner.os }}-pip-
42+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ github.ref }}
43+
restore-keys: |
44+
${{ runner.os }}-pip-${{ github.ref }}-
45+
${{ runner.os }}-pip-
46+
4447
- name: Cache PlatformIO
4548
uses: actions/cache@v2
4649
with:
4750
path: ~/.platformio
48-
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
51+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ github.ref }}
52+
restore-keys: |
53+
${{ runner.os }}-${{ github.ref }}-
54+
${{ runner.os }}-
55+
4956
- name: Set up Python
5057
uses: actions/setup-python@v2
5158
- name: Install PlatformIO
5259
run: |
5360
python -m pip install --upgrade pip
5461
pip install --upgrade platformio
55-
- name: Install 3rd party dependecies
62+
- name: Install 3rd party dependencies
5663
run: |
5764
pio lib -g install \
5865
file://. \
@@ -92,20 +99,25 @@ jobs:
9299
uses: actions/cache@v2
93100
with:
94101
path: ~/.cache/pip
95-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
96-
restore-keys: ${{ runner.os }}-pip-
102+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ github.ref }}
103+
restore-keys: |
104+
${{ runner.os }}-pip-${{ github.ref }}-
105+
${{ runner.os }}-pip-
97106
- name: Cache PlatformIO
98107
uses: actions/cache@v2
99108
with:
100109
path: ~/.platformio
101-
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
110+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ github.ref }}
111+
restore-keys: |
112+
${{ runner.os }}-${{ github.ref }}-
113+
${{ runner.os }}-
102114
- name: Set up Python
103115
uses: actions/setup-python@v2
104116
- name: Install PlatformIO
105117
run: |
106118
python -m pip install --upgrade pip
107119
pip install --upgrade platformio
108-
- name: Install 3rd party dependecies
120+
- name: Install 3rd party dependencies
109121
run: |
110122
pio lib -g install \
111123
file://. \
@@ -116,3 +128,4 @@ jobs:
116128
run: pio ci --board=esp32dev
117129
env:
118130
PLATFORMIO_CI_SRC: ${{ matrix.example }}
131+

.github/workflows/compile_library.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ jobs:
2929
uses: actions/cache@v2
3030
with:
3131
path: ~/.cache/pip
32-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
33-
restore-keys: ${{ runner.os }}-pip-
32+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ matrix.board }}
33+
restore-keys: |
34+
${{ runner.os }}-pip-${{ matrix.board }}-
35+
${{ runner.os }}-pip-
3436
- name: Cache PlatformIO
3537
uses: actions/cache@v2
3638
with:
3739
path: ~/.platformio
38-
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
40+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ matrix.board }}
41+
restore-keys: |
42+
${{ runner.os }}-${{ matrix.board }}-
43+
${{ runner.os }}-
3944
- name: Set up Python
4045
uses: actions/setup-python@v2
4146
- name: Install PlatformIO

0 commit comments

Comments
 (0)