diff options
| author | HiFiPhile <[email protected]> | 2024-10-30 19:36:05 +0100 |
|---|---|---|
| committer | HiFiPhile <[email protected]> | 2024-10-30 19:47:03 +0100 |
| commit | 85ff529a310b7e6ec2e4234e3e292fef6432882b (patch) | |
| tree | 41218fce4db7c23df1073dfdd42fb017c3cf0158 /.github/actions | |
| parent | 418b8b2f133d695362c735f271c966af10b5d251 (diff) | |
| parent | 8b1e40c3e2447de5b4a86bbcdcc0344946a4793d (diff) | |
Merge branch 'master' into dcd_notif
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to '.github/actions')
| -rw-r--r-- | .github/actions/get_deps/action.yml | 29 | ||||
| -rw-r--r-- | .github/actions/setup_toolchain/action.yml | 72 | ||||
| -rw-r--r-- | .github/actions/setup_toolchain/download/action.yml | 39 | ||||
| -rw-r--r-- | .github/actions/setup_toolchain/espressif/action.yml | 41 |
4 files changed, 181 insertions, 0 deletions
diff --git a/.github/actions/get_deps/action.yml b/.github/actions/get_deps/action.yml new file mode 100644 index 000000000..eea241c6c --- /dev/null +++ b/.github/actions/get_deps/action.yml @@ -0,0 +1,29 @@ +name: Get dependencies + +inputs: + arg: + description: 'Arguments to get_deps.py' + required: true + +runs: + using: "composite" + steps: + - name: Checkout pico-sdk for rp2040 + if: contains(inputs.arg, 'rp2040') || contains(inputs.arg, 'raspberry_pi_pico') + uses: actions/checkout@v4 + with: + repository: raspberrypi/pico-sdk + ref: develop + path: pico-sdk + + - name: Linux dependencies + if: runner.os == 'Linux' + run: | + sudo apt install -y ninja-build + shell: bash + + - name: Get Dependencies + run: | + python3 tools/get_deps.py ${{ inputs.arg }} + echo "PICO_SDK_PATH=${{ github.workspace }}/pico-sdk" >> $GITHUB_ENV + shell: bash diff --git a/.github/actions/setup_toolchain/action.yml b/.github/actions/setup_toolchain/action.yml new file mode 100644 index 000000000..5b9bc95ce --- /dev/null +++ b/.github/actions/setup_toolchain/action.yml @@ -0,0 +1,72 @@ +name: Setup Toolchain + +inputs: + toolchain: + description: 'Toolchain name' + required: true + toolchain_version: + description: 'Toolchain version' + required: false + +outputs: + build_option: + description: 'Build option for the toolchain e.g --toolchain clang' + value: ${{ steps.set-toolchain-option.outputs.build_option }} + +runs: + using: "composite" + steps: + - name: Install ARM GCC + if: inputs.toolchain == 'arm-gcc' + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '12.3.Rel1' + + - name: Pull ESP-IDF docker + if: inputs.toolchain == 'esp-idf' + uses: ./.github/actions/setup_toolchain/espressif + with: + toolchain: ${{ inputs.toolchain }} + toolchain_version: ${{ inputs.toolchain_version }} + + - name: Get Toolchain URL + if: >- + inputs.toolchain != 'arm-gcc' && + inputs.toolchain != 'arm-iar' && + inputs.toolchain != 'esp-idf' + id: set-toolchain-url + run: | + TOOLCHAIN_JSON='{ + "aarch64-gcc": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz", + "arm-clang": "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64.tar.xz", + "msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2", + "riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz", + "rx-gcc": "http://gcc-renesas.com/downloads/get.php?f=rx/8.3.0.202004-gnurx/gcc-8.3.0.202004-GNURX-ELF.run" + }' + TOOLCHAIN_URL=$(echo $TOOLCHAIN_JSON | jq -r '.["${{ inputs.toolchain }}"]') + echo "toolchain_url=$TOOLCHAIN_URL" + echo "toolchain_url=$TOOLCHAIN_URL" >> $GITHUB_OUTPUT + shell: bash + + - 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: ${{ steps.set-toolchain-url.outputs.toolchain_url }} + + - name: Set toolchain option + id: set-toolchain-option + run: | + 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 + shell: bash diff --git a/.github/actions/setup_toolchain/download/action.yml b/.github/actions/setup_toolchain/download/action.yml new file mode 100644 index 000000000..813197208 --- /dev/null +++ b/.github/actions/setup_toolchain/download/action.yml @@ -0,0 +1,39 @@ +name: Download Toolchain + +inputs: + toolchain: + description: 'Toolchain name' + required: true + toolchain_url: + description: 'Toolchain URL' + required: true + +runs: + using: "composite" + steps: + - name: Cache Toolchain + if: ${{ !startsWith(inputs.toolchain_url, 'https://github.com') }} + uses: actions/cache@v4 + id: cache-toolchain-download + with: + path: ~/cache/${{ inputs.toolchain }} + key: ${{ runner.os }}-${{ inputs.toolchain }}-${{ inputs.toolchain_url }} + + - name: Install Toolchain + if: steps.cache-toolchain-download.outputs.cache-hit != 'true' + run: | + mkdir -p ~/cache/${{ inputs.toolchain }} + wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.tar.gz + if [[ ${{ inputs.toolchain }} == rx-gcc ]]; then + mv toolchain.tar.gz toolchain.run + chmod +x toolchain.run + ./toolchain.run -p ~/cache/${{ inputs.toolchain }}/gnurx -y + else + tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz + fi + shell: bash + + - name: Set Toolchain Path + run: | + 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..1e3ce18f1 --- /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_version: + description: 'Toolchain 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_version }} + + - name: Pull and Save Docker Image + if: steps.cache-toolchain-espressif.outputs.cache-hit != 'true' + run: | + docker pull espressif/idf:${{ inputs.toolchain_version }} + mkdir -p $(dirname $DOCKER_ESP_IDF) + docker save -o $DOCKER_ESP_IDF espressif/idf:${{ inputs.toolchain_version }} + 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 |
