Skip to content

Commit ccd3300

Browse files
committed
fix(ci): scrub hosted test apps before launch
1 parent 02a4254 commit ccd3300

1 file changed

Lines changed: 32 additions & 13 deletions

File tree

scripts/test.sh

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ clean_test_products() {
6363
scripts/clean-xcode-products.sh --remove-app-products >/dev/null
6464
}
6565

66+
scrub_test_products() {
67+
[ "$(uname -s)" = Darwin ] || return 0
68+
scripts/clean-xcode-products.sh >/dev/null
69+
}
70+
6671
cleanup_test_products() {
6772
local status=$?
6873
trap - EXIT INT TERM
@@ -133,45 +138,59 @@ run_swift() {
133138
swift test --no-parallel --package-path Packages/ContainerizationEngine
134139
}
135140

136-
run_app() {
137-
prepare_swift
138-
require_dory_quit
139-
clean_test_products
140-
trap cleanup_test_products EXIT
141-
trap 'exit 130' INT
142-
trap 'exit 143' TERM
141+
run_app_xcodebuild() {
142+
local action="$1"
143143
if [ -n "${CI:-}" ]; then
144-
run_xcodebuild test \
144+
run_xcodebuild "$action" \
145145
-project Dory.xcodeproj \
146146
-scheme Dory \
147147
-destination 'platform=macOS' \
148148
CODE_SIGNING_ALLOWED=NO \
149149
CODE_SIGNING_REQUIRED=NO
150150
else
151-
run_xcodebuild test \
151+
run_xcodebuild "$action" \
152152
-project Dory.xcodeproj \
153153
-scheme Dory \
154154
-destination 'platform=macOS'
155155
fi
156-
clean_test_products
157-
trap - EXIT INT TERM
158156
}
159157

160-
run_ui() {
158+
run_app() {
161159
prepare_swift
162160
require_dory_quit
163161
clean_test_products
164162
trap cleanup_test_products EXIT
165163
trap 'exit 130' INT
166164
trap 'exit 143' TERM
167-
run_xcodebuild test \
165+
run_app_xcodebuild build-for-testing
166+
scrub_test_products
167+
run_app_xcodebuild test-without-building
168+
clean_test_products
169+
trap - EXIT INT TERM
170+
}
171+
172+
run_ui_xcodebuild() {
173+
local action="$1"
174+
run_xcodebuild "$action" \
168175
-project Dory.xcodeproj \
169176
-scheme 'Dory UI Tests' \
170177
-destination 'platform=macOS' \
171178
-parallel-testing-enabled NO \
172179
CODE_SIGNING_ALLOWED=YES \
173180
CODE_SIGNING_REQUIRED=YES \
174181
CODE_SIGN_IDENTITY=-
182+
}
183+
184+
run_ui() {
185+
prepare_swift
186+
require_dory_quit
187+
clean_test_products
188+
trap cleanup_test_products EXIT
189+
trap 'exit 130' INT
190+
trap 'exit 143' TERM
191+
run_ui_xcodebuild build-for-testing
192+
scrub_test_products
193+
run_ui_xcodebuild test-without-building
175194
clean_test_products
176195
trap - EXIT INT TERM
177196
}

0 commit comments

Comments
 (0)