-
-
Notifications
You must be signed in to change notification settings - Fork 30
71 lines (67 loc) · 2.71 KB
/
size.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
name: Compare app size
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [ benchmark ]
steps:
- uses: actions/checkout@v4
- name: set up JDK 1.19
uses: actions/setup-java@v4
with:
java-version: '19'
distribution: zulu
- name: Create empty keystore
run: echo "storeFile=/" > keystore.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- id: type
uses: ASzc/change-string-case-action@v5
with:
string: ${{ matrix.build_type }}
- name: Build PR app
run: ./gradlew assembleFull${{ steps.type.outputs.capitalized }}
- name: Copy PR app
run: |
ls
cp ./app/build/outputs/apk/full/${{ matrix.build_type }}/app-full-${{ matrix.build_type }}.apk ../pr.apk
ls
- uses: actions/checkout@v4
with:
ref: main
- name: Build main app
run: ./gradlew assembleFull${{ steps.type.outputs.capitalized }}
- name: Copy PR app
run: |
ls
cp ./app/build/outputs/apk/full/${{ matrix.build_type }}/app-full-${{ matrix.build_type }}.apk ../main.apk
ls
- name: diff between apks
id: diff
run: |
curl -L https://github.com/JakeWharton/diffuse/releases/download/0.1.0/diffuse-0.1.0-binary.jar --output diffuse.jar
chmod +x diffuse.jar
COMMENT=$(./diffuse.jar diff ../main.apk ../pr.apk)
COMMENT=${COMMENT%DEX*}
COMMENT="${COMMENT//'%'/'%25'}"
COMMENT="${COMMENT//$'\n'/'%0A'}"
COMMENT="${COMMENT//$'\r'/'%0D'}"
echo "COMMENT=$COMMENT" >> $GITHUB_ENV
- uses: actions/github-script@v7
with:
script: |
var comment = `${{ env.COMMENT }}`
comment = comment.replace(/%25/g, '%')
comment = comment.replace(/%0A/g, '\n')
comment = comment.replace(/%0D/g, '\r')
comment = "```" + comment + "```"
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
})