Skip to content

Commit

Permalink
setup toolchain support esp-idf
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed May 9, 2024
1 parent 04f9535 commit bd25f58
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 22 deletions.
31 changes: 11 additions & 20 deletions .github/actions/setup_toolchain/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
required: true
type: string
toolchain_url:
required: true
required: false
type: string

runs:
Expand All @@ -17,24 +17,15 @@ runs:
with:
release: '12.3.Rel1'

- name: Cache Toolchain
if: inputs.toolchain != 'arm-gcc'
uses: actions/cache@v4
id: cache-toolchain
with:
path: ~/cache/toolchain
key: ${{ runner.os }}-${{ inputs.toolchain_url }}

- name: Install Toolchain
if: inputs.toolchain != 'arm-gcc' && steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache/toolchain
wget --progress=dot:mega ${{ inputs.toolchain_url }} -O toolchain.tar.gz
tar -C ~/cache/toolchain -xaf toolchain.tar.gz
- name: Pull ESP-IDF docker
if: inputs.toolchain == 'esp-idf'
run: docker pull espressif/idf:latest
shell: bash

- name: Set Toolchain Path
if: inputs.toolchain != 'arm-gcc'
run: |
echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
shell: bash
- name: Download Toolchain
if: >-
inputs.toolchain != 'arm-gcc' &&
inputs.toolchain != 'esp-idf'
uses: ./.github/actions/setup_toolchain/download
with:
toolchain_url: ${{ inputs.toolchain_url }}
29 changes: 29 additions & 0 deletions .github/actions/setup_toolchain/download/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Download Toolchain

inputs:
toolchain_url:
required: true
type: string

runs:
using: "composite"
steps:
- name: Cache Toolchain
uses: actions/cache@v4
id: cache-toolchain
with:
path: ~/cache/toolchain
key: ${{ runner.os }}-${{ inputs.toolchain_url }}

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

- name: Set Toolchain Path
run: |
echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
shell: bash
6 changes: 4 additions & 2 deletions .github/workflows/build_esp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ jobs:
with:
python-version: '3.x'

- name: Pull ESP-IDF docker
run: docker pull espressif/idf:latest
- name: Setup Toolchain
uses: ./.github/actions/setup_toolchain
with:
toolchain: 'esp-idf'

- name: Checkout TinyUSB
uses: actions/checkout@v4
Expand Down

0 comments on commit bd25f58

Please sign in to comment.