summaryrefslogtreecommitdiff
path: root/.github/actions/setup_toolchain
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2024-05-31 12:38:18 +0200
committerHiFiPhile <[email protected]>2024-05-31 12:38:18 +0200
commitb0f5422262a26fb1ab496e33bb8009efb6660788 (patch)
treedfd2570838592e9b822e701097f18b753f32bca6 /.github/actions/setup_toolchain
parent67456357c54ee81e8418a9e814df774b1a3dee85 (diff)
parentd10b65ada4be7d5754b3128e80a9b4db72bdb23f (diff)
Merge branch 'master' of https://github.com/hathach/tinyusb into rx_fb
Diffstat (limited to '.github/actions/setup_toolchain')
-rw-r--r--.github/actions/setup_toolchain/action.yml14
-rw-r--r--.github/actions/setup_toolchain/download/action.yml22
-rw-r--r--.github/actions/setup_toolchain/espressif/action.yml41
3 files changed, 64 insertions, 13 deletions
diff --git a/.github/actions/setup_toolchain/action.yml b/.github/actions/setup_toolchain/action.yml
index e6c79e7dd..19fe28b0c 100644
--- a/.github/actions/setup_toolchain/action.yml
+++ b/.github/actions/setup_toolchain/action.yml
@@ -2,11 +2,11 @@ name: Setup Toolchain
inputs:
toolchain:
+ description: 'Toolchain name'
required: true
- type: string
toolchain_url:
+ description: 'Toolchain URL or version'
required: false
- type: string
outputs:
build_option:
@@ -24,15 +24,19 @@ 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/espressif
+ with:
+ toolchain: ${{ inputs.toolchain }}
+ toolchain_url: ${{ inputs.toolchain_url }}
- name: Download Toolchain
if: >-
inputs.toolchain != 'arm-gcc' &&
+ inputs.toolchain != 'arm-iar' &&
inputs.toolchain != 'esp-idf'
uses: ./.github/actions/setup_toolchain/download
with:
+ toolchain: ${{ inputs.toolchain }}
toolchain_url: ${{ inputs.toolchain_url }}
- name: Set toolchain option
@@ -41,6 +45,8 @@ runs:
BUILD_OPTION=""
if [[ "${{ inputs.toolchain }}" == *"clang"* ]]; then
BUILD_OPTION="--toolchain clang"
+ elif [[ "${{ inputs.toolchain }}" == "arm-iar" ]]; then
+ BUILD_OPTION="--toolchain iar"
fi
echo "build_option=$BUILD_OPTION"
echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT
diff --git a/.github/actions/setup_toolchain/download/action.yml b/.github/actions/setup_toolchain/download/action.yml
index db85e9027..2af456ef8 100644
--- a/.github/actions/setup_toolchain/download/action.yml
+++ b/.github/actions/setup_toolchain/download/action.yml
@@ -1,29 +1,33 @@
name: Download Toolchain
inputs:
+ toolchain:
+ description: 'Toolchain name'
+ required: true
toolchain_url:
+ description: 'Toolchain URL'
required: true
- type: string
runs:
using: "composite"
steps:
- name: Cache Toolchain
+ if: ${{ !startsWith(inputs.toolchain_url, 'https://github.com') }}
uses: actions/cache@v4
- id: cache-toolchain
+ id: cache-toolchain-download
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'
+ if: steps.cache-toolchain-download.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
+ mkdir -p ~/cache/${{ inputs.toolchain }}
+ wget --progress=dot:giga ${{ inputs.toolchain_url }} -O 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
diff --git a/.github/actions/setup_toolchain/espressif/action.yml b/.github/actions/setup_toolchain/espressif/action.yml
new file mode 100644
index 000000000..46da02911
--- /dev/null
+++ b/.github/actions/setup_toolchain/espressif/action.yml
@@ -0,0 +1,41 @@
+name: Setup ESP-IDF Toolchain
+
+inputs:
+ toolchain:
+ description: 'Toolchain name'
+ required: true
+ toolchain_url:
+ description: 'Toolchain URL or version'
+ required: true
+
+runs:
+ using: "composite"
+ steps:
+ - name: Set DOCKER_ESP_IDF
+ run: |
+ DOCKER_ESP_IDF=$HOME/cache/${{ inputs.toolchain }}/docker_image.tar
+ echo "DOCKER_ESP_IDF=$DOCKER_ESP_IDF" >> $GITHUB_ENV
+ shell: bash
+
+ - name: Cache Docker Image
+ uses: actions/cache@v4
+ id: cache-toolchain-espressif
+ with:
+ path: ${{ env.DOCKER_ESP_IDF }}
+ key: ${{ inputs.toolchain }}-${{ inputs.toolchain_url }}
+
+ - name: Pull and Save Docker Image
+ if: steps.cache-toolchain-espressif.outputs.cache-hit != 'true'
+ run: |
+ docker pull espressif/idf:${{ inputs.toolchain_url }}
+ mkdir -p $(dirname $DOCKER_ESP_IDF)
+ docker save -o $DOCKER_ESP_IDF espressif/idf:${{ inputs.toolchain_url }}
+ du -sh $DOCKER_ESP_IDF
+ shell: bash
+
+ - name: Load Docker Image
+ if: steps.cache-toolchain-espressif.outputs.cache-hit == 'true'
+ run: |
+ du -sh $DOCKER_ESP_IDF
+ docker load --input $DOCKER_ESP_IDF
+ shell: bash