Skip to content

Commit 39e336c

Browse files
authored
Run library and example project tests against multiple Xcode versions and device destinations (#5)
1 parent aab5830 commit 39e336c

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,22 @@ on:
88

99
jobs:
1010
build:
11-
11+
name: Checks (Xcode ${{ matrix.xcode_version }})
1212
runs-on: macos-11
13+
env:
14+
SCHEME: "swift-user-defaults"
15+
DEVELOPER_DIR: '/Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer'
16+
17+
strategy:
18+
matrix:
19+
xcode_version: ['12.5', '13.1']
20+
include:
21+
- xcode_version: '12.5'
22+
destination_ios: 'OS=14.5,name=iPhone 12'
23+
destination_macos: 'platform=macOS'
24+
- xcode_version: '13.1'
25+
destination_ios: 'OS=15.0,name=iPhone 13'
26+
destination_macos: 'platform=macOS'
1327

1428
steps:
1529
- uses: actions/checkout@v2
@@ -20,13 +34,17 @@ jobs:
2034
with:
2135
bundler-cache: true
2236

23-
# Build
24-
- name: Build
25-
run: swift build -v
37+
# Build library & Run Unit-Tests (MacOS)
38+
- name: Build & Unit-Test Library (MacOS)
39+
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme $SCHEME -destination "${{ matrix.destination_macos }}" clean test | bundle exec xcpretty
40+
41+
# Build library & Run Unit-Tests (iOS)
42+
- name: Build & Unit-Test Library (iOS)
43+
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme $SCHEME -destination "${{ matrix.destination_ios }}" clean test | bundle exec xcpretty
2644

27-
# Run Unit Tests
28-
- name: Run tests
29-
run: swift test -v
45+
# Build Example Project & Run UI-Tests (iOS)
46+
- name: Build & UI-Test Example Project (iOS)
47+
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace "Example/Example.xcworkspace" -scheme "Example" -destination "${{ matrix.destination_ios }}" clean test | bundle exec xcpretty
3048

3149
# Verify CocoaPods
3250
- name: Verify CocoaPods

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ source "https://rubygems.org"
22

33
# Cocoapods for iOS dependency management
44
gem 'cocoapods'
5+
6+
# XCPretty gem for ci workflow output formatting
7+
gem 'xcpretty'

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ GEM
7373
netrc (0.11.0)
7474
public_suffix (4.0.6)
7575
rexml (3.2.5)
76+
rouge (2.0.7)
7677
ruby-macho (2.5.1)
7778
typhoeus (1.4.0)
7879
ethon (>= 0.9.0)
@@ -85,6 +86,8 @@ GEM
8586
colored2 (~> 3.1)
8687
nanaimo (~> 0.3.0)
8788
rexml (~> 3.2.4)
89+
xcpretty (0.3.0)
90+
rouge (~> 2.0.7)
8891
zeitwerk (2.5.1)
8992

9093
PLATFORMS
@@ -93,6 +96,7 @@ PLATFORMS
9396

9497
DEPENDENCIES
9598
cocoapods
99+
xcpretty
96100

97101
BUNDLED WITH
98102
2.2.22

0 commit comments

Comments
 (0)