forked from Samsung/ONE
-
Notifications
You must be signed in to change notification settings - Fork 0
266 lines (241 loc) · 9.78 KB
/
pub-circle-int-launchpad.yml
File metadata and controls
266 lines (241 loc) · 9.78 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
name: Publish circle-interpreter to Launchpad
on:
# TODO turn on schedule
#schedule:
# # 05:00 AM (KST, UTC+9:00) Mon-Fri
# - cron: '00 20 * * 0-4'
workflow_dispatch:
inputs:
cirint_version:
description: 'The version of circle-interpreter'
required: true
default: '1.30.0'
cirint_description:
description: 'Description of changelog for circle-interpreter'
required: true
deb_fullname:
description: 'Full name of Debian package author'
required: false
default: 'On-device AI developers'
deb_email:
description: 'Email address of Debian package author'
required: false
default: 'nnfw@samsung.com'
is_release:
description: 'Is this a release version?
Set to false to append date-based subversion.
(true/false)'
required: false
default: 'false'
defaults:
run:
shell: bash
# Cancel previous running jobs when pull request is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
configure:
if: github.repository_owner == 'Samsung'
name: Set current date and time
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-datetime.outputs.version }}
br_version: ${{ steps.set-datetime.outputs.br_version }}
steps:
- name: Set date and time
id: set-datetime
run: |
base_version="${{ inputs.cirint_version }}"
is_release="${{ inputs.is_release }}"
if [[ "$is_release" == "true" ]]; then
version="${base_version}"
br_version="${base_version}"
else
release_date=$(date +%Y%m%d%H%M)
version="${base_version}~${release_date}"
br_version="${base_version}-${release_date}"
fi
echo "version=${version}" >> $GITHUB_OUTPUT
echo "br_version=${br_version}" >> $GITHUB_OUTPUT
debian-release:
needs: configure
strategy:
matrix:
# TODO activate noble
ubuntu_code: [ focal, jammy ]
name: circle-interpreter ubuntu ${{ matrix.ubuntu_code }}
runs-on: ubuntu-latest
container:
image: nnfw/one-devtools:${{ matrix.ubuntu_code }}
options: --user root
credentials:
username: ${{ secrets.NNFW_DOCKER_USERNAME }}
password: ${{ secrets.NNFW_DOCKER_TOKEN }}
env:
NNCC_BUILD: build
NNCC_WORKSPACE: build/release
NNCC_INSTALL_PREFIX: ${{ github.workspace }}/build/release.install
CIRINTP_PREFIX: cirintp
steps:
- name: Prepare, set distro versions
id: prepare
run: |
VERSION="${{ needs.configure.outputs.version }}~${{ matrix.ubuntu_code }}"
changes_file="circle-interpreter_${VERSION}_source.changes"
tarball_file="circle-interpreter_${VERSION}.orig.tar.xz"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "changes_file=${changes_file}" >> $GITHUB_OUTPUT
echo "tarball_file=${tarball_file}" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- name: Build without test
run: |
CIR_INTP_ITEMS="angkor;cwrap;pepper-str;pepper-strcast;pepper-csv2vec;pp"
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};oops;loco;logo-core;logo;locop"
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};hermes;hermes-std;safemain;mio-circle08"
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};luci-compute;luci;luci-interpreter"
CIR_INTP_ITEMS="${CIR_INTP_ITEMS};foder;arser;vconone;circle-interpreter"
echo ${CIR_INTP_ITEMS}
./nncc configure \
-DENABLE_STRICT_BUILD=ON \
-DENABLE_TEST=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DEXTERNALS_BUILD_THREADS=$(nproc) \
-DCMAKE_INSTALL_PREFIX=${NNCC_INSTALL_PREFIX} \
-DBUILD_WHITELIST="${CIR_INTP_ITEMS}"
./nncc build -j$(nproc)
cmake --build ${NNCC_WORKSPACE} -- install
- name: Gather files
run: |
cd ${NNCC_BUILD}
mkdir -p ${CIRINTP_PREFIX}
cp -v ${NNCC_INSTALL_PREFIX}/bin/circle-interpreter ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libloco.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_env.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_import.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_interpreter.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_lang.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_logex.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_log.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_plan.so ./${CIRINTP_PREFIX}/.
cp -v ${NNCC_INSTALL_PREFIX}/lib/libluci_profile.so ./${CIRINTP_PREFIX}/.
- name: Update changelog
run: |
cd ${{ env.NNCC_BUILD }}/${{ env.CIRINTP_PREFIX }}
cp -rf ../../infra/debian/circle-interpreter ./debian
export DEBFULLNAME="${{ inputs.deb_fullname }}"
export DEBEMAIL="${{ inputs.deb_email }}"
dch -v "${{ steps.prepare.outputs.VERSION }}" \
--distribution "${{ matrix.ubuntu_code }}" \
"${{ inputs.cirint_description }}" -b
- name: Create original tarball
run: |
cd ${{ env.NNCC_BUILD }}
tar -caf ${{ steps.prepare.outputs.tarball_file }} ${{ env.CIRINTP_PREFIX }}
- name: Signing with debuild and debsign
run: |
cd ${{ env.NNCC_BUILD }}/${{ env.CIRINTP_PREFIX }}
rm -rf ~/.gnupg
echo -n "${{ secrets.GPG_NNFW_SIGNING_KEY }}" | base64 --decode | gpg --import
# get fingerprint
FPR=$(gpg --list-keys --with-colons | awk -F: '$1 == "fpr" { print $10; exit }')
echo "$FPR:6:" | gpg --import-ownertrust
debuild -S -us -uc
debsign -k${FPR} ../circle-interpreter_*.changes
- name: Upload to Launchpad
run: |
cd ${{ env.NNCC_BUILD }}
mkdir -p ~/.ssh
echo "${{ secrets.LAUNCHPAD_NNFW_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
dput ppa:circletools/nightly ${{ steps.prepare.outputs.changes_file }}
- name: Upload artifact, circle-interpreter
uses: actions/upload-artifact@v4
with:
name: circle-interpreter_${{ steps.prepare.outputs.VERSION }}
retention-days: 3
path: |
${{ env.NNCC_BUILD }}/${{ steps.prepare.outputs.tarball_file }}
create-changelog-artifact:
needs: [ configure, debian-release ]
if: ${{ success() && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
env:
DEFAULT_DISTRO: jammy
steps:
- name: Download tarball, ${{ env.DEFAULT_DISTRO }}
uses: actions/download-artifact@v4
with:
name: circle-interpreter_${{ needs.configure.outputs.version }}~${{ env.DEFAULT_DISTRO }}
- name: Copy changelogs
run: |
mkdir changelogs
mkdir ${{ env.DEFAULT_DISTRO }}
tar -axf circle-interpreter_${{ needs.configure.outputs.version }}~${{ env.DEFAULT_DISTRO }}.orig.tar.xz \
-C ${{ env.DEFAULT_DISTRO }}
cp ${{ env.DEFAULT_DISTRO }}/cirintp/debian/changelog changelogs/changelog
- name: Upload artifact, changelogs
uses: actions/upload-artifact@v4
with:
name: changelogs
retention-days: 3
path: |
changelogs
create-pr-on-success:
needs: [ configure, create-changelog-artifact ]
if: ${{ success() && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
env:
BR_VERSION: ${{ needs.configure.outputs.br_version }}
permissions:
contents: write
pull-requests: write
steps:
- name: Prepare, set distro versions
id: prepare
run: |
VERSION="${{ needs.configure.outputs.version }}"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- name: Set up Git
run: |
git config --global user.name "Seungho Henry Park"
git config --global user.email "shs.park@samsung.com"
- name: Download tarball
uses: actions/download-artifact@v4
with:
name: changelogs
- name: Update the changelog file
run: |
cp changelog infra/debian/circle-interpreter/
- name: Create PR branch and commit changelog
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH=auto/update-cirint-changelog-${BR_VERSION}
git checkout -b ${BRANCH}
git add infra/debian/circle-interpreter/changelog
git commit -m "[infra/debian] Update changelog for circle-interpreter" \
-m "This updates the changelog for circle-interpreter_${{ steps.prepare.outputs.VERSION }}." \
-m "It is auto-generated PR from github workflow." \
-m "" \
-m "ONE-DCO-1.0-Signed-off-by: Seungho Henry Park <shs.park@samsung.com>"
git push origin ${BRANCH}
- name: Create PR
env:
GH_TOKEN: ${{ secrets.SHSPARK_GITHUB_TOKEN }}
run: |
BRANCH=auto/update-cirint-changelog-${BR_VERSION}
gh pr create \
--title "[infra/debian] Update changelog for circle-interpreter" \
--body "$(cat <<EOF
This updates the changelog for circle-interpreter_${{ steps.prepare.outputs.VERSION }}.
This PR includes updated changelog after successful debian build.
It is auto-generated PR from github workflow.
ONE-DCO-1.0-Signed-off-by: Seungho Henry Park <shs.park@samsung.com>
EOF
)" \
--head "${BRANCH}" \
--base "master"