-
Notifications
You must be signed in to change notification settings - Fork 181
91 lines (81 loc) · 4.02 KB
/
call-create-baseline.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
name: Create BaselineProfile files
on:
workflow_call:
outputs:
BUILD_VARIANT_NAME:
description: "The name of requested build variant"
value: ${{ jobs.baseline_file.outputs.BUILD_VARIANT_NAME }}
BASELINE_FILE_ID:
description: "The identifier of current baseline file"
value: ${{ jobs.baseline_file.outputs.BASELINE_FILE_ID }}
BASELINE_FILE_PATH:
description: "The path for baseline path"
value: ${{ jobs.baseline_file.outputs.BASELINE_FILE_PATH }}
inputs:
BUILD_VARIANT_NAME:
required: true
type: string
jobs:
baseline_file:
name: Upload baseline profile file
runs-on: ubuntu-latest
outputs:
BUILD_VARIANT_NAME: ${{ steps.create_uppercase_variant.outputs.BUILD_VARIANT_NAME }}
BASELINE_FILE_ID: ${{ steps.create_baseline_file_id.outputs.BASELINE_FILE_ID }}
BASELINE_FILE_PATH: ${{ steps.create_baseline_file_path.outputs.BASELINE_FILE_PATH }}
steps:
- name: Checkout Git repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: 'adopt'
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3
- run: sdkmanager --list
# steps.create_uppercase_variant.outputs.BUILD_VARIANT_NAME
# steps.create_uppercase_variant.outputs.BUILD_VARIANT_NAME_UPPERCASE
- id: create_uppercase_variant
run: |
build_variant="${{ inputs.BUILD_VARIANT_NAME }}"
echo "BUILD_VARIANT_NAME=${build_variant}" >> $GITHUB_OUTPUT
echo "BUILD_VARIANT_NAME_UPPERCASE=${build_variant^}" >> $GITHUB_OUTPUT
# steps.create_baseline_file_id.outputs.BASELINE_FILE_ID
- id: create_baseline_file_id
run: |
build_variant=${{ steps.create_uppercase_variant.outputs.BUILD_VARIANT_NAME }}
baseline_file_id="baseline_profile_file_${build_variant}"
echo "BASELINE_FILE_ID=${baseline_file_id}" >> $GITHUB_OUTPUT
# steps.create_baseline_file_path.outputs.BASELINE_FILE_PATH
- id: create_baseline_file_path
run: |
build_variant=${{ steps.create_uppercase_variant.outputs.BUILD_VARIANT_NAME }}
baseline_file_path="./instances/android/app/src/${build_variant}/generated/baselineProfiles/baseline-prof.txt"
echo "BASELINE_FILE_PATH=${baseline_file_path}" >> $GITHUB_OUTPUT
# Make kvm able to launch emulator
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# steps.create_baseline_task.outputs.BASELINE_TASK
- id: create_baseline_task
run: |
build_variant_uppercase=${{ steps.create_uppercase_variant.outputs.BUILD_VARIANT_NAME_UPPERCASE }}
no_test_param="-P android.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile"
task_name="generate${{ steps.create_uppercase_variant.outputs.BUILD_VARIANT_NAME_UPPERCASE }}BaselineProfile"
path=":instances:android:app"
gradlew_full_task="$path:$task_name $no_test_param --stacktrace"
echo "BASELINE_TASK=$gradlew_full_task" >> $GITHUB_OUTPUT
# Here also specified ANDROID environment variables for sudo command
- name: Run baseline profiles
run: |
./gradlew ${{ steps.create_baseline_task.outputs.BASELINE_TASK }}
- uses: actions/upload-artifact@184d73b71b93c222403b2e7f1ffebe4508014249
name: "Upload baseline file"
with:
name: ${{ steps.create_baseline_file_id.outputs.BASELINE_FILE_ID }}
path: ${{ steps.create_baseline_file_path.outputs.BASELINE_FILE_PATH }}