CI: Refactor NAND/NOR images handling

pull/402/head
Dmitry Ilyin 2022-08-25 19:46:49 +03:00
parent b702f468cf
commit 5cc973fb90
1 changed files with 21 additions and 19 deletions

View File

@ -388,11 +388,6 @@ jobs:
BOARD="${BOARD}_openipc" BOARD="${BOARD}_openipc"
fi fi
NORFW_PATH="${GITHUB_WORKSPACE}/output/images/openipc.${{ matrix.platform }}-${SUFF}br.tgz"
echo "NORFW_PATH=$NORFW_PATH" >> $GITHUB_ENV
NORFW_FILE=$(basename $NORFW_PATH)
echo "NORFW_FILE=$NORFW_FILE" >> $GITHUB_ENV
CONF_PATH=$(find . -name "${BOARD}_defconfig") CONF_PATH=$(find . -name "${BOARD}_defconfig")
echo Using $TOOLNAME echo Using $TOOLNAME
@ -444,14 +439,13 @@ jobs:
mkdir /tmp/extsdk mkdir /tmp/extsdk
tar xvf ${TOOLNAME}.tgz --strip-components=1 -C /tmp/extsdk >/dev/null tar xvf ${TOOLNAME}.tgz --strip-components=1 -C /tmp/extsdk >/dev/null
HAS_NAND=$(make BOARD=${BOARD} has-nand)
echo "HAS_NAND=$HAS_NAND" >> $GITHUB_ENV
make BOARD=$BOARD all make BOARD=$BOARD all
IMAGES_DIR=${GITHUB_WORKSPACE}/output/images
pushd output/images pushd output/images
check_exceeded() { check_exceeded() {
ACTUAL=$(stat --printf="%s" ${1}) ACTUAL=$(stat --printf="%s" ${1})
echo Debug ${1}: ${ACTUAL} vs ${2}...
if [[ ${ACTUAL} -gt ${2} ]]; then if [[ ${ACTUAL} -gt ${2} ]]; then
OVERRUN=$((${ACTUAL}-${2})) OVERRUN=$((${ACTUAL}-${2}))
echo "TG_NOTIFY=Warning, ${1} size exceeded by ${OVERRUN}... ${{ matrix.platform }} (${{ matrix.release }})" >> $GITHUB_ENV echo "TG_NOTIFY=Warning, ${1} size exceeded by ${OVERRUN}... ${{ matrix.platform }} (${{ matrix.release }})" >> $GITHUB_ENV
@ -459,17 +453,25 @@ jobs:
fi fi
} }
if [ -f rootfs.squashfs ]; then
# TODO: check why it doesn't fail on fpv rootfs?
check_exceeded uImage ${MAX_UIMAGE_LITE} check_exceeded uImage ${MAX_UIMAGE_LITE}
check_exceeded rootfs.squashfs ${MAX_ROOTFS_LITE} check_exceeded rootfs.squashfs ${MAX_ROOTFS_LITE}
NORFW_PATH="${IMAGES_DIR}/openipc.${{ matrix.platform }}-${SUFF}br.tgz"
echo "NORFW_PATH=$NORFW_PATH" >> $GITHUB_ENV
NORFW_FILE=$(basename $NORFW_PATH)
echo "NORFW_FILE=$NORFW_FILE" >> $GITHUB_ENV
md5sum uImage > uImage.${{ matrix.platform }}.md5sum md5sum uImage > uImage.${{ matrix.platform }}.md5sum
mv uImage uImage.${{ matrix.platform }} mv uImage uImage.${{ matrix.platform }}
md5sum rootfs.squashfs > rootfs.squashfs.${{ matrix.platform }}.md5sum md5sum rootfs.squashfs > rootfs.squashfs.${{ matrix.platform }}.md5sum
mv rootfs.squashfs rootfs.squashfs.${{ matrix.platform }} mv rootfs.squashfs rootfs.squashfs.${{ matrix.platform }}
tar -cvzf $NORFW_PATH uImage* *rootfs.squashfs.${{ matrix.platform }}* tar -cvzf $NORFW_PATH uImage* *rootfs.squashfs.${{ matrix.platform }}*
fi
if [ "$HAS_NAND" == "y" ]; then if [ -f rootfs.ubifs ]; then
NANDFW_PATH="${GITHUB_WORKSPACE}/output/images/openipc.${{ matrix.platform }}-nand-br.tgz" NANDFW_PATH="${IMAGES_DIR}/openipc.${{ matrix.platform }}-nand-br.tgz"
echo "NANDFW_PATH=$NANDFW_PATH" >> $GITHUB_ENV echo "NANDFW_PATH=$NANDFW_PATH" >> $GITHUB_ENV
NANDFW_FILE=$(basename $NANDFW_PATH) NANDFW_FILE=$(basename $NANDFW_PATH)
echo "NANDFW_FILE=$NANDFW_FILE" >> $GITHUB_ENV echo "NANDFW_FILE=$NANDFW_FILE" >> $GITHUB_ENV
@ -507,7 +509,7 @@ jobs:
prerelease: ${{ env.PRERELEASE }} prerelease: ${{ env.PRERELEASE }}
- name: Upload NOR FW to release - name: Upload NOR FW to release
if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' }} if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.NORFW_FILE != '' }}
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
@ -517,7 +519,7 @@ jobs:
overwrite: true overwrite: true
- name: Upload NAND FW to release - name: Upload NAND FW to release
if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.HAS_NAND == 'y' }} if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.NANDFW_FILE != '' }}
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}