-
Notifications
You must be signed in to change notification settings - Fork 3k
185 lines (182 loc) · 8.2 KB
/
focus-ios-ui-tests-previous-os.yml
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Focus iOS 15, 16 & 17 tests
on:
workflow_dispatch:
schedule:
- cron: "0 7 * * 1,3,5"
env:
browser: focus-ios
xcode_version: 16.2
xcodebuild_scheme: Focus
xcodebuild_target: XCUITest
test_results_directory: /Users/runner/tmp
jobs:
Focus-iOS-Tests:
name: Focus iOS
runs-on: macos-15
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- ios_version: 17.5
ios_simulator: iPhone 15
- ios_version: 16.4
ios_simulator: iPhone 14
- ios_version: 15.5
ios_simulator: iPhone 13
steps:
- name: Check out source code
uses: actions/[email protected]
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install packages
run: |
pip3 install virtualenv pipenv
gem install xcpretty -v 0.3.0
pip install blockkit==1.9.1
- name: Setup Xcode
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo rm -fr /Applications/Xcode_15*
sudo rm -fr /Applications/Xcode_14*
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
./checkout.sh
./bootstrap.sh --force
- name: Create iOS ${{ matrix.ios_version }} simulator
id: setup-simulator
run: |
xcrun simctl list runtimes
output=$(xcrun simctl list runtimes | grep 'iOS ${{ matrix.ios_version }}' || true)
if [ -n "$output" ]; then
echo "iOS ${{ matrix.ios_version }} simulator has already been installed"
else
echo "Install iOS ${{ matrix.ios_version }} runtime"
sudo xcodes runtimes install "iOS ${{ matrix.ios_version }}"
fi
xcrun simctl list devices iphone
- name: Build Focus
id: compile
run: |
xcodebuild \
build-for-testing \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ matrix.ios_version }}' \
COMPILER_INDEX_STORE_ENABLE=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO ARCH="arm64"
working-directory: ${{ env.browser }}
- name: Run smoke tests
id: run-smoketests
run: |
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ matrix.ios_version }}' \
-testPlan SmokeTest \
-resultBundlePath ${{ env.test_results_directory }}/results-smoketests \
| tee xcodebuild-smoketests.log | xcpretty _0.3.0_ -r junit --output ./junit-smoketests.xml && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
- name: Run full functional tests
id: run-fullfunctionaltests
run: |
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ matrix.ios_version }}' \
-testPlan FullFunctionalTests \
-resultBundlePath ${{ env.test_results_directory }}/results-fullfunctionaltests \
| tee xcodebuild-fullfunctionaltests.log | xcpretty _0.3.0_ -r junit --output ./junit-fullfunctionaltests.xml && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
- name: Determine pass/fail status
id: passfail
run: |
echo "Smoke Tests status: "${{ steps.run-smoketests.outcome }}
echo "Full Functional Tests status: "${{ steps.run-fullfunctionaltests.outcome }}
if [[ ${{ steps.run-smoketests.outcome }} != 'success'
|| ${{ steps.run-fullfunctionaltests.outcome }} != 'success' ]]; then
exit 1
else
exit 0
fi
continue-on-error: true
- name: Print test report
id: test-report
run: |
# Smoke Tests
python ../test-fixtures/ci/convert_junit_to_markdown.py --smoke --github --${{ env.browser }} ./junit-smoketests.xml ./github-smoketests.md
echo "# Smoke Tests " >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat github-smoketests.md >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
python ../test-fixtures/ci/convert_junit_to_markdown.py --smoke --slack --${{ env.browser }} ./junit-smoketests.xml ./slack-smoketests.json
mv ./junit-smoketests.xml "junit-focus-ios-smoketests-${{ matrix.ios_simulator }}-${{ matrix.ios_version }}-`date +"%Y-%m-%d"`.xml"
# Full Functional Tests
python ../test-fixtures/ci/convert_junit_to_markdown.py --github --${{ env.browser }} ./junit-fullfunctionaltests.xml ./github-fullfunctionaltests.md
echo "# Full Functional Tests " >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat github-fullfunctionaltests.md >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
python ../test-fixtures/ci/convert_junit_to_markdown.py --slack --${{ env.browser }} ./junit-fullfunctionaltests.xml ./slack-fullfunctionaltests.json
mv ./junit-fullfunctionaltests.xml "junit-focus-ios-fullfunctionaltests-${{ matrix.ios_simulator }}-${{ matrix.ios_version }}-`date +"%Y-%m-%d"`.xml"
working-directory: ${{ env.browser }}
- name: Upload junit files
id: upload-junit
uses: actions/[email protected]
with:
name: ${{ env.browser }}-${{ matrix.ios_simulator }}-${{ matrix.ios_version }}-junit-${{ github.run_number }}
path: ${{ env.browser }}/junit-focus-ios-*.xml
retention-days: 90
- name: Upload log file
id: upload-log
uses: actions/[email protected]
with:
name: ${{ env.browser }}-${{ matrix.ios_simulator }}-${{ matrix.ios_version }}-xcodebuildlog-${{ github.run_number }}
path: ${{ env.browser }}/xcodebuild-*.log
retention-days: 90
- name: Report to Slack (SmokeTests)
id: slack-smoketests
uses: slackapi/[email protected]
with:
payload-file-path: ${{ env.browser }}/slack-smoketests.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_SLACK_TOKEN }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
ios_simulator: ${{ matrix.ios_simulator }}
ios_version: ${{ matrix.ios_version }}
pass_fail: ${{ steps.run-smoketests.outcome == 'success' && ':white_check_mark:' || ':x:' }}
xcodebuild_test_plan: SmokeTests
ref_name: ${{ github.ref_name }}
repository: ${{ github.repository }}
run_id: ${{ github.run_id }}
server_url: ${{ github.server_url }}
sha: ${{ github.sha }}
- name: Report to Slack (FullFunctionalTests)
id: slack-fullfunctionaltests
uses: slackapi/[email protected]
with:
payload-file-path: ${{ env.browser }}/slack-fullfunctionaltests.json
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_SLACK_TOKEN }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
ios_simulator: ${{ matrix.ios_simulator }}
ios_version: ${{ matrix.ios_version }}
pass_fail: ${{ steps.run-fullfunctionaltests.outcome == 'success' && ':white_check_mark:' || ':x:' }}
xcodebuild_test_plan: FullFunctionalTests
ref_name: ${{ github.ref_name }}
repository: ${{ github.repository }}
run_id: ${{ github.run_id }}
server_url: ${{ github.server_url }}
sha: ${{ github.sha }}
- name: Return fail status if a test fails
run: |
exit ${{ steps.passfail.outcome == 'success' && '0' || '1' }}