-
Notifications
You must be signed in to change notification settings - Fork 3k
136 lines (133 loc) · 6 KB
/
focus-ios-ui-tests.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
name: "Focus UI Tests"
on:
workflow_dispatch: {}
schedule:
- cron: "0 1 * * *"
env:
browser: focus-ios
xcode_version: 16.2
ios_version: 18.2
ios_simulator_default: iPhone 16
xcodebuild_scheme: Focus
xcodebuild_target: XCUITest
test_results_directory: /Users/runner/tmp
jobs:
compile:
name: Compile
runs-on: macos-15
steps:
- name: Check out source code
uses: actions/[email protected]
- name: Setup Xcode
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
./checkout.sh
./bootstrap.sh --force
- name: Compile source code
id: compile
run: |
xcodebuild \
build-for-testing \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ env.ios_simulator_default }},OS=${{ env.ios_version }}' \
COMPILER_INDEX_STORE_ENABLE=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
working-directory: ${{ env.browser }}
- name: Save Derived Data
id: upload-derived-data
uses: actions/[email protected]
with:
name: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
path: ~/DerivedData/Build/Products
retention-days: 2
run-tests:
name: Run tests
runs-on: macos-15
needs: compile
strategy:
fail-fast: false
max-parallel: 1
matrix:
xcodebuild_test_plan: ['SmokeTest']
ios_simulator: ['iPhone 16']
steps:
- name: Check out source code
uses: actions/[email protected]
- name: Install packages
id: packages
run: |
gem install xcpretty -v 0.2.8
pip install blockkit==1.9.1
xcpretty -version
- name: Setup Xcode
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
./checkout.sh
./bootstrap.sh --force
- name: Get derived data
id: download-derived-data
uses: actions/download-artifact@v4
with:
name: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
path: ~/DerivedData/Build/Products
- name: Run tests
id: run-tests
run: |
xcodebuild \
test-without-building \
-scheme ${{ env.xcodebuild_scheme }} \
-target ${{ env.xcodebuild_target }} \
-derivedDataPath ~/DerivedData \
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ env.ios_version }}' \
-testPlan ${{ matrix.xcodebuild_test_plan }} \
-resultBundlePath ${{ env.test_results_directory }}/results
| tee xcodebuild.log | xcpretty -r junit && exit ${PIPESTATUS[0]}
working-directory: ${{ env.browser }}
continue-on-error: true
# - name: Print test report
# id: test-report
# run: |
# python ../test-fixtures/ci/convert_junit_to_markdown.py ${{ matrix.xcodebuild_test_plan == 'SmokeTest' && '--smoke' || '' }} --github --${{ env.browser }} ./build/reports/junit.xml ./github.md
# cat github.md >> $GITHUB_STEP_SUMMARY
# python ../test-fixtures/ci/convert_junit_to_markdown.py ${{ matrix.xcodebuild_test_plan == 'SmokeTest' && '--smoke' || '' }} --slack --${{ env.browser }} ./build/reports/junit.xml ./slack.json
# working-directory: ${{ env.browser }}
# - name: Upload log file
# id: upload-log
# uses: actions/[email protected]
# with:
# name: ${{ env.browser }}-${{ matrix.xcodebuild_test_plan }}-${{ matrix.ios_simulator }}-xcodebuildlog-${{ github.run_number }}
# path: ${{ env.browser }}/xcodebuild.log
# retention-days: 90
# - name: Upload junit files
# id: upload-junit
# uses: actions/[email protected]
# with:
# name: ${{ env.browser }}-${{ matrix.xcodebuild_test_plan }}-${{ matrix.ios_simulator }}-junit-${{ github.run_number }}
# path: ${{ env.browser }}/build/reports/junit.xml
# retention-days: 90
# - name: Report to Slack
# id: slack
# uses: slackapi/[email protected]
# with:
# payload-file-path: ${{ env.browser }}/slack.json
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_SLACK_TOKEN }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
# ios_simulator: ${{ matrix.ios_simulator }}
# pass_fail: ${{ steps.run-tests.outcome == 'success' && ':white_check_mark:' || ':x:' }}
# xcodebuild_test_plan: ${{ matrix.xcodebuild_test_plan }}
# 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.run-tests.outcome == 'success' && '0' || '1' }}