-
Notifications
You must be signed in to change notification settings - Fork 146
141 lines (117 loc) · 4.68 KB
/
test-ios-device.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
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
name: test ios device
on:
workflow_dispatch:
schedule:
- cron: '30 21 * * *'
jobs:
run_tests:
name: Flutter ${{ matrix.flutter-version }} on ${{ matrix.device_model }} ${{ matrix.os }} ${{ matrix.os_version }} on FTL
runs-on: macos-latest
timeout-minutes: 40
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on ${{ matrix.os }} ${{ matrix.os_version }}
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.24.x']
flutter-channel: ['stable']
device_model: ['iphone14pro']
os_version: ['16.6']
os: [iOS]
defaults:
run:
working-directory: dev/e2e_app
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Add current platform to Gemfile
working-directory: dev/e2e_app/ios
run: bundle lock --add-platform ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
working-directory: dev/e2e_app/ios
- name: Set up fastlane
working-directory: dev/e2e_app/ios
run: bundle install
- name: Run fastlane match
working-directory: dev/e2e_app/ios
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
GIT_USERNAME: ${{ secrets.PATROL_FASTLANE_CERTS_REPO_TOKEN_USERNAME }}
GIT_TOKEN: ${{ secrets.PATROL_FASTLANE_CERTS_REPO_TOKEN }}
APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }}
APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }}
APP_STORE_KEY: ${{ secrets.APP_STORE_KEY }}
run: bundle exec fastlane ios certificates
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}
- name: Preload Flutter artifacts
run: flutter precache --ios
- name: Set up Melos and activate workspace
working-directory: .
run: |
dart pub global activate melos
melos bootstrap
- name: Set up Patrol CLI
working-directory: packages/patrol_cli
run: dart pub global activate --source path . && patrol
- name: Set tests to exclude
id: set_excluded_tests
run: |
TESTS_TO_EXCLUDE="android_app_test,\
permissions/permissions_location_test,\
service_dark_mode_test,\
service_location_test,\
permissions/notifications_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: Build tests
run: patrol build ios --release --exclude ${{ env.EXCLUDED_TESTS }} --verbose
- name: Upload APKs to Firebase Test Lab and wait for tests to finish
id: tests_step
env:
IOS_DEVICE_MODEL: ${{ matrix.device_model }}
IOS_DEVICE_VERSION: ${{ matrix.os_version }}
run: |
set +e
output="$(./run_ios_testlab 2>&1)"
TESTS_EXIT_CODE=$?
set -e
echo "$output"
# Extract the last link using grep, tail, and sed, and write it to Github Summmary
link="$(echo "$output" | grep -o 'https://[^ ]*' | tail -1 | sed 's/\[//;s/\]//')"
echo "[Test details on Firebase Test Lab]($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