Skip to content
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
288 changes: 288 additions & 0 deletions .github/workflows/pub-onnx2circle-launchpad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
name: Publish onnx2circle 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:
o2c_version:
description: 'The version of onnx2circle'
required: true
default: '0.2.0'
o2c_description:
description: 'Description of changelog for onnx2circle'
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' || github.repository_owner == 'shs-park'
name: Set current date and time
# TODO change to the 'ubuntu-latest'
#runs-on: ubuntu-latest
runs-on: [ self-hosted, shs-park ]
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.o2c_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:
include:
# TODO activate noble
- ubuntu_code: focal
ubuntu_vstr: u2004
- ubuntu_code: jammy
ubuntu_vstr: u2204
name: onnx2circle ubuntu ${{ matrix.ubuntu_code }}
# TODO change to the 'ubuntu-latest'
#runs-on: ubuntu-latest
runs-on: [ self-hosted, shs-park ]
container:
image: nnfw/circle-mlir-build-${{ matrix.ubuntu_vstr }}:latest
options: --user root
credentials:
username: ${{ secrets.NNFW_DOCKER_USERNAME }}
password: ${{ secrets.NNFW_DOCKER_TOKEN }}
env:
BUILD: build
INSTALL: build/Release.install
O2C_PREFIX: o2c
O2C_BUILDTYPE: Release
steps:
- name: Prepare, set distro versions
id: prepare
run: |
VERSION="${{ needs.configure.outputs.version }}~${{ matrix.ubuntu_code }}"
changes_file="onnx2circle_${VERSION}_source.changes"
tarball_file="onnx2circle_${VERSION}.orig.tar.xz"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "changes_file=${changes_file}" >> $GITHUB_OUTPUT
echo "tarball_file=${tarball_file}" >> $GITHUB_OUTPUT

- name: Install circle-interpreter
run: |
add-apt-repository ppa:circletools/nightly
apt update
apt install circle-interpreter

- name: Checkout
uses: actions/checkout@v4

# NOTE Docker image has pre-installed submodules in /workdir
# NOTE Docker image has pre-installed python packages
- name: Configure
run: |
cd circle-mlir
Python3_ROOT_DIR=/usr/bin cmake -B build/${{ env.O2C_BUILDTYPE }} -S ./ \
-DCMAKE_INSTALL_PREFIX=build/${{ env.O2C_BUILDTYPE }}.install \
-DCMAKE_BUILD_TYPE=${{ env.O2C_BUILDTYPE }} \
-DCIRCLE_MLIR_WORKDIR=/workdir

- name: Build, test & install
env:
ONE_COMPILER_ROOT: /usr/share/circletools
run: |
cd circle-mlir
cmake --build build/${{ env.O2C_BUILDTYPE }} -j4
# TODO enable test
# CTEST_OUTPUT_ON_FAILURE=1 cmake --build build/${{ env.O2C_BUILDTYPE }} --verbose -- test
cmake --build build/${{ env.O2C_BUILDTYPE }} -j4 -- install

- name: Gather files
run: |
cd circle-mlir
mkdir -p ${{ env.O2C_PREFIX }}
cp -v ${{ env.INSTALL }}/bin/onnx2circle ./${{ env.O2C_PREFIX }}/.

- name: Update changelog
run: |
cd circle-mlir/${{ env.O2C_PREFIX }}
cp -rf ../infra/debian/onnx2circle ./debian
export DEBFULLNAME="${{ inputs.deb_fullname }}"
export DEBEMAIL="${{ inputs.deb_email }}"
dch -v "${{ steps.prepare.outputs.VERSION }}" \
--distribution "${{ matrix.ubuntu_code }}" \
"${{ inputs.o2c_description }}" -b

- name: Create original tarball
run: |
cd circle-mlir
tar -caf ${{ steps.prepare.outputs.tarball_file }} ${{ env.O2C_PREFIX }}

- name: Conditionally install cmake for debuild
run: |
if [ "${{ matrix.ubuntu_code }}" = "focal" ]; then
echo "Installing cmake for focal"
apt update
apt install -y cmake
fi

- name: Signing with debuild and debsign
run: |
cd circle-mlir/${{ env.O2C_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} ../onnx2circle_*.changes

- name: Upload to Launchpad
run: |
cd circle-mlir
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, onnx2circle
uses: actions/upload-artifact@v4
with:
name: onnx2circle_${{ steps.prepare.outputs.VERSION }}
retention-days: 3
path: |
circle-mlir/${{ steps.prepare.outputs.tarball_file }}

create-changelog-artifact:
needs: [ configure, debian-release ]
# TODO need to activate the branch condition
# if: ${{ success() && github.ref == 'refs/heads/master' }}
if: ${{ success() }}
# TODO change to the 'ubuntu-latest'
#runs-on: ubuntu-latest
runs-on: [ self-hosted, shs-park ]
env:
DEFAULT_DISTRO: jammy
steps:
- name: Download tarball, ${{ env.DEFAULT_DISTRO }}
uses: actions/download-artifact@v4
with:
name: onnx2circle_${{ needs.configure.outputs.version }}~${{ env.DEFAULT_DISTRO }}

- name: Copy changelogs
run: |
mkdir changelogs
mkdir ${{ env.DEFAULT_DISTRO }}
tar -axf onnx2circle_${{ needs.configure.outputs.version }}~${{ env.DEFAULT_DISTRO }}.orig.tar.xz \
-C ${{ env.DEFAULT_DISTRO }}
cp ${{ env.DEFAULT_DISTRO }}/o2c/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 ]
# TODO need to activate the branch condition
# if: ${{ success() && github.ref == 'refs/heads/master' }}
if: ${{ success() }}
# TODO change to the 'ubuntu-latest'
#runs-on: ubuntu-latest
runs-on: [ self-hosted, shs-park ]
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 circle-mlir/infra/debian/onnx2circle/

- name: Create PR branch and commit changelog
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH=auto/update-o2c-changelog-${BR_VERSION}
git checkout -b ${BRANCH}
git add circle-mlir/infra/debian/onnx2circle/changelog
git commit -m "[circle-mlir/infra] Update changelog for onnx2circle" \
-m "This updates the changelog for onnx2circle_${{ 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-o2c-changelog-${BR_VERSION}
gh pr create \
--title "[circle-mlir/infra] Update changelog for onnx2circle" \
--body "$(cat <<EOF
This updates the changelog for onnx2circle_${{ 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"
5 changes: 5 additions & 0 deletions circle-mlir/infra/debian/onnx2circle/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
onnx2circle (0.2.0~202505190000~jammy) jammy; urgency=medium
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can increase the minor version as 0.3.0
Internal repo released 0.2.0 but now we have higher llvm-project and onnx-mlir :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I will update the version to 0.3.0 right after all PRs are landed.


* First onnx2circle Debian package release for developers.

-- On-device AI developers <nnfw@samsung.com> Mon, 26 May 2025 00:00:00 +0000
1 change: 1 addition & 0 deletions circle-mlir/infra/debian/onnx2circle/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
13 changes: 13 additions & 0 deletions circle-mlir/infra/debian/onnx2circle/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Source: onnx2circle
Section: devel
Priority: optional
Build-Depends: debhelper (>= 12), cmake
Maintainer: Neural Network Acceleration Solution Developers <nnfw@samsung.com>
Standards-Version: 4.5.0
Homepage: https://github.com/Samsung/ONE

Package: onnx2circle
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: ONNX to Circle model converter
Converts ONNX models into Samsung's Circle format.
13 changes: 13 additions & 0 deletions circle-mlir/infra/debian/onnx2circle/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: onnx2circle
Source: https://github.com/Samsung/ONE
Comment: These binaries are built from the ONE project.

Files: *
Copyright: 2025 Samsung Electronics., Ltd.
License: Apache-2.0
This package is licensed under the Apache License, Version 2.0.
.
On Debian systems, the full text of the Apache License Version 2.0
can be found in:
/usr/share/common-licenses/Apache-2.0
3 changes: 3 additions & 0 deletions circle-mlir/infra/debian/onnx2circle/onnx2circle.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# {FILES_TO_INSTALL} {DEST_DIR}
# bin
bin/onnx2circle usr/share/circletools/bin/
2 changes: 2 additions & 0 deletions circle-mlir/infra/debian/onnx2circle/onnx2circle.links
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# bin
usr/share/circletools/bin/onnx2circle usr/bin/onnx2circle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
onnx2circle: binary-without-manpage
37 changes: 37 additions & 0 deletions circle-mlir/infra/debian/onnx2circle/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/make -f

export NNCC_INSTALL_PREFIX=$(CURDIR)
export DEBIAN_PREFIX=$(CURDIR)/debian/tmp

%:
dh $@

override_dh_auto_clean:
# Nothing to clean
true

override_dh_auto_configure:
# No configure step needed
true

override_dh_auto_build:
# No build step needed
true

override_dh_auto_test:
# No test step needed
true

override_dh_auto_install:
# copy the bin file
mkdir -p ${DEBIAN_PREFIX}/bin
cp ${NNCC_INSTALL_PREFIX}/onnx2circle ${DEBIAN_PREFIX}/bin/

override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

override_dh_strip:
dh_strip --no-automatic-dbgsym

override_dh_builddeb:
dh_builddeb
1 change: 1 addition & 0 deletions circle-mlir/infra/debian/onnx2circle/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
onnx2circle source: source-is-missing onnx2circle
2 changes: 1 addition & 1 deletion infra/debian/circle-interpreter/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ circle-interpreter (1.30.0~202505190000~jammy) jammy; urgency=medium

* First circle-interpreter Debian package release for developers.

-- On-device AI developers <nnfw@samsung.com> Mon, 19 May 2025 00:00:00 +0000
-- On-device AI developers <nnfw@samsung.com> Mon, 19 May 2025 00:00:00 +0000