From 498ff38fa4d2d257cafb0282e352d65ac82dbd60 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Tue, 14 Jan 2025 10:10:27 +0900 Subject: [PATCH] [infra/github] Add arm32/64 onert test This commit adds arm32/64 onert test to onert test workflow. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- .github/workflows/run-onert-build.yml | 77 +++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-onert-build.yml b/.github/workflows/run-onert-build.yml index 5310e71d667..493d5fd4948 100644 --- a/.github/workflows/run-onert-build.yml +++ b/.github/workflows/run-onert-build.yml @@ -45,7 +45,12 @@ jobs: matrix: type: [ debug, release ] ubuntu_code: [ focal, jammy ] # TODO: noble - arch: [ x86_64 ] # TODO: armv7l, aarch64 + arch: [ x86_64, armv7l, aarch64 ] + include: + - arch: armv7l + platform: arm + - arch: aarch64 + platform: aarch64 runs-on: ubuntu-22.04 container: image: nnfw/one-devtools:${{ matrix.ubuntu_code }} @@ -53,6 +58,7 @@ jobs: env: TARGET_ARCH: ${{ matrix.arch }} BUILD_TYPE: ${{ matrix.type }} + CROSS_BUILD: ${{ matrix.arch != 'x86_64' && '1' || '0' }} steps: - name: Checkout uses: actions/checkout@v4 @@ -67,11 +73,76 @@ jobs: external-onert- external- + - name: Download rootfs for cross build + if: matrix.arch != 'x86_64' + uses: dawidd6/action-download-artifact@v7 + with: + workflow: generate-rootfs.yml + branch: master + name: rootfs_${{ matrix.platform }}_${{ matrix.ubuntu_code }} + + # Workaround: symlink for rootfs checker in cmake toolchain file + - name: Install rootfs for cross build + if: matrix.arch != 'x86_64' + run: | + mkdir -p tools/cross/rootfs + tar -zxf rootfs_${{ matrix.platform }}_${{ matrix.ubuntu_code }}.tar.gz -C tools/cross/rootfs + pushd tools/cross/rootfs/${{ matrix.platform }} + ln -sf usr/lib lib + popd + - name: Build onert run: | - make -f Makefile.template + make -f Makefile.template create-testsuite - - name: Run test + - name: Run test on native build + if: matrix.arch == 'x86_64' run: | ./Product/out/test/onert-test unittest ./Product/out/test/onert-test unittest --unittestdir=./Product/out/nnapi-gtest + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: onert-${{ matrix.arch }}-${{ matrix.ubuntu_code }}-${{ matrix.type }} + path: Product/out/test-suite.tar.gz + retention-days: ${{ github.event_name == 'pull_request' && '3' || '7' }} + + test_cross: + if: github.repository_owner == 'Samsung' + needs: build + runs-on: ubuntu-22.04 + strategy: + matrix: + type: [ debug, release ] + ubuntu_code: [ focal, jammy ] # TODO: noble + arch: [ armv7l, aarch64 ] + include: + - arch: armv7l + platform: linux/arm/v7 + - arch: aarch64 + platform: linux/arm64 + steps: + - name: QEMU for cross build + if: matrix.arch != 'x86_64' + uses: docker/setup-qemu-action@v3 + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: onert-${{ matrix.arch }}-${{ matrix.ubuntu_code }}-${{ matrix.type }} + path: Product/out/test-suite.tar.gz + + - name: Run test on cross build + if: matrix.arch != 'x86_64' + uses: addnab/docker-run-action@v3 + with: + image: ubuntu:${{ matrix.ubuntu_code }} + shell: bash + options: | + --platform ${{ matrix.platform }} + -v ${{ github.workspace }}:/work -w /work + run: | + tar -zxf Product/out/test-suite.tar.gz -C ./ + ./Product/out/test/onert-test unittest + ./Product/out/test/onert-test unittest --unittestdir=./Product/out/nnapi-gtest