浏览代码

Run unit tests in GH actions

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 年之前
父节点
当前提交
68b2665b09
共有 1 个文件被更改,包括 34 次插入0 次删除
  1. 34 0
      .github/workflows/unit-tests.yml

+ 34 - 0
.github/workflows/unit-tests.yml

@@ -0,0 +1,34 @@
+name: Unit tests
+
+on:
+    pull_request:
+        branches: [ master, stable-* ]
+    push:
+        branches: [ master, stable-* ]
+
+jobs:
+    test:
+        runs-on: ubuntu-latest
+        steps:
+            -   uses: actions/checkout@v3
+            -   name: Set up JDK 11
+                uses: actions/setup-java@v3
+                with:
+                    distribution: "temurin"
+                    java-version: 11
+            -   name: Run unit tests with coverage
+                uses: gradle/gradle-build-action@v2
+                with:
+                    arguments: jacocoTestGplayDebugUnitTest
+            -   name: Upload coverage to codecov
+                uses: codecov/codecov-action@v2
+                with:
+                    token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
+                    flags: unittests
+                    fail_ci_if_error: true
+            -   name: Upload jacoco artifacts
+                if: ${{ failure() }}
+                uses: actions/upload-artifact@v3
+                with:
+                    name: test-results
+                    path: app/build/jacoco/