-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathbrowserstack-prepare-artifacts.yaml
More file actions
128 lines (115 loc) · 4.68 KB
/
browserstack-prepare-artifacts.yaml
File metadata and controls
128 lines (115 loc) · 4.68 KB
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
name: Prepare Device Farm Artifacts
on:
workflow_call:
secrets:
E2E_CONFIG:
description: 'Variables for the e2e tests'
required: true
SIGNING_KEYSTORE:
description: 'Needed for signing the apk artifacts'
required: true
SIGNING_ALIAS:
description: 'Needed for signing the apk artifacts'
required: true
SIGNING_KEYSTORE_PASSWORD:
description: 'Needed for signing the apk artifacts'
required: true
SIGNING_KEY_PASSWORD:
description: 'Needed for signing the apk artifacts'
required: true
SLACK_WEBHOOK:
description: Slack Notifier Incoming Webhook
required: true
jobs:
prepare-device-farm-artifacts:
runs-on: ubuntu-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
# Set up the variables for the tests from the secrets
- name: Setup config file for e2e tests
run: |
echo "${{ secrets.E2E_CONFIG }}" > forgerock-integration-tests/src/main/assets/test_config.properties
# Use the following step to debug the config file in case of issues
- name: Verify config file exists (debug only)
run: |
ls -l forgerock-integration-tests/src/main/assets
shasum -a 256 forgerock-integration-tests/src/main/assets/test_config.properties
# 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'
- name: Set NDK version
run: echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/28.2.13676358" >> $GITHUB_ENV
- name: Confirm NDK version
run: $ANDROID_NDK_HOME/ndk-build --version
# Build apk files
- name: Prepare device farm artifacts
run: |
./gradlew assembleDebug assembleDebugAndroidTest \
--stacktrace \
--build-cache \
--parallel
# List the available build tools versions see https://github.com/r0adkll/sign-android-release/issues/84
- name: List build tools versions
run: ls $ANDROID_HOME/build-tools/
# Sign app-debug.apk
- name: Sign app-debug.apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: e2e/app/build/outputs/apk/debug
signingKeyBase64: ${{ secrets.SIGNING_KEYSTORE }}
alias: ${{ secrets.SIGNING_ALIAS }}
keyStorePassword: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "36.0.0"
# Sign forgerock-integration-tests-debug-androidTest.apk
- name: Sign forgerock-integration-tests-debug-androidTest.apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: forgerock-integration-tests/build/outputs/apk/androidTest/debug
signingKeyBase64: ${{ secrets.SIGNING_KEYSTORE }}
alias: ${{ secrets.SIGNING_ALIAS }}
keyStorePassword: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "36.0.0"
# Publish the signed APKs as build artifacts
- name: Publish app-debug.apk
uses: actions/upload-artifact@v4
if: success()
with:
name: app-debug-signed.apk
path: e2e/app/build/outputs/apk/debug/app-debug-signed.apk
- name: Publish forgerock-integration-tests-debug-androidTest-signed.apk
uses: actions/upload-artifact@v4
if: success()
with:
name: forgerock-integration-tests-debug-androidTest-signed.apk
path: forgerock-integration-tests/build/outputs/apk/androidTest/debug/forgerock-integration-tests-debug-androidTest-signed.apk
# Send slack notification ONLY if any of the steps above fail
- name: Send slack notification
uses: 8398a7/action-slack@v3
with:
status: custom
fields: all
custom_payload: |
{
attachments: [{
title: ':no_entry: Failed to prepare device farm test artifacts',
color: 'danger',
text: `\nWorkflow: ${process.env.AS_WORKFLOW} -> ${process.env.AS_JOB}\nPull request: ${process.env.AS_PULL_REQUEST}\nCommit: ${process.env.AS_COMMIT} by ${process.env.AS_AUTHOR}`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: failure()