-
Notifications
You must be signed in to change notification settings - Fork 35
138 lines (136 loc) · 4.79 KB
/
Android-CI.yml
File metadata and controls
138 lines (136 loc) · 4.79 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: PullRequest
on:
push:
branches:
- master
pull_request:
jobs:
buildTest:
name: Test
runs-on: ${{ matrix.os }}
permissions:
contents: write
pull-requests: write
repository-projects: write
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ]
api: [ 28 ]
tag: [ default ]
abi: [ x86_64 ]
emulatorApi: [ 9 ]
java_version: [ 17 ]
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: true
- name: kvm support
run: |
egrep -c '(vmx|svm)' /proc/cpuinfo
id
sudo adduser $USER kvm
sudo chown -R $USER /dev/kvm
id
- name: prepare
run: |
sudo apt-get update && sudo apt-get install -y exiftool imagemagick xdg-utils libimage-exiftool-perl zsh jq xorg
# brew install exiftool imagemagick
- name: Install JDK ${{ matrix.java_version }}
uses: actions/setup-java@v5
with:
distribution: "adopt"
java-version: ${{ matrix.java_version }}
- uses: gradle/actions/wrapper-validation@v5
- name: Install Android SDK
uses: hannesa2/action-android/install-sdk@0.1.16.7
- name: Build project
run: ./gradlew assembleDebug
- name: Deploy test (Don't merge)
run: ./gradlew publishMavenPublicationToMavenRepository
- name: Run tests
run: ./gradlew test
- name: Test jitpack publish command
run: ./gradlew :MPChartLib:publishToMavenLocal
- name: Run instrumentation tests
uses: hannesa2/action-android/emulator-run-cmd@0.1.16.7
with:
cmd: ./gradlew cAT --continue
api: ${{ matrix.api }}
tag: ${{ matrix.tag }}
abi: ${{ matrix.abi }}
cmdOptions: -noaudio -no-boot-anim -no-window -metrics-collection
disableAnimations: true
- name: Archive Espresso results
uses: actions/upload-artifact@v5
if: ${{ always() }}
with:
name: MPChart-Espresso-report-${{ matrix.api }}-${{ matrix.tag }}-${{ matrix.abi }}-${{ matrix.emulatorApi }}
path: app/build/reports/androidTests/connected
if-no-files-found: error
- name: Archive screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v5
with:
name: MPChart-Screenshots-${{ matrix.api }}-${{ matrix.tag }}-${{ matrix.abi }}-${{ matrix.emulatorApi }}
path: |
app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected
app/build/outputs/androidTest-results/connected
- name: Compare screenshots
env:
CLASSIC_TOKEN: ${{ secrets.CLASSIC_TOKEN }}
emulatorApi: ${{ matrix.emulatorApi }}
SCREENSHOT_USER: ${{ secrets.SCREENSHOT_USER }}
SCREENSHOT_PASSWORD: ${{ secrets.SCREENSHOT_PASSWORD }}
run: |
ls -ls app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected
cp app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/emulator-5554\ -\ ${{ matrix.emulatorApi }}/* screenshotsToCompare${{ matrix.emulatorApi }}
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
./screenShotScript/screenShotCompare.sh
- name: Archive screenshots diffs
if: ${{ always() }}
uses: actions/upload-artifact@v5
with:
name: MPChart-Screenshots-diffs-${{ matrix.api }}-${{ matrix.tag }}-${{ matrix.abi }}-${{ matrix.emulatorApi }}
path: |
screenshotDiffs
- name: Show git status
if: ${{ always() }}
run: |
git add screenshotsToCompare${{ matrix.emulatorApi }}
git status
[ "$(git status -s -uno)" ] && exit 1 || exit 0
Check:
name: Check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
java_version: [ 17 ]
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install JDK ${{ matrix.java_version }}
uses: actions/setup-java@v5
with:
distribution: "adopt"
java-version: ${{ matrix.java_version }}
- name: Install Android SDK
uses: hannesa2/action-android/install-sdk@0.1.16.7
- name: Run tests
run: ./gradlew test
- name: Test jitpack publish command
run: ./gradlew :MPChartLib:publishToMavenLocal
- name: Code checks
run: ./gradlew check
- name: Archive Lint report
uses: actions/upload-artifact@v5
if: ${{ always() }}
with:
name: Chart-Lint-report
path: ./**/build/reports/lint-results*.html