[Action] Add testhub action accepted/tizen_unified accepted/tizen_unified_x main tizen accepted/tizen/unified/20250613.040650 accepted/tizen/unified/x/20250613.044714
authorGichan Jang <gichan2.jang@samsung.com>
Wed, 2 Apr 2025 04:12:11 +0000 (13:12 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Mon, 7 Apr 2025 11:54:25 +0000 (20:54 +0900)
Upload coverage result to TestHub.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
.github/workflows/nns_edge_testhub.yml [new file with mode: 0644]

diff --git a/.github/workflows/nns_edge_testhub.yml b/.github/workflows/nns_edge_testhub.yml
new file mode 100644 (file)
index 0000000..3aca3ac
--- /dev/null
@@ -0,0 +1,69 @@
+name: nnstreamer-edge with TestHub
+
+on:
+    schedule:
+      # 08:00 AM (KST) Mon-Fri
+      - cron: "00 23 * * 0-4"
+
+    # Allow manually triggering the workflow
+    workflow_dispatch:
+
+jobs:
+  build:
+    runs-on: [ code-linux, code-large ]
+    if: github.repository_owner == 'OASIS'
+    # Runs an action only if org is OASIS
+
+    steps:
+    - uses: actions/checkout@v4
+
+    - name: Prepare gbs build
+      run: |
+        ubuntu_version=`lsb_release -rs`
+        echo "deb [trusted=yes] http://download.tizen.org/tools/latest-release/Ubuntu_$ubuntu_version/ /" | sudo tee /etc/apt/sources.list.d/tizen.list
+        sudo apt-get update && sudo apt-get install -y gbs rpm2cpio cpio
+        cp .github/workflows/tizen.gbs.conf ~/.gbs.conf
+
+    - name: install mosquitto broker
+      run: |
+        sudo apt-get install -y mosquitto
+        sudo mosquitto -d
+
+    - name: Run gbs build
+      run: |
+        gbs build --define "unit_test 1" --define "testcoverage 1" --include-all
+
+    - name: Parse coverage result
+      run: |
+        mkdir -p rpms
+        mv ~/GBS-ROOT/local/repos/tizen/*/RPMS/*coverage*.rpm rpms
+        rpm2cpio rpms/*coverage*.rpm | cpio -idumv
+        mkdir -p gcov_html
+        mkdir -p unittest_result
+        mv -f usr/share/nnstreamer-edge/unittest/result/* gcov_html
+
+        cp ~/GBS-ROOT/local/BUILD-ROOTS/scratch.*/home/abuild/rpmbuild/BUILD/nnstreamer-edge-*/build/*.xml unittest_result
+
+    - name: upload artifacts (gcov_html)
+      uses: CODE-Actions/upload-artifact@v2
+      with:
+        name: gcov_html     # name of stored artifact
+        path: gcov_html     # target directory or file to store
+
+    - name: upload artifacts (coverage_results)
+      uses: CODE-Actions/upload-artifact@v2
+      with:
+        name: unittest_result           # name of stored artifact
+        path: unittest_result           # target directory or file to store
+
+  testhub:
+    runs-on: [ code-linux ]
+    needs: build
+    steps:
+      - name: Send to TestHub
+        uses: CODE-Actions/testhub@v1
+        with:
+          test-tool: gtest
+          test-artifact-name: unittest_result
+          coverage-tool: gcov
+          coverage-artifact-name: gcov_html