-
Notifications
You must be signed in to change notification settings - Fork 54
142 lines (128 loc) · 4.42 KB
/
ci_e2e_tests_pos_android.yaml
File metadata and controls
142 lines (128 loc) · 4.42 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: e2e-tests-pos-android
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'dapps/pos-app/**'
pull_request:
paths:
- 'dapps/pos-app/**'
jobs:
e2e-tests:
name: Maestro E2E Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/ci-setup
with:
root-path: dapps/pos-app
package-manager: npm
- name: Install Java 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
architecture: x86_64
- name: Create env file
run: |
touch dapps/pos-app/.env
echo ${{ vars.POS_DEV_ENV_FILE }} >> dapps/pos-app/.env
- name: Expo Prebuild
run: |
cd dapps/pos-app
npm run prebuild
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-pos-e2e-${{ hashFiles('dapps/pos-app/package.json', 'dapps/pos-app/app.json') }}
restore-keys: |
${{ runner.os }}-gradle-pos-e2e-
- name: Build Release APK
id: build
run: |
cd dapps/pos-app/android
./gradlew assembleRelease
- name: Enable KVM
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
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Run Maestro E2E Tests
id: maestro
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
arch: x86_64
profile: pixel_6
heap-size: 512M
ram-size: 4096M
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
disable-animations: true
script: |
adb install dapps/pos-app/android/app/build/outputs/apk/release/app-release.apk
$HOME/.maestro/bin/maestro test dapps/pos-app/e2e/ --format junit --output maestro-report.xml
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: maestro-test-results
path: maestro-report.xml
- name: Send Slack notification
if: always() && !cancelled()
uses: slackapi/slack-github-action@v2.1.0
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"text": "POS App E2E Test Report",
"blocks": [
{
"type": "header",
"text": { "type": "plain_text", "text": "🧪 POS App E2E Test Report" }
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" },
{ "type": "mrkdwn", "text": "*Triggered by:*\n`${{ github.actor }}`" }
]
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Build:*\n`${{ steps.build.outcome == 'success' && '✅ Success' || '❌ Failed' }}`" },
{ "type": "mrkdwn", "text": "*E2E Tests:*\n`${{ steps.maestro.outcome == 'success' && '✅ Passed' || '❌ Failed' }}`" }
]
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Overall Status:*\n`${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}`" }
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": { "type": "plain_text", "text": "View Workflow Run" },
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}