Skip to content

Commit

Permalink
try caching espressif docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed May 13, 2024
1 parent 4f0ee44 commit f3cf8fa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
12 changes: 10 additions & 2 deletions .github/actions/setup_toolchain/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@ runs:

- name: Pull ESP-IDF docker
if: inputs.toolchain == 'esp-idf'
run: docker pull espressif/idf:${{ inputs.toolchain_url }}
shell: bash
uses: ./.github/actions/setup_toolchain/download
with:
toolchain: ${{ inputs.toolchain }}
toolchain_url: ${{ inputs.toolchain_url }}

# - name: Pull ESP-IDF docker
# if: inputs.toolchain == 'esp-idf'
# run: docker pull espressif/idf:${{ inputs.toolchain_url }}
# shell: bash

- name: Download Toolchain
if: >-
inputs.toolchain != 'arm-gcc' &&
inputs.toolchain != 'esp-idf'
uses: ./.github/actions/setup_toolchain/download
with:
toolchain: ${{ inputs.toolchain }}
toolchain_url: ${{ inputs.toolchain_url }}

- name: Set toolchain option
Expand Down
15 changes: 9 additions & 6 deletions .github/actions/setup_toolchain/download/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Download Toolchain

inputs:
toolchain:
description: 'Toolchain name'
required: true
toolchain_url:
description: 'Toolchain URL'
required: true
type: string

runs:
using: "composite"
Expand All @@ -12,18 +15,18 @@ runs:
uses: actions/cache@v4
id: cache-toolchain
with:
path: ~/cache/toolchain
key: ${{ runner.os }}-${{ inputs.toolchain_url }}
path: ~/cache/${{ inputs.toolchain }}
key: ${{ runner.os }}-${{ inputs.toolchain }}-${{ inputs.toolchain_url }}

- name: Install Toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache/toolchain
mkdir -p ~/cache/${{ inputs.toolchain }}
wget --progress=dot:mega ${{ inputs.toolchain_url }} -O toolchain.tar.gz
tar -C ~/cache/toolchain -xaf toolchain.tar.gz
tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz
shell: bash

- name: Set Toolchain Path
run: |
echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin`
shell: bash
13 changes: 11 additions & 2 deletions tools/get_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('families', nargs='*', default=[], help='Families to fetch')
parser.add_argument('-b', '--board', action='append', default=[], help='Boards to fetch')
parser.add_argument('--print', action='store_true', help='Print commit hash only')
args = parser.parse_args()

families = args.families
boards = args.board
print_only = args.print

if len(families) == 0 and len(boards) == 0:
print("Warning: family and board are not specified, only fetching mandatory dependencies.")
Expand All @@ -268,8 +270,15 @@ def main():
if f in deps_optional[d][2]:
deps.append(d)

with Pool() as pool:
status = sum(pool.map(get_a_dep, deps))
if print_only:
pvalue = {}
for d in deps:
commit = deps_all[d][1]
pvalue[d] = commit
print(pvalue)
else:
with Pool() as pool:
status = sum(pool.map(get_a_dep, deps))
return status


Expand Down

0 comments on commit f3cf8fa

Please sign in to comment.