-
Notifications
You must be signed in to change notification settings - Fork 41
43 lines (43 loc) · 1.57 KB
/
unit-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Unit Test
on:
pull_request:
workflow_dispatch:
jobs:
unit-tests:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
- name: 🔍 Detect Cache Key And Paths
id: gradle-cache
uses: actions/github-script@v7
with:
script: |
const cacheDetectorScriptPath = '/./.github/scripts/gradle-cache-detector.js'
const cacheDetectorScript = require(`${process.env.GITHUB_WORKSPACE}${cacheDetectorScriptPath}`)
await cacheDetectorScript({core});
- name: 🐘 Fetch gradle cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.gradle-cache.outputs['gradle-cache-paths'] }}
key: ${{ steps.gradle-cache.outputs['gradle-cache-key'] }}
- name: 🐘 Fetch build cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.gradle-cache.outputs['build-cache-paths'] }}
key: ${{ steps.gradle-cache.outputs['build-cache-key'] }}
- name: Run unit tests
run: ./gradlew --no-configuration-cache testDebugUnitTest --continue
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ github.event_name == 'pull_request' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: Unit Test Results
junit_files: '**/test-results/**/*.xml'