Skip to content

Commit ee67dfb

Browse files
authored
[CLX-3245][Horizon] Add horizon workflows (#3392)
refs: CLX-3245 affects: Horizon, Student release note: none
1 parent 8e20899 commit ee67dfb

File tree

8 files changed

+432
-61
lines changed

8 files changed

+432
-61
lines changed

.github/workflows/pr-pipeline.yml

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,252 @@ jobs:
248248
-Dorg.gradle.jvmargs="-Xmx6g -XX:+HeapDumpOnOutOfMemoryError" \
249249
-Dkotlin.compiler.execution.strategy=in-process
250250
251+
horizon-unit-tests:
252+
name: horizon-unit-tests
253+
runs-on: ubuntu-latest
254+
timeout-minutes: 30
255+
if: >-
256+
(
257+
(github.event.action == 'opened' || github.event.action == 'synchronize') ||
258+
(github.event.action == 'labeled' && (contains(github.event.pull_request.labels.*.name, 'run-ui-tests') || contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')))
259+
) && contains(github.event.pull_request.body, 'Student')
260+
steps:
261+
- name: Checkout repository
262+
uses: actions/checkout@v4
263+
with:
264+
submodules: 'recursive'
265+
fetch-depth: 1
266+
token: ${{ secrets.ACCESS_TOKEN }}
267+
268+
- name: Set up JDK 17
269+
uses: actions/setup-java@v4
270+
with:
271+
java-version: '17'
272+
distribution: 'temurin'
273+
274+
- name: Cache Gradle packages
275+
uses: actions/cache@v4
276+
with:
277+
path: |
278+
~/.gradle/caches
279+
~/.gradle/wrapper
280+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
281+
restore-keys: |
282+
${{ runner.os }}-gradle-
283+
284+
- name: Cache Gradle Build Cache
285+
uses: actions/cache@v4
286+
with:
287+
path: |
288+
~/.gradle/caches/build-cache-*
289+
.gradle
290+
key: ${{ runner.os }}-gradle-build-cache-${{ github.sha }}
291+
restore-keys: |
292+
${{ runner.os }}-gradle-build-cache-
293+
294+
- name: Run unit tests
295+
run: |
296+
./gradle/gradlew -p apps :horizon:testDebugUnitTest \
297+
--build-cache \
298+
--parallel \
299+
--max-workers=4 \
300+
--no-daemon \
301+
-Dorg.gradle.jvmargs="-Xmx6g -XX:+HeapDumpOnOutOfMemoryError" \
302+
-Dkotlin.compiler.execution.strategy=in-process
303+
304+
horizon-test-build:
305+
name: horizon-test-build
306+
runs-on: ubuntu-latest
307+
timeout-minutes: 30
308+
if: >-
309+
(
310+
(github.event.action == 'opened' || github.event.action == 'synchronize') ||
311+
(github.event.action == 'labeled' && (contains(github.event.pull_request.labels.*.name, 'run-ui-tests') || contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')))
312+
) && contains(github.event.pull_request.body, 'Student')
313+
steps:
314+
- name: Checkout repository
315+
uses: actions/checkout@v4
316+
with:
317+
submodules: 'recursive'
318+
fetch-depth: 1
319+
token: ${{ secrets.ACCESS_TOKEN }}
320+
321+
- name: Set up JDK 17
322+
uses: actions/setup-java@v4
323+
with:
324+
java-version: '17'
325+
distribution: 'temurin'
326+
327+
- name: Cache Gradle packages
328+
uses: actions/cache@v4
329+
with:
330+
path: |
331+
~/.gradle/caches
332+
~/.gradle/wrapper
333+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
334+
restore-keys: |
335+
${{ runner.os }}-gradle-
336+
337+
- name: Cache Gradle Build Cache
338+
uses: actions/cache@v4
339+
with:
340+
path: |
341+
~/.gradle/caches/build-cache-*
342+
.gradle
343+
key: ${{ runner.os }}-gradle-build-cache-${{ github.sha }}
344+
restore-keys: |
345+
${{ runner.os }}-gradle-build-cache-
346+
347+
- name: Build Horizon test APK
348+
run: |
349+
./gradle/gradlew -p apps :horizon:assembleDebugAndroidTest \
350+
--build-cache \
351+
--parallel \
352+
--max-workers=4 \
353+
--no-daemon \
354+
-Dorg.gradle.jvmargs="-Xmx6g -XX:+HeapDumpOnOutOfMemoryError" \
355+
-Dkotlin.compiler.execution.strategy=in-process
356+
357+
- name: Upload Horizon test APK
358+
uses: actions/upload-artifact@v4
359+
with:
360+
name: horizon-debug-androidTest.apk
361+
path: libs/horizon/build/outputs/apk/androidTest/debug/horizon-debug-androidTest.apk
362+
363+
horizon-ui-tests:
364+
name: horizon-ui-tests
365+
runs-on: ubuntu-latest
366+
timeout-minutes: 60
367+
if: >-
368+
(
369+
(github.event.action == 'opened' || github.event.action == 'synchronize') ||
370+
(github.event.action == 'labeled' && (contains(github.event.pull_request.labels.*.name, 'run-ui-tests') || contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')))
371+
) && contains(github.event.pull_request.body, 'Student')
372+
needs: [student-build, horizon-test-build]
373+
steps:
374+
- name: Checkout repository
375+
uses: actions/checkout@v4
376+
with:
377+
fetch-depth: 1
378+
379+
- name: Download artifacts
380+
uses: actions/download-artifact@v4
381+
382+
- name: Setup Service account
383+
env:
384+
FIREBASE_SERVICE_ACCOUNT_KEY: ${{ secrets.GCLOUD_KEY }}
385+
run: |
386+
if [ -z "${FIREBASE_SERVICE_ACCOUNT_KEY}" ]; then
387+
echo "Error: GCLOUD_KEY secret is not set"
388+
exit 1
389+
fi
390+
echo "${FIREBASE_SERVICE_ACCOUNT_KEY}" > service-account-key.json
391+
chmod 600 service-account-key.json
392+
393+
- name: Setup Flank config
394+
run: cp ./libs/horizon/flank.yml ./flank.yml
395+
396+
- name: Copy APKs to expected locations
397+
run: |
398+
if [ -d "student-qa-debug.apk" ]; then
399+
mkdir -p apps/student/build/outputs/apk/qa/debug
400+
mv student-qa-debug.apk/student-qa-debug.apk apps/student/build/outputs/apk/qa/debug/
401+
rm -rf student-qa-debug.apk
402+
fi
403+
if [ -d "horizon-debug-androidTest.apk" ]; then
404+
mkdir -p libs/horizon/build/outputs/apk/androidTest/debug
405+
mv horizon-debug-androidTest.apk/horizon-debug-androidTest.apk libs/horizon/build/outputs/apk/androidTest/debug/
406+
rm -rf horizon-debug-androidTest.apk
407+
fi
408+
409+
- name: Run Flank UI tests
410+
uses: Flank/flank@v23.10.1
411+
with:
412+
version: 'v23.07.0'
413+
platform: 'android'
414+
service_account: './service-account-key.json'
415+
flank_configuration_file: './flank.yml'
416+
417+
- name: Report test results to Splunk
418+
run: ./apps/postProcessTestRun.bash horizon-ui results/`ls results`
419+
env:
420+
SPLUNK_MOBILE_TOKEN: ${{ secrets.SPLUNK_MOBILE_TOKEN }}
421+
OBSERVE_MOBILE_TOKEN: ${{ secrets.OBSERVE_MOBILE_TOKEN }}
422+
BITRISE_TRIGGERED_WORKFLOW_ID: ${{ github.workflow }}
423+
BITRISE_GIT_BRANCH: ${{ github.ref_name }}
424+
BITRISE_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
425+
426+
- name: Cleanup sensitive files
427+
if: always()
428+
run: rm -f service-account-key.json
429+
430+
horizon-interaction-tests:
431+
name: horizon-interaction-tests
432+
runs-on: ubuntu-latest
433+
timeout-minutes: 60
434+
if: >-
435+
(
436+
(github.event.action == 'opened' || github.event.action == 'synchronize') ||
437+
(github.event.action == 'labeled' && (contains(github.event.pull_request.labels.*.name, 'run-ui-tests') || contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')))
438+
) && contains(github.event.pull_request.body, 'Student')
439+
needs: [student-build, horizon-test-build]
440+
steps:
441+
- name: Checkout repository
442+
uses: actions/checkout@v4
443+
with:
444+
fetch-depth: 1
445+
446+
- name: Download artifacts
447+
uses: actions/download-artifact@v4
448+
449+
- name: Setup Service account
450+
env:
451+
FIREBASE_SERVICE_ACCOUNT_KEY: ${{ secrets.GCLOUD_KEY }}
452+
run: |
453+
if [ -z "${FIREBASE_SERVICE_ACCOUNT_KEY}" ]; then
454+
echo "Error: GCLOUD_KEY secret is not set"
455+
exit 1
456+
fi
457+
echo "${FIREBASE_SERVICE_ACCOUNT_KEY}" > service-account-key.json
458+
chmod 600 service-account-key.json
459+
460+
- name: Setup Flank config
461+
run: cp ./libs/horizon/flank_interaction.yml ./flank.yml
462+
463+
- name: Copy APKs to expected locations
464+
run: |
465+
if [ -d "student-qa-debug.apk" ]; then
466+
mkdir -p apps/student/build/outputs/apk/qa/debug
467+
mv student-qa-debug.apk/student-qa-debug.apk apps/student/build/outputs/apk/qa/debug/
468+
rm -rf student-qa-debug.apk
469+
fi
470+
if [ -d "horizon-debug-androidTest.apk" ]; then
471+
mkdir -p libs/horizon/build/outputs/apk/androidTest/debug
472+
mv horizon-debug-androidTest.apk/horizon-debug-androidTest.apk libs/horizon/build/outputs/apk/androidTest/debug/
473+
rm -rf horizon-debug-androidTest.apk
474+
fi
475+
476+
- name: Run Flank interaction tests
477+
uses: Flank/flank@v23.10.1
478+
with:
479+
version: 'v23.07.0'
480+
platform: 'android'
481+
service_account: './service-account-key.json'
482+
flank_configuration_file: './flank.yml'
483+
484+
- name: Report test results to Splunk
485+
run: ./apps/postProcessTestRun.bash horizon-interaction results/`ls results`
486+
env:
487+
SPLUNK_MOBILE_TOKEN: ${{ secrets.SPLUNK_MOBILE_TOKEN }}
488+
OBSERVE_MOBILE_TOKEN: ${{ secrets.OBSERVE_MOBILE_TOKEN }}
489+
BITRISE_TRIGGERED_WORKFLOW_ID: ${{ github.workflow }}
490+
BITRISE_GIT_BRANCH: ${{ github.ref_name }}
491+
BITRISE_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
492+
493+
- name: Cleanup sensitive files
494+
if: always()
495+
run: rm -f service-account-key.json
496+
251497
parent-portrait-ui-tests:
252498
name: parent-portrait-ui-tests
253499
runs-on: ubuntu-latest

libs/horizon/flank.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
gcloud:
2+
project: delta-essence-114723
3+
# Use the next two lines to run locally
4+
# app: ../apps/student/build/outputs/apk/qa/debug/student-qa-debug.apk
5+
# test: ./build/outputs/apk/androidTest/debug/horizon-debug-androidTest.apk
6+
app: ./apps/student/build/outputs/apk/qa/debug/student-qa-debug.apk
7+
test: ./libs/horizon/build/outputs/apk/androidTest/debug/horizon-debug-androidTest.apk
8+
results-bucket: android-student
9+
auto-google-login: true
10+
use-orchestrator: true
11+
performance-metrics: false
12+
record-video: true
13+
timeout: 30m
14+
test-targets:
15+
- package com.instructure.horizon.ui
16+
- notAnnotation com.instructure.canvas.espresso.annotations.E2E, com.instructure.canvas.espresso.annotations.Stub, com.instructure.canvas.espresso.annotations.FlakyE2E, com.instructure.canvas.espresso.annotations.KnownBug, com.instructure.canvas.espresso.annotations.OfflineE2E
17+
device:
18+
- model: Pixel2.arm
19+
version: 29
20+
locale: en_US
21+
orientation: portrait
22+
23+
flank:
24+
testShards: 10
25+
testRuns: 1

libs/horizon/flank_interaction.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
gcloud:
2+
project: delta-essence-114723
3+
# Use the next two lines to run locally
4+
# app: ../apps/student/build/outputs/apk/qa/debug/student-qa-debug.apk
5+
# test: ./build/outputs/apk/androidTest/debug/horizon-debug-androidTest.apk
6+
app: ./apps/student/build/outputs/apk/qa/debug/student-qa-debug.apk
7+
test: ./libs/horizon/build/outputs/apk/androidTest/debug/horizon-debug-androidTest.apk
8+
results-bucket: android-student
9+
auto-google-login: true
10+
use-orchestrator: true
11+
performance-metrics: false
12+
record-video: true
13+
timeout: 30m
14+
test-targets:
15+
- package com.instructure.horizon.interaction
16+
- notAnnotation com.instructure.canvas.espresso.annotations.E2E, com.instructure.canvas.espresso.annotations.Stub, com.instructure.canvas.espresso.annotations.FlakyE2E, com.instructure.canvas.espresso.annotations.KnownBug, com.instructure.canvas.espresso.annotations.OfflineE2E
17+
device:
18+
- model: Pixel2.arm
19+
version: 29
20+
locale: en_US
21+
orientation: portrait
22+
23+
flank:
24+
testShards: 3
25+
testRuns: 1

0 commit comments

Comments
 (0)