mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			
		
			
				
	
	
		
			130 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			YAML
		
	
	
			
		
		
	
	
			130 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			YAML
		
	
	
| name: FH8632
 | |
| 
 | |
| on:
 | |
|   workflow_dispatch:
 | |
| 
 | |
| jobs:
 | |
|   build_core:
 | |
|     name: OpenIPC v2.1 for FH8632
 | |
|     runs-on: ubuntu-latest
 | |
| 
 | |
|     steps:
 | |
| 
 | |
|       - name: Checkout
 | |
|         id: checkout
 | |
|         uses: actions/checkout@v2
 | |
| 
 | |
|       - name: Install build dependencies
 | |
|         id: install
 | |
|         run: |
 | |
|           make install-deps
 | |
|           mkdir -p tmp          
 | |
| 
 | |
|       - name: Free disk space
 | |
|         id: freshing
 | |
|         run: |
 | |
|           sudo swapoff -a
 | |
|           sudo rm -f /swapfile
 | |
|           sudo apt clean
 | |
|           docker rmi $(docker image ls -aq)
 | |
|           df -h          
 | |
| 
 | |
|       - name: Prepare buildroot
 | |
|         id: prepare
 | |
|         run: |
 | |
|           HEAD_TAG=$(git tag --points-at HEAD)
 | |
|           GIT_HASH=$(git rev-parse --short $GITHUB_SHA)
 | |
|           BRANCH_NAME=$(echo $GITHUB_REF | cut -d'/' -f 3)
 | |
|           if [ -z "$HEAD_TAG" ]; then
 | |
|             TAG_NAME="latest"
 | |
|             RELEASE_NAME="Development Build"
 | |
|             PRERELEASE=true
 | |
|           else
 | |
|             TAG_NAME=${{ github.ref }}
 | |
|             RELEASE_NAME="Release ${{ github.ref }}"
 | |
|             PRERELEASE=false
 | |
|           fi
 | |
|           echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV
 | |
|           echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
 | |
|           echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
 | |
|           echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
 | |
|           echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
 | |
|           cd $GITHUB_WORKSPACE
 | |
|           make prepare          
 | |
| 
 | |
|       - name: Build FH8632 firmware
 | |
|         id: build-fh8632-firmware
 | |
|         continue-on-error: true
 | |
|         run: |
 | |
|           ARCHIVE_FW="${GITHUB_WORKSPACE}/output/images/openipc.fh8632-br.tgz"
 | |
|           echo "ARCHIVE_FW=$ARCHIVE_FW" >> $GITHUB_ENV
 | |
|           cd $GITHUB_WORKSPACE
 | |
|           make PLATFORM=fullhan BOARD=unknown_unknown_fh8632_openipc all
 | |
|           [[ $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/uImage) -gt 2097152 ]] && echo "TG_NOTIFY=Warning, kernel size exceeded : $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/uImage) vs 2097152... FH8632" >> $GITHUB_ENV && exit 1
 | |
|           [[ $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/rootfs.squashfs) -gt 5242880 ]] && echo "TG_NOTIFY=Warning, rootfs size exceeded - $(stat --printf="%s" ${GITHUB_WORKSPACE}/output/images/rootfs.squashfs) vs 5242880... FH8632" >> $GITHUB_ENV && exit 1
 | |
|           mv ${GITHUB_WORKSPACE}/output/images/uImage ${GITHUB_WORKSPACE}/output/images/uImage.fh8632
 | |
|           mv ${GITHUB_WORKSPACE}/output/images/rootfs.squashfs ${GITHUB_WORKSPACE}/output/images/rootfs.squashfs.fh8632
 | |
|           tar -C ${GITHUB_WORKSPACE}/output/images -cvzf $ARCHIVE_FW rootfs.squashfs.fh8632 uImage.fh8632          
 | |
| 
 | |
|       - name: Build FH8632 SDK
 | |
|         id: build-fh8632-sdk
 | |
|         continue-on-error: true
 | |
|         run: |
 | |
|           ARCHIVE_SDK="${GITHUB_WORKSPACE}/output/images/arm-openipc-linux-musleabi_sdk-buildroot.tar.gz"
 | |
|           echo "ARCHIVE_SDK=$ARCHIVE_SDK" >> $GITHUB_ENV
 | |
|           cd $GITHUB_WORKSPACE/output
 | |
|           make sdk          
 | |
| 
 | |
|       - name: Send warning message to telegram channel
 | |
|         env:
 | |
|           TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }}
 | |
|           TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }}
 | |
|         if: steps.build-fh8632-firmware.outcome != 'success' || steps.build-fh8632-sdk.outcome != 'success'
 | |
|         run: |
 | |
|           TG_OPTIONS="-s --connect-timeout 30 --max-time 30"
 | |
|           TG_NOTIFY="${TG_NOTIFY:=Warning, Buildroot compiling error... FH8632}"
 | |
|           TG_HEADER=$(echo -e "\r\n$TG_NOTIFY \r\n\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9A\xA0 GitHub Actions")
 | |
|           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"          
 | |
| 
 | |
|       - name: Create release
 | |
|         uses: actions/create-release@v1
 | |
|         continue-on-error: true
 | |
|         env:
 | |
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | |
|         with:
 | |
|           tag_name: ${{ env.TAG_NAME }}
 | |
|           release_name: ${{ env.RELEASE_NAME }}
 | |
|           draft: false
 | |
|           prerelease: ${{ env.PRERELEASE }}
 | |
| 
 | |
|       - name: Upload FW to release
 | |
|         uses: svenstaro/upload-release-action@v2
 | |
|         continue-on-error: true
 | |
|         with:
 | |
|           repo_token: ${{ secrets.GITHUB_TOKEN }}
 | |
|           file: ${{ env.ARCHIVE_FW }}
 | |
|           asset_name: "openipc.fh8632-br.tgz"
 | |
|           tag: ${{ env.TAG_NAME }}
 | |
|           overwrite: true
 | |
| 
 | |
|       - name: Upload SDK to release
 | |
|         uses: svenstaro/upload-release-action@v2
 | |
|         continue-on-error: true
 | |
|         with:
 | |
|           repo_token: ${{ secrets.GITHUB_TOKEN }}
 | |
|           file: ${{ env.ARCHIVE_SDK }}
 | |
|           asset_name: "arm-openipc-fh8632-linux-musleabi_sdk-buildroot.tar.gz"
 | |
|           tag: ${{ env.TAG_NAME }}
 | |
|           overwrite: true
 | |
| 
 | |
|       - name: Send binary file to telegram channel
 | |
|         env:
 | |
|           TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }}
 | |
|           TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }}
 | |
|         run: |
 | |
|           TG_OPTIONS="-s --connect-timeout 30 --max-time 30"
 | |
|           TG_HEADER=$(echo -e "\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9C\x85 GitHub Actions")
 | |
|           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 document="@$ARCHIVE_FW" -F caption="$TG_HEADER"          
 |