-
Notifications
You must be signed in to change notification settings - Fork 12
171 lines (154 loc) · 6.63 KB
/
upstream-integration-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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#
# Copyright 2023 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
#
# Action to execute upstream integration tests - Edge Network (Konductor)
name: Integration Tests
on:
# `*` is a special character in YAML so you have to quote this string
# Avoiding start of hour and other common times to avoid conflicts with peak times
schedule:
# Run every weekday at 12:45 PM PDT (Daylight saving time) -> 7:45 PM UTC
# Add +1 hour when back in PST
- cron: '45 19 * * 1-5'
workflow_dispatch:
inputs:
branch:
description: 'The branch to use when running the integration tests'
required: false
default: 'main'
id:
description: '(Optional) The identifier for the run.'
required: false
tags-mobile-property-id:
type: string
description: '(Optional) The tags mobile property ID to use for the test. A default is used if not set.'
required: false
default: ''
edge-location-hint:
type: choice
description: '(Optional) The Edge location hint to set before each test.'
required: false
default: 'None'
options:
- 'or2'
- 'va6'
- 'irl1'
- 'ind1'
- 'jpn3'
- 'sgp3'
- 'aus3'
- 'EmptyString'
- 'Invalid'
- 'None'
jobs:
test-integration-upstream:
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [29]
steps:
- name: Job run identifier ${{ github.event.inputs.id }}
run: |
if [ -z "${{ github.event.inputs.id }}" ]; then \
echo No job run identifier was set.
else
echo 'Job run identifier is:' ${{ inputs.id }}
fi;
- name: Check branch mismatch
run: |
CURRENT_BRANCH=$(echo "${GITHUB_REF##*/}")
INPUT_BRANCH="${{ github.event.inputs.branch }}"
echo "Running on branch: ${CURRENT_BRANCH}"
echo "Input branch: ${INPUT_BRANCH}"
if [ "${CURRENT_BRANCH}" != "${INPUT_BRANCH}" ]; then
echo "::warning title=Branch Mismatch::Input branch '${INPUT_BRANCH}' does not match current branch '${CURRENT_BRANCH}'"
fi
# This is to help reduce Android emulator boot up flakiness issues:
# See: https://github.com/ReactiveCircus/android-emulator-runner/issues/324#issuecomment-2009351180
- name: Delete unnecessary tools 🔧
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
android: false # Don't remove Android tools
tool-cache: true # Remove image tool cache - rm -rf "$AGENT_TOOLSDIRECTORY"
dotnet: true # rm -rf /usr/share/dotnet
haskell: true # rm -rf /opt/ghc...
swap-storage: true # rm -f /mnt/swapfile (4GiB)
docker-images: false # Takes 16s, enable if needed in the future
large-packages: false # includes google-cloud-sdk and it's slow
# The Android emulator requires Kernel-based Virtual Machine (KVM) access to run efficiently.
# This step ensures that the KVM is accessible with the proper permissions across all users.
- 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
ls /dev/kvm
- name: Checkout
uses: actions/checkout@v4.2.0
with:
ref: ${{ github.event.inputs.branch }}
- name: Set up Java
uses: actions/setup-java@v4.4.0
with:
distribution: 'zulu'
java-version: 17
- name: Gradle cache
uses: gradle/actions/setup-gradle@v4.1.0
- name: AVD cache
uses: actions/cache@v4.0.2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
# Note that the AVD configurations must exactly match what's used in the test step, otherwise the cache will not be used.
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # v2.32.0
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
disk-size: 6000M
heap-size: 600M
force-avd-creation: false
emulator-options: -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."
# Logcat logging from: https://github.com/ReactiveCircus/android-emulator-runner/issues/9#issuecomment-867909354
- name: Run tests
uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # v2.32.0
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
disk-size: 6000M
heap-size: 600M
force-avd-creation: false
emulator-options: -no-snapshot-save -no-metrics -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
mkdir -p logs # Ensure the 'logs' directory exists
adb logcat -c # Clear logs
touch logs/emulator.log # Create log file
chmod 777 logs/emulator.log # Allow writing to log file
adb logcat >> logs/emulator.log & # Pipe all logcat messages into log file as a background process
make upstream-integration-test TAGS_MOBILE_PROPERTY_ID=${{ github.event.inputs.tags-mobile-property-id }} EDGE_LOCATION_HINT=${{ github.event.inputs.edge-location-hint }}
- name: Upload Logcat Logs
if: always()
uses: actions/upload-artifact@v4.4.0
with:
name: logcat-logs
path: logs/emulator.log
# Potential workflow solutions on job failure
- name: On failure
if: ${{ failure() }}
run: |
echo 'Job used branch: ' ${{ github.event.inputs.branch }}. Please make sure this is the branch to run off of.