Skip to content

Commit

Permalink
[Action] Add ubuntu and yocto build action
Browse files Browse the repository at this point in the history
 - 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 <[email protected]>

Signed-off-by: Gichan Jang <[email protected]>
  • Loading branch information
gichan-jang authored and jaeyun-jung committed Nov 13, 2024
1 parent 8ffa911 commit 2fcbd9a
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 10 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/update_gbs_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/
Expand All @@ -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
Expand All @@ -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:
Expand Down
34 changes: 32 additions & 2 deletions .github/workflows/update_pbuilder_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,53 @@ 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
/var/cache/pbuilder/base.tgz
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/
dest: ubuntu/
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 }}
83 changes: 80 additions & 3 deletions .github/workflows/yocto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -21,21 +24,47 @@ 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: |
/var/cache/yocto/downloads
/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
Expand Down Expand Up @@ -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'
Expand All @@ -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 }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit 2fcbd9a

Please sign in to comment.