Skip to content

Commit 9d4ccc6

Browse files
Merge pull request #731 from square/sedwards/add-mobile-dev
Upload Poetry APK to mobile.dev and start analysis
2 parents 70cc79b + ac2d9e6 commit 9d4ccc6

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/kotlin.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,71 @@ jobs:
131131
with:
132132
name: instrumentation-test-results-${{ matrix.api-level }}
133133
path: ./**/build/reports/androidTests/connected/**
134+
135+
upload-to-mobiledev:
136+
name: mobile.dev | Build & Upload
137+
runs-on : ubuntu-latest
138+
timeout-minutes: 20
139+
steps :
140+
- uses: actions/checkout@v2
141+
- name: set up JDK 11.0.7
142+
uses: actions/setup-java@v1
143+
with:
144+
java-version: 11.0.7
145+
146+
## Build artifact, using cache.
147+
- uses: burrunan/gradle-cache-action@v1
148+
name: Build Performance Poetry APK
149+
with:
150+
gradle-dependencies-cache-key: |
151+
gradle/libs.versions.toml
152+
arguments: |
153+
:benchmarks:performance-poetry:complex-poetry:assembleRelease --no-daemon --stacktrace
154+
concurrent: true
155+
gradle-build-scan-report: false
156+
gradle-distribution-sha-256-sum-warning: false
157+
158+
## Upload with POST
159+
- name: Upload Poetry to mobile.dev
160+
run: |
161+
curl -X POST \
162+
-H 'Content-Type: multipart/form-data' \
163+
-H "Authorization: Bearer $MOBILE_DEV_API_KEY" \
164+
--data-binary "@$APP_FILE" \
165+
https://api.mobile.dev/apk > mobile-dev.json
166+
env:
167+
MOBILE_DEV_API_KEY : ${{ secrets.MOBILE_DEV_API_KEY }}
168+
APP_FILE : benchmarks/performance-poetry/complex-poetry/build/outputs/apk/release/complex-poetry-release-unsigned.apk
169+
170+
## Extract ID
171+
- name : Get JSON Property
172+
uses : notiz-dev/github-action-json-property@release
173+
id: upload_id
174+
with:
175+
path: 'mobile-dev.json'
176+
prop_path: 'id'
177+
178+
## Start analysis
179+
- name: Start analysis on mobile.dev
180+
run: |
181+
#!/usr/bin/env bash
182+
set -e
183+
set -x
184+
GIT_HASH=$(git log --pretty=format:'%h' -n 1)
185+
BENCHMARK_NAME="$GIT_HASH"
186+
REPO_BASE_NAME=$(basename "$REPO_NAME")
187+
if [[ ! -z "$PULL_REQUEST_ID" ]]; then
188+
PR_DATA=", \"repoOwner\":\"$REPO_OWNER\", \"repoName\":\"$REPO_BASE_NAME\", \"pullRequestId\":\"$PULL_REQUEST_ID\""
189+
fi
190+
curl -X POST \
191+
-H "Content-Type: application/json" \
192+
-H "Authorization: Bearer $MOBILE_DEV_API_KEY" \
193+
https://api.mobile.dev/analysis \
194+
--data "{\"benchmarkName\": \"$BENCHMARK_NAME\", \"apkId\": \"$APP_ID\", \"branch\": \"$BRANCH_NAME\"$PR_DATA}"
195+
env:
196+
APP_ID : ${{ steps.upload_id.outputs.prop }}
197+
MOBILE_DEV_API_KEY : ${{ secrets.MOBILE_DEV_API_KEY }}
198+
REPO_OWNER : ${{ github.repository_owner }}
199+
REPO_NAME : ${{ github.repository }}
200+
BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
201+
PULL_REQUEST_ID : ${{ github.event.pull_request.number }}

0 commit comments

Comments
 (0)