From 2fcbd9af173ca0256e7e1277f7a72d4fe670181a Mon Sep 17 00:00:00 2001 From: Gichan Jang Date: Mon, 11 Nov 2024 13:55:16 +0900 Subject: [PATCH] [Action] Add ubuntu and yocto build action - Add build result and badge for ubuntu and yocto - Add conditon to check the trigger event. - To fix memory space problem, revert this commit: [action] Fix yocto build workflow - Add an option `nobranch=1` to prevent occasional fetch error. - Remove unnecessary disk space acquisition step. Signed-off-by: Yongjoo Ahn Signed-off-by: Gichan Jang --- .github/workflows/update_gbs_cache.yml | 8 +- .github/workflows/update_pbuilder_cache.yml | 34 ++++++++- .github/workflows/yocto.yml | 83 ++++++++++++++++++++- README.md | 4 +- 4 files changed, 119 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update_gbs_cache.yml b/.github/workflows/update_gbs_cache.yml index b8e427dc9..57bba16ae 100644 --- a/.github/workflows/update_gbs_cache.yml +++ b/.github/workflows/update_gbs_cache.yml @@ -50,6 +50,7 @@ jobs: - name: build and tests on GBS id: gbs-build + continue-on-error: true run: gbs build ${{ matrix.gbs_build_option }} --define "_skip_debug_rpm 1" -A ${{ matrix.gbs_build_arch }} - name: report GBS build and test result @@ -58,12 +59,13 @@ jobs: - name: save gbs cache uses: actions/cache/save@v4 - if: always() + if: always() && github.ref == 'refs/heads/main' with: path: ~/GBS-ROOT/local/cache key: gbs-cache-${{ matrix.gbs_build_arch }}-${{ steps.get-date.outputs.date }} - name: Release daily build result to release.nnstreamer.com + if: steps.gbs-build.outcome == 'success' uses: ./.github/actions/s3_upload with: source: ~/GBS-ROOT/local/repos/tizen/${{ matrix.gbs_build_arch }}/RPMS/ @@ -80,7 +82,7 @@ jobs: s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} - - if: matrix.gbs_build_arch == 'x86_64' + - if: matrix.gbs_build_arch == 'x86_64' && steps.gbs-build.outcome == 'success' name: extract test coverage result run: | pip install pybadges beautifulsoup4 setuptools @@ -91,7 +93,7 @@ jobs: popd python3 .github/workflows/gen_coverage_badge.py ~/testresult/usr/share/nnstreamer/unittest/result/index.html ~/testresult/usr/share/nnstreamer/unittest/result/coverage_badge.svg - - if: matrix.gbs_build_arch == 'x86_64' + - if: matrix.gbs_build_arch == 'x86_64' && steps.gbs-build.outcome == 'success' name: update test coverage result to github.io uses: ./.github/actions/gitpush with: diff --git a/.github/workflows/update_pbuilder_cache.yml b/.github/workflows/update_pbuilder_cache.yml index 389cd3d78..29e51a50e 100644 --- a/.github/workflows/update_pbuilder_cache.yml +++ b/.github/workflows/update_pbuilder_cache.yml @@ -59,12 +59,24 @@ jobs: echo "::endgroup" - name: run pdebuild + id: pdebuild + continue-on-error: true run: | - pdebuild --buildresult ~/daily_build/ubuntu --architecture ${{ matrix.arch }} -- --distribution ${{ matrix.distroname }} + mkdir -p ~/daily_build/ubuntu + pdebuild --logfile ~/daily_build/pdebuild_log.txt --buildresult ~/daily_build/ubuntu --architecture ${{ matrix.arch }} -- --distribution ${{ matrix.distroname }} + + - name: generate badge + run: | + pip install pybadges setuptools + if [ '${{ steps.pdebuild.outcome }}' == 'success' ]; then + python3 -m pybadges --left-text=test --right-text=success --right-color=green > ~/daily_build/pdebuild_result.svg + else + python3 -m pybadges --left-text=test --right-text=failure --right-color=red > ~/daily_build/pdebuild_result.svg + fi - name: save pbuilder cache uses: actions/cache/save@v4 - if: always() + if: always() && github.ref == 'refs/heads/main' with: path: | /var/cache/pbuilder/aptcache @@ -72,6 +84,7 @@ jobs: key: pbuilder-cache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('**/debian/control') }}-${{ steps.get-date.outputs.date }} - name: Release daily build result to release.nnstreamer.com + if: steps.pdebuild.outcome == 'success' uses: ./.github/actions/s3_upload with: source: ~/daily_build/ubuntu/ @@ -79,3 +92,20 @@ jobs: s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} s3_option: --recursive + + - name: Release daily build log to release.nnstreamer.com + uses: ./.github/actions/s3_upload + with: + source: ~/daily_build/pdebuild_log.txt + dest: logs/ + s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + + - name: update daily result badge + uses: ./.github/actions/gitpush + with: + source: ~/daily_build/pdebuild_result.svg + dest: testresult + message: "${{ steps.get-date.outputs.date }} : Update ubuntu daily build result." + taos_account: ${{ secrets.TAOS_ACCOUNT }} + taos_account_token: ${{ secrets.TAOS_ACCOUNT_TOKEN }} diff --git a/.github/workflows/yocto.yml b/.github/workflows/yocto.yml index a9e2a37bf..cada2a1b8 100644 --- a/.github/workflows/yocto.yml +++ b/.github/workflows/yocto.yml @@ -4,7 +4,10 @@ on: pull_request: branches: [ main ] - # Allow manually triggering the workflow + schedule: + # 04:30 AM (KST) Mon-Fri + - cron: "30 19 * * 0-4" + workflow_dispatch: jobs: @@ -21,12 +24,21 @@ jobs: with: mode: build + - name: Check trigger event + id: rebuild + run: | + if ${{ env.rebuild == '1' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}; then + echo "rebuild=1" >> $GITHUB_OUTPUT + else + echo "rebuild=0" >> $GITHUB_OUTPUT + fi + - name: make cache dir for yocto ## prevent permission error run: sudo mkdir --mode a=rwx --parents /var/cache/yocto - name: restore yocto sstate and downloads cache - if: github.ref == 'refs/heads/main' || env.rebuild == '1' + if: steps.rebuild.outputs.rebuild == '1' uses: actions/cache/restore@v4 with: path: | @@ -34,8 +46,25 @@ jobs: /var/cache/yocto/sstate-cache /var/cache/yocto/persistent key: yocto-cache-yocto-5.0.3 + + - name: acquire some disk space + if: steps.rebuild.outputs.rebuild == '1' + run: | + df -h + sudo apt-get update --fix-missing \ + && sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' '^mysql-server-core-.*' '^postgresql-.*' '^temurin-.*' \ + azure-cli google-chrome-stable google-cloud-cli firefox powershell microsoft-edge-stable mono-devel \ + && sudo apt-get purge docker-ce docker-ce-cli \ + && sudo apt-get autoremove -y \ + && sudo rm -rf /usr/share/dotnet /usr/share/swift /usr/share/miniconda /usr/local/graalvm \ + /usr/local/.ghcup /usr/local/share/powershell /usr/local/share/chromium /usr/local/lib/node_modules \ + /var/lib/docker /var/lib/apt/lists /usr/local/lib/android + df -h + - name: build - if: github.ref == 'refs/heads/main' || env.rebuild == '1' + if: steps.rebuild.outputs.rebuild == '1' + id: yocto-build + continue-on-error: true run: | echo "::group::apt-get install" sudo apt-get update @@ -76,7 +105,15 @@ jobs: cat tmp/work/core2-64-poky-linux/nnstreamer/*/temp/log.do_compile || true echo "::endgroup::" + echo "::group::Copy result" + mkdir -p ~/daily_build/logs + cp tmp/work/core2-64-poky-linux/nnstreamer/*/temp/log.do_configure ~/daily_build/logs/yocto_configure_log.txt + cp tmp/work/core2-64-poky-linux/nnstreamer/*/temp/log.do_compile ~/daily_build/logs/yocto_compile_log.txt + cp -r tmp/deploy ~/daily_build/deploy + echo "::endgroup::" + sudo rm -rf tmp/ + - name: save yocto cache (main branch only) uses: actions/cache/save@v4 if: always() && github.ref == 'refs/heads/main' @@ -86,3 +123,43 @@ jobs: /var/cache/yocto/sstate-cache /var/cache/yocto/persistent key: yocto-cache-yocto-5.0.3 + + - name: generate badge + if: contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) + run: | + pip install pybadges setuptools + if [ '${{ steps.yocto-build.outcome }}' == 'success' ]; then + python3 -m pybadges --left-text=test --right-text=success --right-color=green > ~/daily_build/yocto_build_result.svg + else + python3 -m pybadges --left-text=test --right-text=failure --right-color=red > ~/daily_build/yocto_build_result.svg + fi + + - name: Release daily build result to release.nnstreamer.com + if: contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) && steps.yocto-build.outcome == 'success' + uses: ./.github/actions/s3_upload + with: + source: ~/daily_build/deploy + dest: yocto/ + s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + s3_option: --recursive + + - name: Release daily build log to release.nnstreamer.com + if: contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) + uses: ./.github/actions/s3_upload + with: + source: ~/daily_build/logs + dest: logs/ + s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + s3_option: --recursive + + - name: update daily result badge + if: contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) + uses: ./.github/actions/gitpush + with: + source: ~/daily_build/yocto_build_result.svg + dest: testresult + message: "Update yocto daily build result." + taos_account: ${{ secrets.TAOS_ACCOUNT }} + taos_account_token: ${{ secrets.TAOS_ACCOUNT_TOKEN }} diff --git a/README.md b/README.md index 1fdf6fbc2..e697dd97c 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ neural network developers to manage neural network pipelines and their filters e | :-- | :--: | :--: | :--: | :--: | :--: | | | 5.5M2 and later | ~~16.04~~/18.04/20.04/22.04 | 9/P | Kirkstone | | | arm | [![armv7l badge](https://nnstreamer.github.io/testresult/armv7l_reuslt.svg)](https://nnstreamer-release.s3-ap-northeast-2.amazonaws.com/nnstreamer/latest/logs/tizen_gbs_armv7l_log.txt) | Available | Available| Ready | N/A | -| arm64 | [![aarch64 badge](https://nnstreamer.github.io/testresult/aarch64_reuslt.svg)](https://nnstreamer-release.s3-ap-northeast-2.amazonaws.com/nnstreamer/latest/logs/tizen_gbs_aarch64_log.txt) | Available | [![android badge](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/badge/android_result_badge.svg)](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/build_result/latest/log/) | [![yocto badge](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/badge/yocto_result_badge.svg)](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/build_result/latest/log/) | N/A | -| x64 | [![x64 badge](https://nnstreamer.github.io/testresult/x86_64_reuslt.svg)](https://nnstreamer-release.s3-ap-northeast-2.amazonaws.com/nnstreamer/latest/logs/tizen_gbs_x86_64_log.txt) | [![ubuntu badge](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/badge/ubuntu_result_badge.svg)](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/build_result/latest/log/) | Ready | Ready | Available | +| arm64 | [![aarch64 badge](https://nnstreamer.github.io/testresult/aarch64_reuslt.svg)](https://nnstreamer-release.s3-ap-northeast-2.amazonaws.com/nnstreamer/latest/logs/tizen_gbs_aarch64_log.txt) | Available | [![android badge](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/badge/android_result_badge.svg)](http://ci.nnstreamer.ai/nnstreamer/ci/daily-build/build_result/latest/log/) | [![yocto badge](https://nnstreamer.github.io/testresult/yocto_build_result.svg)](https://release.nnstreamer.com/#nnstreamer/latest/logs/) | N/A | +| x64 | [![x64 badge](https://nnstreamer.github.io/testresult/x86_64_reuslt.svg)](https://nnstreamer-release.s3-ap-northeast-2.amazonaws.com/nnstreamer/latest/logs/tizen_gbs_x86_64_log.txt) | [![ubuntu badge](https://nnstreamer.github.io/testresult/pdebuild_result.svg)](https://nnstreamer-release.s3-ap-northeast-2.amazonaws.com/nnstreamer/latest/logs/pdebuild_log.txt) | Ready | Ready | Available | | x86 | [![x86 badge](https://nnstreamer.github.io/testresult/i586_reuslt.svg)](https://nnstreamer-release.s3-ap-northeast-2.amazonaws.com/nnstreamer/latest/logs/tizen_gbs_i586_log.txt) | N/A | N/A | Ready | N/A | | Publish | [Tizen Repo](https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/latest/repos/standard/packages/) | [PPA](https://launchpad.net/~nnstreamer/+archive/ubuntu/ppa) | [Daily build](https://release.nnstreamer.com/#nnstreamer/latest/android/) | [Layer](https://github.com/nnstreamer/meta-neural-network) | [Brew Tap](Documentation/getting-started-macos.md) | | API | C/C# (Official) | C | Java | C | C |