Skip to content

Commit 71e0b62

Browse files
committed
Parallelize unit tests on CI
1 parent 31c19ab commit 71e0b62

File tree

2 files changed

+44
-34
lines changed

2 files changed

+44
-34
lines changed

.github/workflows/test.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,54 @@ on:
99
- main
1010
workflow_dispatch:
1111

12+
env:
13+
DEVELOPER_DIR: /Applications/Xcode_14.2.app
14+
1215
jobs:
13-
test:
16+
test-product:
1417
name: Test
1518
runs-on: macos-12
1619
strategy:
1720
matrix:
18-
xcode_version:
19-
- 14.2
20-
env:
21-
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
21+
test_platform:
22+
- "iOS Simulator,name=iPhone 13 Pro"
23+
- "macOS"
24+
- "tvOS Simulator,name=Apple TV 4K (at 1080p) (2nd generation)"
25+
- "watchOS Simulator,name=Apple Watch Series 7 (45mm)"
2226
steps:
2327
- uses: actions/checkout@v2
24-
- name: Show environments
28+
- name: Test
29+
run: xcodebuild test -scheme swiftui-atom-properties -destination platform="${{ matrix.test_platform }}"
30+
31+
test-example-ios:
32+
name: Test
33+
runs-on: macos-12
34+
strategy:
35+
matrix:
36+
test_platform:
37+
- "iOS Simulator,name=iPhone 13 Pro"
38+
steps:
39+
- uses: actions/checkout@v2
40+
- name: Test
2541
run: |
26-
swift --version
27-
xcodebuild -version
28-
- name: Test library
29-
run: make test-library
30-
- name: Test examples
31-
run: make test-examples
42+
cd Examples/Packages/iOS
43+
xcodebuild test -scheme iOSExamples -destination platform="${{ matrix.test_platform }}"
44+
45+
test-example-cross-platform:
46+
name: Test
47+
runs-on: macos-12
48+
strategy:
49+
matrix:
50+
test_platform:
51+
- "iOS Simulator,name=iPhone 13 Pro"
52+
- "macOS"
53+
- "tvOS Simulator,name=Apple TV 4K (at 1080p) (2nd generation)"
54+
steps:
55+
- uses: actions/checkout@v2
56+
- name: Test
57+
run: |
58+
Examples/Packages/CrossPlatform
59+
xcodebuild test -scheme CrossPlatformExamples -destination platform="${{ matrix.test_platform }}"
3260
3361
validation:
3462
name: Validation
@@ -37,6 +65,10 @@ jobs:
3765
DEVELOPER_DIR: /Applications/Xcode_14.2.app
3866
steps:
3967
- uses: actions/checkout@v2
68+
- name: Show environments
69+
run: |
70+
swift --version
71+
xcodebuild -version
4072
- uses: actions/cache@v3
4173
with:
4274
path: bin

Makefile

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
TOOL = scripts/swift-run.sh
22
PACKAGE = SWIFTUI_ATOM_PROPERTIES_DEVELOPMENT=1 swift package -c release
33
SWIFT_FILE_PATHS = Package.swift Sources Tests Examples
4-
TEST_PLATFORM_IOS = iOS Simulator,name=iPhone 13 Pro
5-
TEST_PLATFORM_MACOS = macOS
6-
TEST_PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (at 1080p) (2nd generation)
7-
TEST_PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 7 (45mm)
84

95
.PHONY: proj
106
proj:
@@ -35,21 +31,3 @@ docs-preview:
3531
--disable-sandbox \
3632
preview-documentation \
3733
--product Atoms
38-
39-
.PHONY: test
40-
test: test-library test-examples
41-
42-
.PHONY: test-library
43-
test-library:
44-
for platform in "$(TEST_PLATFORM_IOS)" "$(TEST_PLATFORM_MACOS)" "$(TEST_PLATFORM_TVOS)" "$(TEST_PLATFORM_WATCHOS)"; do \
45-
xcodebuild test -scheme swiftui-atom-properties -destination platform="$$platform"; \
46-
done
47-
48-
.PHONY: test-examples
49-
test-examples:
50-
cd Examples/Packages/iOS && for platform in "$(TEST_PLATFORM_IOS)" ; do \
51-
xcodebuild test -scheme iOSExamples -destination platform="$$platform"; \
52-
done
53-
cd Examples/Packages/CrossPlatform && for platform in "$(TEST_PLATFORM_IOS)" "$(TEST_PLATFORM_MACOS)" "$(TEST_PLATFORM_TVOS)" ; do \
54-
xcodebuild test -scheme CrossPlatformExamples -destination platform="$$platform"; \
55-
done

0 commit comments

Comments
 (0)