-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
102 lines (91 loc) · 3.14 KB
/
tests_unit.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Unit Tests
on:
workflow_dispatch:
inputs:
clearCaches:
description: "Clear workflow caches where possible"
required: false
type: string
pull_request:
push:
# Ignore merge queue branches on push; avoids merge_group+push concurrency race since ref is same
branches-ignore:
- 'gh-readonly-queue/**'
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit:
name: JUnit Tests (${{ matrix.name }})
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
# macOS 14 is in beta and runs on Apple Silicon [M1]
os: [ubuntu-latest, macos-14, windows-latest]
# define 'name' so we don't need to update branch protection rules if the os changes
include:
- os: ubuntu-latest
name: ubuntu
- os: macos-14
name: macos
- os: windows-latest
name: windows
runs-on: ${{ matrix.os }}
#env:
# CODACY_TOKEN: ${{ secrets.CODACY_TOKEN }}
steps:
- name: Configure Windows Pagefile
uses: al-cheb/[email protected]
if: contains(matrix.os, 'windows')
with:
minimum-size: 8GB
maximum-size: 12GB
disk-root: "C:"
- uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
timeout-minutes: 5
with:
# Only write to the cache for builds on the 'main' branches, stops branches evicting main cache
# Builds on other branches will only read from main branch cache writes
# Comment this and the with: above out for performance testing on a branch
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
gradle-home-cache-cleanup: true
# Windows runner currently having cache pollution issues, disable cache for the platform
cache-disabled: ${{ contains(matrix.os, 'windows') }}
- name: Clear Caches Optionally
if: "${{ github.event.inputs.clearCaches != '' }}"
shell: bash
run: |
du -sk ~/.gradle
rm -fr ~/.gradle
du -sk ~/.gradle || echo ~/.gradle is gone
- name: Gradle Dependency Download
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 60
max_attempts: 3
command: ./gradlew robolectricSdkDownload --daemon
- name: Run Unit Tests
uses: gradle/gradle-build-action@v3
with:
arguments: jacocoUnitTestReport --daemon
- name: Stop Gradle
if: contains(matrix.os, 'windows')
uses: gradle/gradle-build-action@v3
with:
arguments: --stop
- uses: codecov/codecov-action@v3
with:
verbose: true