Skip to content

Commit

Permalink
Enhance cache strategy with board-specific cache keys (#1777)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
anilrajrimal1 authored Dec 11, 2024
1 parent a37f4fc commit 7ebbcfe
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/compile_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,27 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-pip-${{ github.ref }}-
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-${{ github.ref }}-
${{ runner.os }}-
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Install 3rd party dependecies
- name: Install 3rd party dependencies
run: |
pio lib -g install \
file://. \
Expand Down Expand Up @@ -92,20 +99,25 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-pip-${{ github.ref }}-
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-${{ github.ref }}-
${{ runner.os }}-
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Install 3rd party dependecies
- name: Install 3rd party dependencies
run: |
pio lib -g install \
file://. \
Expand All @@ -116,3 +128,4 @@ jobs:
run: pio ci --board=esp32dev
env:
PLATFORMIO_CI_SRC: ${{ matrix.example }}

11 changes: 8 additions & 3 deletions .github/workflows/compile_library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ matrix.board }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.board }}-
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}-${{ matrix.board }}
restore-keys: |
${{ runner.os }}-${{ matrix.board }}-
${{ runner.os }}-
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
Expand Down

0 comments on commit 7ebbcfe

Please sign in to comment.