-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (77 loc) · 2.75 KB
/
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
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
name: Test
on: [pull_request, workflow_dispatch, workflow_call]
concurrency:
group: test-${{ github.event.number }}
cancel-in-progress: true
jobs:
test_unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'microsoft'
cache: gradle
- name: Run Unit Tests
run: ./gradlew testReleaseUnitTest
continue-on-error: false
test_unit_coverage:
name: Unit Tests Coverage
runs-on: ubuntu-latest
# test coverage only runs on PRs
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Run Unit Tests Coverage
run: ./gradlew koverXmlReportDebug
- name: Show Coverage Report XML
run: cat library/build/reports/kover/reportDebug.xml
- name: Add coverage report to PR
id: kover
uses: mi-kas/[email protected]
with:
path: ${{ github.workspace }}/library/build/reports/kover/reportDebug.xml
title: Code Coverage
update-comment: true
min-coverage-overall: 85
min-coverage-changed-files: 85
coverage-counter-type: LINE
test_instrumentation:
name: Instrumentation Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Run Instrumentation Tests
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: 23
target: google_apis
arch: x86_64
script: ./gradlew connectedCheck -PexcludeTests=com.paypal.messagesdemo.* --info | tee connectedCheck.log
continue-on-error: true
- name: Show Test XML
run: |
mkdir -p library/build/outputs/androidTest-results/connected/logs
grep -E 'com.paypal.*Test.*(SUCCESS|FAILED|failed)' connectedCheck.log > library/build/outputs/androidTest-results/connected/logs/connectedCheck.xml
cat library/build/outputs/androidTest-results/connected/**/*.xml
echo ""
error_count=$(grep -E 'com.paypal.*Test.*(FAILED|failed|failure)' library/build/outputs/androidTest-results/connected/**/*.xml | wc -l | awk '{$1=$1};1')
if [[ "$error_count" -ne "0" ]]; then echo "Tests failed. See above"; exit 1; fi