Build test / Yocto-5.0.3 (scarthgap-5.0.3) #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build test / Yocto-5.0.3 (scarthgap-5.0.3) | |
on: | |
pull_request: | |
branches: [ main ] | |
schedule: | |
# 04:30 AM (KST) Mon-Fri | |
- cron: "30 19 * * 0-4" | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build with Yocto / meta-neural-network on Ubuntu | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: get fetch depth | |
id: fetch_depth | |
run: | | |
if ${{ github.event_name == 'pull_request' }}; then | |
echo "depth=${{ github.event.pull_request.commits }}" >> $GITHUB_OUTPUT | |
else | |
echo "depth=1" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: steps.fetch_depth.outputs.depth | |
- name: Check if rebuild required | |
uses: ./.github/actions/check-rebuild | |
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: 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: false # Enable this step when you need to make new cache. | |
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: steps.rebuild.outputs.rebuild == '1' | |
id: yocto-build | |
run: | | |
echo "::group::apt-get install" | |
sudo apt-get update | |
sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file locales libacl1 | |
pip install websockets | |
sudo locale-gen en_US.UTF-8 | |
echo "::endgroup::" | |
echo "::group::Prepare poky and meta-neural-network" | |
git clone git://git.yoctoproject.org/poky -b yocto-5.0.3 && cd poky | |
git clone https://github.com/nnstreamer/meta-neural-network -b scarthgap | |
echo 'SRC_URI = "git://${{ github.workspace }}/;protocol=file;usehead=1;nobranch=1"' >> meta-neural-network/recipes-nnstreamer/nnstreamer/nnstreamer_%.bbappend | |
source oe-init-build-env | |
bitbake-layers add-layer ../meta-neural-network | |
echo "::endgroup::" | |
echo "::group::Set local.conf" | |
echo 'DL_DIR = "/var/cache/yocto/downloads"' >> conf/local.conf | |
echo 'BB_GENERATE_MIRROR_TARBALLS = "1"' >> conf/local.conf | |
echo 'SSTATE_DIR = "/var/cache/yocto/sstate-cache"' >> conf/local.conf | |
echo 'BB_SIGNATURE_HANDLER = "OEEquivHash"' >> conf/local.conf | |
echo 'BB_HASHSERVE = "auto"' >> conf/local.conf | |
echo 'BB_HASHSERVE_UPSTREAM = "wss://hashserv.yoctoproject.org/ws"' >> conf/local.conf | |
echo 'SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH"' >> conf/local.conf | |
echo 'PERSISTENT_DIR="/var/cache/yocto/persistent"' >> conf/local.conf | |
echo "::endgroup::" | |
echo "::group::Do setscene-only task and disregard its error" | |
bitbake --setscene-only nnstreamer || true | |
echo "::endgroup::" | |
echo "::group::Build nnstreamer" | |
bitbake --skip-setscene nnstreamer | |
echo "::endgroup::" | |
echo "::group::Cat build log" | |
cat tmp/work/core2-64-poky-linux/nnstreamer/*/temp/log.do_configure || true | |
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' | |
with: | |
path: | | |
/var/cache/yocto/downloads | |
/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 }} |