-
Notifications
You must be signed in to change notification settings - Fork 23
102 lines (93 loc) · 3.85 KB
/
run-live-tests.yaml
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
name: Run Live Tests
on:
workflow_dispatch:
inputs:
am-url:
description: The AM url to run live test cases against
type: string
required: true
default: https://openam-sdks.forgeblocks.com/am
realm:
description: The AM realm to use
type: string
required: true
default: alpha
cookie-name:
description: The AM session cookie name
type: string
required: true
default: 5421aeddf91aa20
jobs:
run-tests:
runs-on: macos-latest
steps:
# Clone the repo
- name: Clone the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
# Setup JDK and cache and restore dependencies.
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
# Replace forgerock_url, forgerock_realm, and forgerock_cookie_name values in strings.xml
- name: Configure strings.xml
run: |
amURL=$(echo ${{ inputs.am-url }} | sed 's/\//\\\//g')
echo $amURL
sed -i -r "s/\(<string name=\"forgerock_url\".*>\).*\(<\/string>\)/\1$amURL\2/" "forgerock-auth/src/androidTest/res/values/strings.xml"
sed -i -r "s/\(<string name=\"forgerock_realm\".*>\).*\(<\/string>\)/\1${{ inputs.realm }}\2/" "forgerock-auth/src/androidTest/res/values/strings.xml"
sed -i -r "s/\(<string name=\"forgerock_cookie_name\".*>\).*\(<\/string>\)/\1${{ inputs.cookie-name }}\2/" "forgerock-auth/src/androidTest/res/values/strings.xml"
rm -rf forgerock-auth/src/androidTest/res/values/strings.xml-r
cat forgerock-auth/src/androidTest/res/values/strings.xml
# Prepare test emulator
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."
# Run the e2e tests on emulator
- name: Run e2e tests on emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew -Pandroid.testInstrumentationRunnerArguments.package=org.forgerock.android.auth.callback :forgerock-auth:connectedAndroidTest --stacktrace --no-daemon
# Publish test reports
- name: Publish test results
if: success() || failure()
uses: dorny/test-reporter@v1
with:
name: e2e tests results
path: 'forgerock-auth/build/outputs/androidTest-results/connected/TEST-*.xml'
list-suites: 'all'
list-tests: 'all'
fail-on-error: 'true'
reporter: java-junit
# Save the logcat logs as run artifact
- name: Upload logcat logs
uses: actions/upload-artifact@v4
with:
name: Logcat-logs
path: forgerock-auth/build/outputs/androidTest-results/connected/**/logcat-org*.txt
# Send slack notification with result status
- uses: 8398a7/action-slack@v3
with:
mention: 'stoyan.petrov'
if_mention: 'failure,cancelled'
fields: repo,author,eventName,message,job,took
status: ${{ job.status }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: always()