Skip to content

Commit

Permalink
Merge pull request #261 from kendryte/dev
Browse files Browse the repository at this point in the history
merge dev
  • Loading branch information
wycwyhwyq authored Jul 31, 2022
2 parents 629fa71 + 5d98f8e commit 305fb7e
Show file tree
Hide file tree
Showing 154 changed files with 19,030 additions and 2,554 deletions.
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@

## 关联issue:

fix #X

<!--
请将#之后的X,手动修改为PR关联的issue ID, PR合并成功后,可以自动关闭对应的issue
Example:
fix #1
-->
132 changes: 115 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ defaults:
run:
shell: bash

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build_image:
name: Build
Expand All @@ -32,18 +36,23 @@ jobs:
strategy:
matrix:
cfg: ["crb_lp3_v1_2"]
outputs:
md5_bbl: ${{ steps.save_tftp.outputs.md5_bbl }}
md5_dtb: ${{ steps.save_tftp.outputs.md5_dtb }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
clean: false

- name: Install toolchain
id: install_toolchain
run: |
test -f toolchain/nds64le-linux-glibc-v5d.txz || wget -c https://ai.b-bug.org/k510_buildroot/toolchain/nds64le-linux-glibc-v5d.txz -O toolchain/nds64le-linux-glibc-v5d.txz
test -f toolchain/nds64le-elf-mculib-v5d.txz || wget -c https://ai.b-bug.org/k510_buildroot/toolchain/nds64le-elf-mculib-v5d.txz -O toolchain/nds64le-elf-mculib-v5d.txz
- name: Download cache package
id: download_cache
run: |
test -f pkg-download/dl.tar.gz && rm pkg-download/dl.tar.gz
wget -qc https://ai.b-bug.org/k510_buildroot/pkg-download/dl.tar.gz -O pkg-download/dl.tar.gz
Expand All @@ -60,42 +69,54 @@ jobs:
test -d dl_bak && rm -rf dl_bak
- name: Build image
id: build_image
run: |
sed -i "s/BR2_JLEVEL=5/BR2_JLEVEL=14/g" configs/$CONF
rm -rf $CONF
rm -rf buildroot-*
make CONF=$CONF
- name: Save image to CI cache
id: save_cache
run: |
export HW=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1"_"$3"_"$4}'`
export HW=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1"_"$3"."$4}'`
echo $HW
VER=$(cat $CONF/target/etc/version/release_version | grep ".*CST-github-pull-request" | sed 's/\(.*\)CST-github-pull-request/\1/g') || exit 1
echo $VER
mkdir -p $CI_ROOT/$VER/$HW/
cp -r $CONF/images/* $CI_ROOT/$VER/$HW/
cp -r $CONF/target/etc/version/release_version $CI_ROOT/$VER/$HW/
test -d $CI_ROOT/latest && rm $CI_ROOT/latest
ln -s $CI_ROOT/$VER $CI_ROOT/latest
- name: Save image to TFTP
id: save_tftp
run: |
export FILE_SUFFIX=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1"-"$3"_"$4}'`-$PULL_REQUEST_ID-$GITHUB_RUN_ID
export FILE_SUFFIX=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1"-"$3"."$4}'`-$PULL_REQUEST_ID-$GITHUB_RUN_ID
echo $FILE_SUFFIX
cp $CONF/images/bootm-bbl.img $TFTP_ROOT/bootm-bbl-$FILE_SUFFIX.img
cp $CONF/images/k510.dtb $TFTP_ROOT/k510-$FILE_SUFFIX.dtb
md5_bbl=$(md5sum $TFTP_ROOT/bootm-bbl-$FILE_SUFFIX.img | awk '{print $1}')
md5_dtb=$(md5sum $TFTP_ROOT/k510-$FILE_SUFFIX.dtb | awk '{print $1}')
echo $md5_bbl
echo $md5_dtb
echo "::set-output name=md5_bbl::$md5_bbl"
echo "::set-output name=md5_dtb::$md5_dtb"
- name: Save image to NFS
id: save_nfs
run: |
export HW=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1"_"$3"_"$4}'`
export HW=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1"_"$3"."$4}'`
export SAVE_DIR=$PULL_REQUEST_ID"_"$GITHUB_RUN_ID
echo $HW
echo $SAVE_DIR
mkdir -p $NFS_ROOT/k510_buildroot/$HW/$SAVE_DIR/
tar -xf $CONF/images/rootfs.tar -C $NFS_ROOT/k510_buildroot/$HW/$PULL_REQUEST_ID"_"$GITHUB_RUN_ID
mkdir -p $NFS_ROOT/k510/$HW/$SAVE_DIR/
tar -xf $CONF/images/rootfs.tar -C $NFS_ROOT/k510/$HW/$PULL_REQUEST_ID"_"$GITHUB_RUN_ID
load_image:
name: Load
test_image:
name: Test
needs: build_image
timeout-minutes: 5
timeout-minutes: 15
runs-on: [self-hosted, k510_buildroot]
container:
image: ai.b-bug.org:5000/k510_sdk_github
Expand All @@ -105,16 +126,93 @@ jobs:
matrix:
cfg: ["crb_lp3_v1_2"]
steps:
- name: Load image
- name: Get Available DUT
id: get_dut
run: |
test -d bin && rm -rf bin
mkdir ./bin
wget -qc https://ai.b-bug.org/k510_buildroot/github/ci -O ./bin/ci
chmod +x ./bin/ci
echo "Get Available DUT start"
export HW_MODEL=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1}'`
export HW_VER=`echo ${{ matrix.cfg }}|awk -F '_' '{print $3"_"$4}'`
echo $HW_MODEL
echo $HW_VER
export HW_VER=`echo ${{ matrix.cfg }}|awk -F '_' '{print $3"."$4}'`
test -d bin || mkdir ./bin
test -f ./bin/ai_dut && rm -rf ./bin/ai_dut
wget -qc https://ai.b-bug.org/k510_buildroot/github/ai_dut -O ./bin/ai_dut
chmod +x ./bin/ai_dut
available=$(./bin/ai_dut show --dest available --hw_type k510 --hw_model $HW_MODEL --hw_ver $HW_VER --format args)
echo $available
echo "available=$available" >> $GITHUB_ENV
if [[ $available =~ "k510" ]]; then
echo "Get Available DUT pass"
else
echo "ERROR: No Available DUT"
exit 1
fi
- name: Reserve DUT
id: reserve_dut
run: |
echo "Reserve DUT start"
echo "PR ID: $PULL_REQUEST_ID"
echo "Job ID: $GITHUB_RUN_ID"
reserved=$(./bin/ai_dut add ${{ env.available }} --site github-actions --source $PULL_REQUEST_ID --job $GITHUB_RUN_ID --format args)
echo $reserved
echo "reserved=$reserved" >> $GITHUB_ENV
if [[ $reserved =~ "github-actions" ]]; then
echo "Reserve DUT pass"
else
echo "ERROR: Reserve DUT failed"
exit 1
fi
power=$(./bin/ai_dut power --type=cycle ${{ env.available }})
echo $power
if [[ $power =~ "True" ]]; then
echo "Power Cycle DUT pass"
else
echo "ERROR: Power Cycle DUT failed"
exit 1
fi
- name: Load Image
id: load_image
timeout-minutes: 5
run: |
echo "Load image start"
echo "bbl md5: ${{needs.build_image.outputs.md5_bbl}}"
echo "dtb md5: ${{needs.build_image.outputs.md5_dtb}}"
test -d bin || mkdir ./bin
test -f ./bin/ai_load && rm -rf ./bin/ai_load
wget -qc https://ai.b-bug.org/k510_buildroot/github/ai_load -O ./bin/ai_load
chmod +x ./bin/ai_load
echo $PULL_REQUEST_ID
echo $GITHUB_RUN_ID
./bin/ci --project k510_buildroot --merge_id $PULL_REQUEST_ID --pipeline_id $GITHUB_RUN_ID --hw_ver $HW_VER --hw_model $HW_MODEL
./bin/ai_load --pr_id $PULL_REQUEST_ID --job_id $GITHUB_RUN_ID --md5_dtb ${{needs.build_image.outputs.md5_dtb}} --md5_bbl ${{needs.build_image.outputs.md5_bbl}} ${{ env.available }}
- name: Run Test
id: run_test
timeout-minutes: 10
run: |
echo "Run Test start"
test -d bin || mkdir ./bin
test -f ./bin/ai_robot && rm -rf ./bin/ai_robot
wget -qc https://ai.b-bug.org/k510_buildroot/github/ai_robot -O ./bin/ai_robot
chmod +x ./bin/ai_robot
test -f ./k510.robot && rm -rf ./k510.robot
wget -qc https://ai.b-bug.org/k510_buildroot/github/k510.robot -O ./k510.robot
./bin/ai_dut convert --dest=script --format yaml --file_name=var.yml ${{ env.available }}
test -f var.yml || exit 1
echo "Run test case start"
./bin/ai_robot -m github -V var.yml -i github k510.robot
echo "Run test case pass"
- name: Release DUT
id: release_dut
if: ${{ always() }}
run: |
echo "Release DUT start"
test -d bin || mkdir ./bin
result=$(./bin/ai_dut delete ${{ env.reserved }})
echo $result
if [[ $result =~ "True" ]]; then
echo "Release DUT pass"
else
echo "ERROR: Release DUT failed"
exit 1
fi
4 changes: 3 additions & 1 deletion .github/workflows/dev_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,6 @@ jobs:
echo $VER
mkdir -p $DEV_RELEASE/$VER/$HW/
cp -r $CONF/images/* $DEV_RELEASE/$VER/$HW/
cp -r $CONF/target/etc/version/release_version $DEV_RELEASE/$VER/$HW/
cp -r $CONF/target/etc/version/release_version $DEV_RELEASE/$VER/$HW/
test -d $DEV_RELEASE/latest && rm $DEV_RELEASE/latest
ln -s $DEV_RELEASE/$VER $DEV_RELEASE/latest
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ jobs:
mkdir -p $RELEASE/$VER/$HW/
cp -r $CONF/images/* $RELEASE/$VER/$HW/
cp -r $CONF/target/etc/version/release_version $RELEASE/$VER/$HW/
test -d $RELEASE/latest && rm $RELEASE/latest
ln -s $RELEASE/$VER $RELEASE/latest
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ dl:
rm -rf pkg-download/dl.tar.gz;
wget -c https://github.com/kendryte/k510_buildroot/releases/download/v1.6/dl.tar.gz -O pkg-download/dl.tar.gz;
tar -zxf pkg-download/dl.tar.gz;
mkdir -p dl/ai/; wget -c https://github.com/kendryte/k510_buildroot/releases/download/v1.6/ai_kmodel_data.tar.xz -O dl/ai/ai_kmodel_data.tar.xz;
(set -x; NNCASE_VER=v1.7.0 ;\
mkdir -p dl/ai/; wget -c https://github.com/kendryte/k510_buildroot/releases/download/v1.7/ai_kmodel_data.tar.xz -O dl/ai/ai_kmodel_data.tar.xz;
(set -xe; NNCASE_VER=v1.7.1 ;\
NNCASE_SITE=https://github.com/kendryte/nncase/releases/download;\
NNCASE_PIP_VD=1.7.0.20220530 ; \
NNCASE_PIP_K510_VD=1.7.0.20220606 ;\
NNCASE_PIP_VD=1.7.1.20220701 ; \
NNCASE_PIP_K510_VD=1.7.1.20220701 ;\
mkdir -p dl/nncase_linux_runtime; cd dl/nncase_linux_runtime; \
wget -c $${NNCASE_SITE}/$${NNCASE_VER}/nncaseruntime-k510-v1.7.0.tgz ; \
wget -c $${NNCASE_SITE}/$${NNCASE_VER}/nncaseruntime-k510-v1.7.1.tgz ; \
wget -c $${NNCASE_SITE}/$${NNCASE_VER}/nncase-$${NNCASE_PIP_VD}-cp310-cp310-manylinux_2_24_x86_64.whl; \
wget -c $${NNCASE_SITE}/$${NNCASE_VER}/nncase-$${NNCASE_PIP_VD}-cp36-cp36m-manylinux_2_24_x86_64.whl;\
wget -c $${NNCASE_SITE}/$${NNCASE_VER}/nncase-$${NNCASE_PIP_VD}-cp37-cp37m-manylinux_2_24_x86_64.whl;\
Expand Down
Loading

0 comments on commit 305fb7e

Please sign in to comment.