-
Notifications
You must be signed in to change notification settings - Fork 146
116 lines (96 loc) · 3.69 KB
/
test-android-emulator.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: test android emulator
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
jobs:
run_tests:
name: Flutter ${{ matrix.flutter_version }} on emulator.wtf
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter_version }} on emulator.wtf
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
EXCLUDED_TESTS: ${{ steps.set_excluded_tests.outputs.EXCLUDED_TESTS }}
URL_TO_DETAILS: ${{ steps.tests_step.outputs.URL_TO_DETAILS }}
strategy:
fail-fast: false
matrix:
flutter_version: ['3.13.x']
defaults:
run:
working-directory: packages/patrol/example
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Gradle cache
uses: gradle/gradle-build-action@v2
with:
generate-job-summary: false
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter_version }}
- name: Preload Flutter artifacts
run: flutter precache
- name: Set up Patrol CLI
working-directory: packages/patrol_cli
run: dart pub global activate --source path . && patrol
- name: Generate Gradle wrapper
run: flutter build apk --debug --flavor=does-not-exist || true
- name: Install ew-cli
run: |
mkdir -p "$HOME/bin"
curl "https://maven.emulator.wtf/releases/ew-cli" -o "$HOME/bin/ew-cli"
chmod a+x "$HOME/bin/ew-cli"
echo "$HOME/bin" >> $GITHUB_PATH
echo "EW_API_TOKEN=${{ secrets.EW_API_TOKEN }}" >> $GITHUB_ENV
- name: Set tests to exclude
id: set_excluded_tests
run: |
TESTS_TO_EXCLUDE="service_airplane_mode_test,\
service_bluetooth_test,\
permissions/notifications_test,\
webview_hackernews_test,\
webview_leancode_test,\
webview_stackoverflow_test"
target_paths=""
for target in $(echo $TESTS_TO_EXCLUDE | tr ',' '\n'); do
target_paths+="integration_test/${target}.dart,"
done
target_paths="${target_paths%,}"
echo "EXCLUDED_TESTS=$TESTS_TO_EXCLUDE" >> "$GITHUB_OUTPUT"
echo "EXCLUDED_TESTS=$target_paths" >> "$GITHUB_ENV"
- name: patrol build android
run: patrol build android --exclude ${{ env.EXCLUDED_TESTS }} --verbose
- name: Upload APKs to emulator.wtf and wait for tests to finish
id: tests_step
run: |
set +e
output="$(ew-cli \
emulatorwtf.yaml:ci --json \
--display-name "Patrol example app (${GITHUB_SHA::7})")"
TESTS_EXIT_CODE=$?
set -e
# Extract the results URL and write it to Github Summmary
link="$(echo "$output" | jq -r ".resultsUrl")"
echo "[Test details on emulator.wtf]($link) (LeanCode members only)" >> "$GITHUB_STEP_SUMMARY"
echo "URL_TO_DETAILS=$link" >> "$GITHUB_OUTPUT"
echo "TESTS_EXIT_CODE=$TESTS_EXIT_CODE" >> "$GITHUB_OUTPUT"
exit $TESTS_EXIT_CODE
call_send_slack_message:
name: Notify on Slack
uses: ./.github/workflows/send-slack-message.yaml
needs: run_tests
if: always()
with:
TESTS_EXIT_CODE: ${{ needs.run_tests.outputs.TESTS_EXIT_CODE }}
SLACK_MESSAGE_TITLE: ${{ needs.run_tests.outputs.SLACK_MESSAGE_TITLE }}
EXCLUDED_TESTS: ${{ needs.run_tests.outputs.EXCLUDED_TESTS }}
URL_TO_DETAILS: ${{ needs.run_tests.outputs.URL_TO_DETAILS }}
secrets: inherit