Skip to content

Commit 777f777

Browse files
committed
Updated GitHub CI
1 parent 67738d2 commit 777f777

File tree

1 file changed

+54
-24
lines changed

1 file changed

+54
-24
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,60 +21,90 @@ on:
2121

2222
schedule:
2323
- cron: '40 11 * * *' # once a day @ 11:40am UTC (4:40am PST)
24-
25-
jobs:
24+
25+
env:
26+
SCHEME: "TextFileKit-CI"
27+
28+
jobs:
2629
macOS:
2730
name: macOS
28-
runs-on: macos-latest
31+
runs-on: macos-15
2932
steps:
3033
- uses: actions/checkout@main
34+
- uses: maxim-lobanov/setup-xcode@v1
35+
with:
36+
xcode-version: latest-stable
3137
- name: Build
32-
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=macOS,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]}
38+
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]}
3339
- name: Unit Tests
34-
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=macOS" | xcpretty && exit ${PIPESTATUS[0]}
40+
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS" | xcpretty && exit ${PIPESTATUS[0]}
3541

3642
macCatalyst:
3743
name: macCatalyst
38-
runs-on: macos-latest
44+
runs-on: macos-15
3945
steps:
4046
- uses: actions/checkout@main
47+
- uses: maxim-lobanov/setup-xcode@v1
48+
with:
49+
xcode-version: latest-stable
4150
- name: Build
42-
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]}
51+
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]}
4352
- name: Unit Tests
44-
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=macOS,variant=Mac Catalyst" | xcpretty && exit ${PIPESTATUS[0]}
45-
53+
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS,variant=Mac Catalyst" | xcpretty && exit ${PIPESTATUS[0]}
54+
4655
iOS:
4756
name: iOS
48-
runs-on: macos-latest # this must be macos, GitHub does not offer iOS directly but we can use xcodebuild
57+
runs-on: macos-15
4958
steps:
5059
- uses: actions/checkout@main
60+
- uses: maxim-lobanov/setup-xcode@v1
61+
with:
62+
xcode-version: latest-stable
5163
- name: Build
52-
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=iOS Simulator,name=Any iOS Device" | xcpretty && exit ${PIPESTATUS[0]}
64+
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=iOS Simulator,name=Any iOS Device" | xcpretty && exit ${PIPESTATUS[0]}
65+
- name: Prepare Destination Device Name
66+
shell: bash
67+
run: |
68+
DESTNAME=$(xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" | perl -nle 'if (m/iOS\sSimulator.*(iPhone.*)\s\}\.*/g) { print $1; }' | head -n 1)
69+
echo Using device \"$DESTNAME\"
70+
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV"
5371
- name: Unit Tests
54-
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=iOS Simulator,name=iPhone 15" | xcpretty && exit ${PIPESTATUS[0]}
55-
72+
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=iOS Simulator,name=$DESTNAME" | xcpretty && exit ${PIPESTATUS[0]}
73+
5674
tvOS:
5775
name: tvOS
58-
runs-on: macos-latest # this must be macos, GitHub does not offer tvOS directly but we can use xcodebuild
76+
runs-on: macos-15
5977
steps:
6078
- uses: actions/checkout@main
79+
- uses: maxim-lobanov/setup-xcode@v1
80+
with:
81+
xcode-version: latest-stable
6182
- name: Build
62-
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=tvOS Simulator,name=Any tvOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]}
83+
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=tvOS Simulator,name=Any tvOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]}
84+
- name: Prepare Destination Device Name
85+
shell: bash
86+
run: |
87+
DESTNAME=$(xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" | perl -nle 'if (m/tvOS\sSimulator.*(Apple\sTV.*)\s\}\.*/g) { print $1; }' | head -n 1)
88+
echo Using device \"$DESTNAME\"
89+
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV"
6390
- name: Unit Tests
64-
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=tvOS Simulator,name=Apple TV 4K (3rd generation)" | xcpretty && exit ${PIPESTATUS[0]}
65-
91+
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=tvOS Simulator,name=$DESTNAME" | xcpretty && exit ${PIPESTATUS[0]}
92+
6693
watchOS:
6794
name: watchOS
68-
runs-on: macos-latest # this must be macos, GitHub does not offer watchOS directly but we can use xcodebuild
95+
runs-on: macos-15
6996
steps:
7097
- uses: actions/checkout@main
7198
- uses: maxim-lobanov/setup-xcode@v1
7299
with:
73-
xcode-version: latest-stable # Sometimes a newer version of Xcode is available but isn't yet made default
100+
xcode-version: latest-stable
74101
- name: Build
75-
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=watchOS Simulator,name=Any watchOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]}
102+
run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=watchOS Simulator,name=Any watchOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]}
103+
- name: Prepare Destination Device Name
104+
shell: bash
105+
run: |
106+
DESTNAME=$(xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" | perl -nle 'if (m/watchOS\sSimulator.*(Apple\sWatch.*)\s\}\.*/g) { print $1; }' | head -n 1)
107+
echo Using device \"$DESTNAME\"
108+
echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV"
76109
- name: Unit Tests
77-
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)" | xcpretty && exit ${PIPESTATUS[0]}
78-
79-
# xcodebuild test reference:
80-
# https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/08-automation.html
110+
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=watchOS Simulator,name=$DESTNAME" | xcpretty && exit ${PIPESTATUS[0]}

0 commit comments

Comments
 (0)