|
| 1 | +name: RT-Thread BSP dist manual trigger |
| 2 | + |
| 3 | +# Controls when the action will run. Triggers 'scons --dist' to build the dist |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs |
| 7 | + inputs: |
| 8 | + bsp_options: |
| 9 | + description: 'Which bsp path Would you want dist in bsp?like stm32/stm32l496-st-nucleo ' |
| 10 | + required: false |
| 11 | + type: string |
| 12 | + default: 'qemu-vexpress-a9' |
| 13 | + bsp_tool_chain: |
| 14 | + description: 'Choice tool_chain' |
| 15 | + required: false |
| 16 | + default: 'sourcery-arm' |
| 17 | + type: choice |
| 18 | + options: |
| 19 | + - "sourcery-arm" |
| 20 | + - "llvm-arm" |
| 21 | + - "sourcery-aarch64" |
| 22 | + - "sourcery-mips" |
| 23 | + - "sourcery-riscv-none-embed" |
| 24 | + - "sourcery-riscv64-unknown-elf" |
| 25 | + bsp_config: |
| 26 | + description: 'Type a config you want mannual test in .config, like CONFIG_BSP_USING_I2C CONFIG_BSP_USING_WDT ' |
| 27 | + required: false |
| 28 | + type: string |
| 29 | + default: 'CONFIG_BSP_USING_GPIO' |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: read # to fetch code (actions/checkout) |
| 33 | + |
| 34 | +jobs: |
| 35 | + build: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + name: ${{ github.event.inputs.bsp_options }} |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + - name: Set up Python |
| 41 | + uses: actions/setup-python@v3 |
| 42 | + with: |
| 43 | + python-version: 3.8 |
| 44 | + |
| 45 | + - name: Install Tools |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + sudo apt-get update |
| 49 | + sudo apt-get -qq install gcc-multilib libncurses5 libncurses5-dev libncursesw5-dev scons |
| 50 | + sudo python -m pip install --upgrade pip -qq |
| 51 | + pip install requests -qq |
| 52 | + git config --global http.postBuffer 524288000 |
| 53 | + python -c "import tools.menuconfig; tools.menuconfig.touch_env()" |
| 54 | + echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV |
| 55 | + echo "RTT_CC=gcc" >> $GITHUB_ENV |
| 56 | +
|
| 57 | + - name: Install Arm ToolChains |
| 58 | + if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-arm' && success() }} |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 |
| 62 | + sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt |
| 63 | + /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version |
| 64 | + echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV |
| 65 | +
|
| 66 | + - name: Install LLVM-Arm ToolChains |
| 67 | + if: ${{ github.event.inputs.bsp_tool_chain == 'llvm-arm' && success() }} |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + wget -q https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-16.0.0/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz |
| 71 | + sudo tar zxf LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz -C /opt |
| 72 | + /opt/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin/clang --version |
| 73 | + echo "RTT_CC=llvm-arm" >> $GITHUB_ENV |
| 74 | + echo "RTT_EXEC_PATH=/opt/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin" >> $GITHUB_ENV |
| 75 | +
|
| 76 | + - name: Install AArch64 ToolChains |
| 77 | + if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-aarch64' && success() }} |
| 78 | + shell: bash |
| 79 | + run: | |
| 80 | + wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.6/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz |
| 81 | + sudo tar -xf gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz -C /opt |
| 82 | + /opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc --version |
| 83 | + echo "RTT_EXEC_PATH=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin" >> $GITHUB_ENV |
| 84 | +
|
| 85 | + - name: Install Mips ToolChains |
| 86 | + if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-mips' && success() }} |
| 87 | + shell: bash |
| 88 | + run: | |
| 89 | + wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.1/mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 |
| 90 | + sudo tar xjf mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 -C /opt |
| 91 | + /opt/mips-2016.05/bin/mips-sde-elf-gcc --version |
| 92 | + echo "RTT_EXEC_PATH=/opt/mips-2016.05/bin" >> $GITHUB_ENV |
| 93 | +
|
| 94 | + - name: Install Riscv64-unknown-elf ToolChains |
| 95 | + if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-riscv64-unknown-elf' && success() }} |
| 96 | + run: | |
| 97 | + wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz |
| 98 | + sudo tar zxf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt |
| 99 | + /opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version |
| 100 | + echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV |
| 101 | +
|
| 102 | + - name: Install Riscv-none-embed ToolChains |
| 103 | + if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-riscv-none-embed' && success() }} |
| 104 | + run: | |
| 105 | + wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.5/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz |
| 106 | + sudo tar zxf xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -C /opt |
| 107 | + /opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin/riscv-none-embed-gcc --version |
| 108 | + echo "RTT_EXEC_PATH=/opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin" >> $GITHUB_ENV |
| 109 | +
|
| 110 | + - name: Bsp Scons Compile |
| 111 | + if: ${{ success() }} |
| 112 | + shell: bash |
| 113 | + env: |
| 114 | + RTT_BSP: ${{ github.event.inputs.bsp_options }} |
| 115 | + RTT_TOOL_CHAIN: ${{ github.event.inputs.bsp_tool_chain}} |
| 116 | + run: | |
| 117 | + source ~/.env/env.sh |
| 118 | + echo $RTT_BSP |
| 119 | + ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent |
| 120 | + sed -i "s/# ${{ github.event.inputs.bsp_config }} is not set/${{ github.event.inputs.bsp_config }}=y/g" bsp/$RTT_BSP/.config |
| 121 | + pushd bsp/$RTT_BSP && pkgs --update && popd |
| 122 | + scons -C bsp/$RTT_BSP -j$(nproc) |
| 123 | + mkdir -p ${{ github.workspace }}/$RTT_BSP |
| 124 | + cp -r bsp/$RTT_BSP ${{ github.workspace }}/$RTT_BSP/ |
| 125 | + scons --dist -C bsp/$RTT_BSP |
| 126 | + cp bsp/$RTT_BSP/dist/project.zip ${{ github.workspace }}/$RTT_BSP/ |
| 127 | + ls bsp/$RTT_BSP/dist |
| 128 | + pwd |
| 129 | + - uses: actions/upload-artifact@v3 |
| 130 | + with: |
| 131 | + name: dist_file |
| 132 | + path: ${{ github.workspace }}/${{ github.event.inputs.bsp_options }}/* |
| 133 | + |
0 commit comments