diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..ad87f7c --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,19 @@ +name: C/C++ CI + +on: + push: + branches: [ "maikebing-patch-1" ] + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup RT-Thread + uses: maikebing/rt-thread_linux_env@maikebing-patch-1 + with: + TARGET: 'mdk5' + CPPCHECK: '--enable=all --std=c99 applications/' + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 593cade..6c4eadd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update -y && \ python3-pip python3-requests python-requests -y \ scons && \ apt-get clean -y -RUN cd /tmp/ && wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/6-2016q4/gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2 && \ +RUN cd /tmp/ && wget -q https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/6-2016q4/gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2 && \ tar xf ./gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2 && \ mv gcc-arm-none-eabi-6_2-2016q4/ /opt/ && \ rm ./gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2 && \ @@ -20,7 +20,6 @@ RUN git clone https://git.code.sf.net/p/stm32flash/code stm32flash-code && \ stm32flash -h RUN git clone https://github.com/RT-Thread/env.git /env/tools/scripts && \ git clone https://github.com/RT-Thread/packages.git /env/packages/packages -ENV PATH $PATH:/env/tools/scripts -RUN echo " if [ ! -d ~/.env ]; then ln /env ~/.env -s;fi" >> /etc/bash.bashrc -RUN sed -i -e 's/CONFIG_SYS_PKGS_DOWNLOAD_ACCELERATE=y/CONFIG_SYS_PKGS_DOWNLOAD_ACCELERATE=n/g' /env/tools/scripts/cmds/.config - +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..223cd3d --- /dev/null +++ b/action.yml @@ -0,0 +1,23 @@ +# action.yml +name: 'RT-Thread CI Action' +description: 'RT-Thread CI Action' +author: 'maikebing' +branding: + icon: 'box' + color: 'blue' +inputs: + TARGET: + description: 'scons -target=?' + default: mdk5 + required: true + CPPCHECK: + default: --enable=all --std=c99 applications/ + required: false + description: 'cppcheck options' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.target }} + - ${{ inputs.std }} + \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..ed700ec --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/sh +ln /env $HOME/.env -s +export PATH=$PATH:$HOME/.env/tools/scripts +sed -i -e 's/CONFIG_SYS_PKGS_DOWNLOAD_ACCELERATE=y/CONFIG_SYS_PKGS_DOWNLOAD_ACCELERATE=n/g' /env/tools/scripts/cmds/.config +if [ -r SConstruct ]; then + pkgs --printenv + pkgs --list + pkgs --update + if [ -z "${CPPCHECK}" ]; then + cppcheck ${CPPCHECK} + fi + + if [-z "${TARGET}" ]; then + scons --target=${TARGET} + else + scons + fi +else +pkgs --help +echo "fogret checkout?" +fi \ No newline at end of file