Skip to content

Commit 3b2fe15

Browse files
committed
cache idf and its submodules
1 parent bad80ef commit 3b2fe15

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ jobs:
485485
if: ${{ needs.test.outputs.boards-espressif != '[]' }}
486486
env:
487487
CP_VERSION: ${{ needs.test.outputs.cp-version }}
488+
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
489+
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
488490
strategy:
489491
fail-fast: false
490492
matrix:
@@ -496,7 +498,7 @@ jobs:
496498
submodules: false
497499
fetch-depth: 1
498500
- name: Set up python
499-
id: py3
501+
id: setup-python
500502
uses: actions/setup-python@v4
501503
with:
502504
python-version: "3.10"
@@ -511,21 +513,32 @@ jobs:
511513
lib/
512514
tools/
513515
key: submodules-common-${{ hashFiles('submodule_status') }}
516+
- name: Get IDF commit
517+
id: idf-commit
518+
run: |
519+
COMMIT=$(git submodule status ports/espressif/esp-idf | grep -o -P '(?<=^-).*(?= )')
520+
echo "$COMMIT"
521+
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
522+
- name: Cache IDF submodules
523+
uses: actions/cache@v3
524+
with:
525+
path: |
526+
.git/modules/ports/espressif/esp-idf
527+
ports/espressif/esp-idf
528+
key: submodules-idf-${{ steps.idf-commit.outputs.commit }}
514529
- name: CircuitPython dependencies
515530
id: cp-deps
516531
run: python tools/ci_fetch_deps.py ${{ matrix.board }}
517532
- name: CircuitPython version
518533
run: tools/describe
519-
- uses: actions/cache@v3
520-
name: Fetch IDF tool cache
521-
id: idf-cache
534+
- name: Cache IDF tools
535+
uses: actions/cache@v3
522536
with:
523-
path: ${{ github.workspace }}/.idf_tools
524-
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-${{ steps.py3.outputs.python-path }}-20220404
537+
path: ${{ env.IDF_TOOLS_PATH }}
538+
key: ${{ runner.os }}-idf-tools-${{ steps.idf-commit.outputs.commit }}-${{ steps.setup-python.outputs.python-version }}
525539
- name: Clone IDF submodules
526-
run: cd $IDF_PATH && git submodule update --init --depth=1
527-
env:
528-
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
540+
run: git submodule update --init --depth=1
541+
working-directory: ${{ env.IDF_PATH }}
529542
- name: Install IDF tools
530543
run: |
531544
echo "Installing ESP-IDF tools"
@@ -534,28 +547,18 @@ jobs:
534547
echo "Installing Python environment and packages"
535548
$IDF_PATH/tools/idf_tools.py --non-interactive install-python-env
536549
rm -rf $IDF_TOOLS_PATH/dist
537-
env:
538-
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
539-
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
540550
- name: Install dependencies
541551
run: |
542552
source $IDF_PATH/export.sh
543553
sudo apt-get install -y gettext ninja-build
544554
pip install -r requirements-dev.txt
545-
env:
546-
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
547-
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
548555
- name: Versions
549556
run: |
550557
source $IDF_PATH/export.sh
551558
gcc --version
552559
python3 --version
553560
ninja --version
554561
cmake --version
555-
shell: bash
556-
env:
557-
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
558-
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
559562
- name: Build mpy-cross
560563
if: ${{ steps.cp-deps.outputs.frozen_tags == 'True' }}
561564
run: make -C mpy-cross -j2
@@ -566,10 +569,7 @@ jobs:
566569
source $IDF_PATH/export.sh
567570
python3 -u build_release_files.py
568571
working-directory: tools
569-
shell: bash
570572
env:
571-
IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf
572-
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
573573
BOARDS: ${{ matrix.board }}
574574
- uses: actions/upload-artifact@v3
575575
with:

0 commit comments

Comments
 (0)