name: build on: pull_request: types: - synchronize - reopened - opened push: branches: - master workflow_dispatch: env: TAG_NAME: latest MAX_KERNEL_SIZE: 0x200000 MAX_ROOTFS_SIZE: 0x500000 MAX_KERNEL_SIZE_ULTIMATE: 0x300000 MAX_ROOTFS_SIZE_ULTIMATE: 0xA00000 MAX_KERNEL_SIZE_NAND: 0x0800000 MAX_ROOTFS_SIZE_NAND: 0x1000000 TG_TOKEN: ${{secrets.TELEGRAM_TOKEN_BOT_OPENIPC}} TG_CHANNEL: ${{secrets.TELEGRAM_CHANNEL_OPENIPC_DEV}} TG_OPTIONS: -s --connect-timeout 30 --retry 10 --http1.1 -o /dev/null -w %{http_code} jobs: buildroot: name: Firmware runs-on: ubuntu-latest strategy: fail-fast: false matrix: platform: - hi3516cv100 - hi3518cv100 - hi3518ev100 - hi3516av100 - hi3516dv100 - hi3516cv200 - hi3518ev200 - hi3519v101 - hi3516av200 - hi3516cv300 - hi3516ev100 - hi3516cv500 - hi3516dv300 - hi3516av300 - hi3516ev200 - hi3516ev300 - hi3518ev300 - hi3516dv200 - hi3536cv100 - hi3536dv100 - gk7205v200 - gk7205v210 - gk7205v300 - gk7202v300 - gk7605v100 - ssc338q - t31 - t40 release: - lite - ultimate include: - platform: hi3518ev200 release: mini - platform: hi3516cv300 release: mini - platform: hi3516ev200 release: fpv - platform: hi3516ev300 release: fpv - platform: gk7205v200 release: fpv - platform: gk7205v300 release: fpv - platform: hi3516ev200 release: lte - platform: hi3516ev300 release: lte - platform: gk7205v200 release: lte - platform: gk7205v300 release: lte # Original SDK test - platform: gk7205v200 release: original custom: onlyci # MVP - platform: fh8852v100 release: lite - platform: fh8852v200 release: lite - platform: gm8136 release: lite - platform: nt98562 release: lite - platform: nt98566 release: lite - platform: rv1109 release: lite - platform: rv1126 release: lite - platform: ssc335 release: lite - platform: ssc335de release: lite - platform: ssc337 release: lite - platform: ssc337de release: lite - platform: t10 release: lite - platform: t20 release: lite - platform: t21 release: lite - platform: t30 release: lite - platform: xm510 release: lite - platform: xm530 release: lite - platform: xm550 release: lite # TODO - platform: ak3916ev300 release: lite custom: onlyci - platform: ak3918ev300 release: lite custom: onlyci - platform: dm36x release: lite custom: onlyci - platform: gk7102 release: lite - platform: gk7102s release: lite - platform: msc313e release: lite custom: onlyci - platform: msc316dc release: lite custom: onlyci - platform: msc316dm release: lite custom: onlyci - platform: s3l release: lite custom: onlyci - platform: ssc325 release: lite custom: onlyci exclude: - platform: hi3516cv100 release: ultimate - platform: hi3518cv100 release: ultimate - platform: hi3518ev100 release: ultimate - platform: hi3516cv200 release: ultimate - platform: hi3519v101 release: ultimate - platform: hi3516ev100 release: ultimate - platform: hi3516cv500 release: ultimate - platform: hi3516dv300 release: ultimate - platform: hi3516av300 release: ultimate - platform: hi3516dv200 release: ultimate - platform: hi3536cv100 release: ultimate - platform: hi3536dv100 release: ultimate - platform: gk7605v100 release: ultimate - platform: gk7205v210 release: ultimate - platform: gk7202v300 release: ultimate steps: - name: Checkout source uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup ccache if: github.event_name != 'pull_request' uses: actions/cache@v3 with: path: /tmp/ccache key: ${{matrix.platform}}_${{matrix.release}} - name: Restore ccache if: github.event_name == 'pull_request' uses: actions/cache/restore@v3 with: path: /tmp/ccache key: ${{matrix.platform}}_${{matrix.release}} - name: Build firmware run: | echo "8.8.8.8 invisible-mirror.net" | sudo tee -a /etc/hosts MODEL=${{matrix.platform}} RELEASE=${{matrix.release}} CONFIG=$(find br-ext-chip-* -name ${MODEL}_${RELEASE}_defconfig) IMAGES=${GITHUB_WORKSPACE}/output/images export GIT_HASH=$(git rev-parse --short ${GITHUB_SHA}) export GIT_BRANCH=${GITHUB_REF_NAME} echo GIT_HASH=${GIT_HASH} >> ${GITHUB_ENV} echo GIT_BRANCH=${GIT_BRANCH} >> ${GITHUB_ENV} mkdir -p /tmp/ccache ln -s /tmp/ccache ${HOME}/.ccache echo ------------------------------------------------------------ echo ${CONFIG} echo ------------------------------------------------------------ cat ${CONFIG} echo ------------------------------------------------------------ make BOARD=${CONFIG} all echo ------------------------------------------------------------ TIME=$(date -d @${SECONDS} +%M:%S) echo TIME=${TIME} >> ${GITHUB_ENV} echo Build time: ${TIME} check_size() { SIZE1=$(expr $(stat --printf="%s" ${1}) / 1024) SIZE2=$(expr ${2} / 1024) echo - ${1}: [${SIZE1}KB/${SIZE2}KB] if [ ${SIZE1} -gt ${SIZE2} ]; then echo -- Error: size exceeded by $(expr ${SIZE1} - ${SIZE2})KB exit 1 fi } EXCLUDE="hi3516cv500" if [ ${RELEASE} = "ultimate" ] || grep -qP ${EXCLUDE} ${CONFIG}; then MAX_KERNEL_SIZE=${MAX_KERNEL_SIZE_ULTIMATE} MAX_ROOTFS_SIZE=${MAX_ROOTFS_SIZE_ULTIMATE} fi mkdir -p /tmp/openipc cd /tmp/openipc if [ -e ${IMAGES}/uImage ]; then mv ${IMAGES}/uImage uImage.${MODEL} md5sum uImage.${MODEL} > uImage.${MODEL}.md5sum check_size uImage.${MODEL} ${MAX_KERNEL_SIZE} fi if [ -e ${IMAGES}/zboot.img ]; then mv ${IMAGES}/zboot.img boot.img.${MODEL} md5sum boot.img.${MODEL} > boot.img.${MODEL}.md5sum check_size boot.img.${MODEL} ${MAX_KERNEL_SIZE_NAND} rm -f ${IMAGES}/rootfs.squashfs fi if [ -e ${IMAGES}/rootfs.squashfs ]; then mv ${IMAGES}/rootfs.squashfs rootfs.squashfs.${MODEL} md5sum rootfs.squashfs.${MODEL} > rootfs.squashfs.${MODEL}.md5sum check_size rootfs.squashfs.${MODEL} ${MAX_ROOTFS_SIZE} NORFW=${IMAGES}/openipc.${MODEL}-nor-${RELEASE}.tgz echo NORFW=${NORFW} >> ${GITHUB_ENV} tar czf ${NORFW} $(ls) fi if [ -e ${IMAGES}/rootfs.ubi ]; then mv ${IMAGES}/rootfs.ubi rootfs.ubi.${MODEL} md5sum rootfs.ubi.${MODEL} > rootfs.ubi.${MODEL}.md5sum check_size rootfs.ubi.${MODEL} ${MAX_ROOTFS_SIZE_NAND} rm -f rootfs.squashfs* NANDFW=${IMAGES}/openipc.${MODEL}-nand-${RELEASE}.tgz echo NANDFW=${NANDFW} >> ${GITHUB_ENV} tar czf ${NANDFW} $(ls) fi - name: Upload firmware if: github.event_name != 'pull_request' && matrix.custom != 'onlyci' uses: softprops/action-gh-release@v1 with: tag_name: ${{env.TAG_NAME}} files: | ${{env.NORFW}} ${{env.NANDFW}} - name: Send error if: github.event_name != 'pull_request' && failure() run: | TG_WARN="Error: ${{matrix.platform}}_${{matrix.release}}\n" TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\n\n" TG_ICON="\xE2\x9A\xA0 GitHub Actions" TG_HEADER=$(echo -e ${TG_WARN}${TG_MSG}${TG_ICON}) HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendMessage -F chat_id=${TG_CHANNEL} -F text="${TG_HEADER}") echo Telegram response: ${HTTP} exit 2 - name: Send binary if: github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.NORFW run: | TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n" TG_ICON="\xE2\x9C\x85 GitHub Actions" TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON}) HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}" -F document=@${NORFW}) echo Telegram response: ${HTTP}