forked from nnstreamer/nnstreamer
-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (150 loc) · 6.91 KB
/
yocto.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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 }}