2024-03-29 18:56:51 +03:00
|
|
|
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
|
2024-04-30 13:16:39 +03:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
2024-03-29 18:56:51 +03:00
|
|
|
|
2022-04-26 16:00:41 +03:00
|
|
|
name: Unit tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches: [ master, stable-* ]
|
|
|
|
push:
|
|
|
|
branches: [ master, stable-* ]
|
|
|
|
|
2022-06-10 09:03:43 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
|
|
|
|
2024-03-29 21:22:56 +03:00
|
|
|
concurrency:
|
2023-06-08 14:53:06 +03:00
|
|
|
group: unit-tests-${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-04-26 16:00:41 +03:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-10-04 20:00:34 +03:00
|
|
|
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
2023-05-08 19:35:05 +03:00
|
|
|
- name: Set up JDK 17
|
2024-09-11 11:50:24 +03:00
|
|
|
uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0
|
2022-04-26 16:00:41 +03:00
|
|
|
with:
|
|
|
|
distribution: "temurin"
|
2023-05-08 19:35:05 +03:00
|
|
|
java-version: 17
|
2022-04-27 09:43:51 +03:00
|
|
|
- name: Delete old comments
|
2022-05-31 11:07:03 +03:00
|
|
|
env:
|
2022-12-16 12:18:51 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-04-27 09:43:51 +03:00
|
|
|
if: ${{ always() }}
|
2022-05-31 11:07:03 +03:00
|
|
|
run: scripts/deleteOldComments.sh "test" "Unit" ${{github.event.number}}
|
2022-04-26 16:00:41 +03:00
|
|
|
- name: Run unit tests with coverage
|
2024-07-16 18:45:36 +03:00
|
|
|
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0
|
2022-04-26 16:00:41 +03:00
|
|
|
with:
|
|
|
|
arguments: jacocoTestGplayDebugUnitTest
|
2022-04-27 09:43:51 +03:00
|
|
|
- name: Upload failing results
|
|
|
|
if: ${{ failure() }}
|
2022-05-31 11:07:03 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-12-16 12:18:51 +03:00
|
|
|
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "test" "Unit" ${{github.event.number}}
|
2022-04-26 16:00:41 +03:00
|
|
|
- name: Upload coverage to codecov
|
2024-06-13 23:00:53 +03:00
|
|
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
2022-04-26 16:00:41 +03:00
|
|
|
with:
|
2022-04-27 09:43:51 +03:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2022-04-27 11:19:23 +03:00
|
|
|
flags: unit
|
2022-04-26 16:00:41 +03:00
|
|
|
fail_ci_if_error: true
|
|
|
|
- name: Upload jacoco artifacts
|
|
|
|
if: ${{ failure() }}
|
2024-09-02 20:03:51 +03:00
|
|
|
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
|
2022-04-26 16:00:41 +03:00
|
|
|
with:
|
|
|
|
name: test-results
|
2022-04-27 09:43:51 +03:00
|
|
|
path: app/build/reports/tests/testGplayDebugUnitTest/
|